-
Notifications
You must be signed in to change notification settings - Fork 1
Export our model to ONNX as Deepness Segmentor #225
Description
User Story:
As a machine learning engineer,
I want to export our trained model in Deepness Segmentor format compatible with QGIS,
So that users can perform semantic segmentation on selected map polygons with optimized inference.
Acceptance Criteria:
- Model converted to ONNX format with metadata requirements
- Deepness-compatible segmentation masks validated (correct class mapping)
- Output produces single-class masks per input patch (entire patch = one class)
- Documentation added for export process and requirements
Definition of Done:
- All acceptance criteria met
- Code reviewed and approved
- Unit tests for export script
- Documentation updated in
/docs/deployment.md - Sample exported model added to model registry
Description:
Labels for Polish trees in QGIS: https://essd.copernicus.org/articles/16/2877/2024/#section4
Export model to Deepness Segmentor format (reference: Fire Risk Model example) with these specifications:
- Input: 4-channel patches (Near-Infrared, Red, Green, Blue) from QGIS
- Output: Single-class segmentation mask per patch (all pixels = same class)
- Focus: Forest areas only (no "other" classes in initial version)
- Normalization: Handled automatically by Deepness
- Polygon support: Inference on user-selected map regions
- Channel selection: QGIS users can select input channels
Metadata Requirements (source):
metadata = {
'model_type': 'segmentor',
'task_type': 'segmentation',
'classes': '["forest"]', # Single-class initially
'input_channels': 4, # NIR-R-G-B
'normalization_mean': "[0.485, 0.456, 0.406, 0.440]",
'normalization_std': "[0.229, 0.224, 0.225, 0.242]"
}Resources:
Konwertowanie modelu do ONNX: https://qgis-plugin-deepness.readthedocs.io/en/latest/creators/creators_example_onnx_model.html,
Deepness model zoo: https://qgis-plugin-deepness.readthedocs.io/en/latest/main/main_model_zoo.html#deepness-model-zoo
(Szczególnie Fire Risk): https://qgis-plugin-deepness.readthedocs.io/en/latest/example/example_segmentation_landcover.html
Metadata: https://qgis-plugin-deepness.readthedocs.io/en/latest/creators/creators_add_metadata_to_model.html
Deepness does normalization by default.