Multiclass LandCover dataset segmentation

The following example shows how to prepare the onnx model for field segmentation.


The example is based on the dataset. It provides satellite images with 25 cm/px and 50 cm/px resolution. Annotation masks for the following classes are provided for the images: building (1), woodland (2), water(3), road(4).

Architecture and training

We built our pipeline based on Pytorch, Pytorch Lightning, and Pytchorchsegmentation_models.pytorch repository. Our training pipeline is available in the repository.

  • Model DeepLabV3+ with tu-semnasnet_100 backend

  • Loss function: balanced FocalDiceLoss

  • Input image size: 512x512

  • Normalization: 1./255.

  • Color order: RGB

Converting to onnx

When model training is completed, export the model using the script below:

x = next(iter(datamodule.test_dataloader()))[0]

                  x[:1],  # model input
                  'model.onnx',  # where to save the model

Example inference

Run QGIS, next add Google Earth map using QuickMapServices plugin.


Then run our plugin and set parameters like in the screenshot below. You can find the pre-trained onnx model at examples/deeplabv3_segmentation_landcover/deeplabv3_landcover_4c.onnx path. Push the Run button to start processing.


After a few seconds, the results are available:

  • stats

  • output layers

  • predicted mask

  • predicted mask with Google Earth background