Skip to content

About

Code supplement: Mapping small landscape features in agricultural lands using CNN-based semantic segmentation

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

Repository files navigation

slf_segmentation

DOI Open In Collab
Code supplement for Fauzan et al. (2026). Mapping small landscape features in agricultural lands using CNN-based semantic segmentation.

Summary

The current practice of creating small landscape feature (SLF) datasets is the manual digitization of very high-resolution orthophotos by landowners, with datasets managed and published by the CAP paying agency of the member states. Such a practice is time-consuming and difficult to scale. CNN models have the potential to detect these elements from orthophotos. However, it is currently unclear what the best setup would be to apply such a model to detect SLF at the national scale.

  • Objective:
    • To assess the CNN-based segmentation model's capability for the patchy SLF segmentation task
    • To evaluate the inference setup for nationwide mapping
    • To compare the model's nationwide prediction results with the official SLF registry and relevant remote sensing products
  • Main findings:
    • U-Net can be used for specific SLF segmentation
    • Multi-scale augmentation improved model performance
    • Larger patch size during inference helps with hedgerow commission error
    • Applying overlapping patches during inference helps smooth the prediction output, while scaling probability values during inference helps with memory usage
  • Known limitations:
    • Commission error from hedgerows
    • Omission error of field islands lacking tree canopies

Environment setup

Usage

Model training

  • Specify input data and hyperparameters in training/train.py and run
  • Use the training logs (*.csv) to plot the model behavior during training with training/plot_loss_f1.py

Model testing

  • Run evaluation/test_inference.py on one or more large images (e.g. 5 x 5 km²) to obtain mosaicked probability prediction raster(s)
  • Calculate AUC/ROC to define optimal probability threshold and accuracy metrics with evaluation/test_accuracy.py.

Inference on mosaic

  • Run inference/inference_patches.py to obtain probability prediction at patch level (500 x 500 px)
  • Batch resample each probability patch into coarser resolution virtual rasters (vrt) with inference/resample_patches.sh (e.g. from 0.25 m to 1 m GSD)
  • Group each vrt into processing tiles using inference/group_patches_to_tiles.py.
  • Run inference/mosaic_tile.py to create a mosaic based on patches

Post-processing

  • To apply the non-arable land mask, run postprocessing/mask.sh
  • To remove sieve pixels, run postprocessing/sieve_removal.py
  • Convert probability mosaic raster(s)/tiles into polygon (geopackage) using postprocessing/polygonize.py
  • Simplify and smooth the vertices of each polygon feature using postprocessing/smooth_polygon.py.

About

Code supplement: Mapping small landscape features in agricultural lands using CNN-based semantic segmentation

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages