Skip to content

dariak153/Crossings-Segmentation-On-Aerial-Pictures

Repository files navigation

Model for pedestrian and bicycle crossings segmentation in QGIS

Results

Model

The model is based on Segformer architecture with ResNet-50 backbone. The model was exported to onxx format and can be downloaded from the onnx_model folder.

Data

The data are aerial images from the Poznan 2022 aerial orthophoto high resolution map available in QGIS. The images were created with the Deepness plugin, with the following parameters:

  • Resolution [cm/px]: 10.00
  • Tile size [px]: 512
  • Batch size: 1
  • Tile overlap [%]: 10

The images come from the following locations:

* Images from the Roboflow platform were adjust to be in the same format as the images from CVAT. Additionally, they were checked for mistakes in the annotations, and if necessary, they were corrected.

Example of the data annotations

Data Data Data

Dependencies for training

The following dependencies are required to train the model:

pip install -r requirements.txt
  • to use the Segformer model, upgrade the library with:
pip install --upgrade git+https://github.com/qubvel/segmentation_models.pytorch
  • install the package
pip install -e .

How to train the model

The training script allows you to train models with different architectures and backbones. The command to run training of the final model is listed below, and commands for other models are available in the Extras.

Segformer (ResNet-50):

python scripts/run_training.py --model segformer_resnet50 

How to evaluate model

python scripts/run_evaluation.py --model unet_effb0 --checkpoint checkpoints/<checkpoint_folder>/best-checkpoint.ckpt --format ckpt --num_samples 5

Example

python scripts/run_evaluation.py --model deeplabv3plus_resnet34 --checkpoint checkpoints/run_20250105-144034/best-checkpoint.ckpt --format ckpt --num_samples 10  --batch_size 4

Training process and metrics on the test set

Training Metrics

Predicted results

The model is overall working really well (what's confirmed by the metrics on the test dataset), and it works properly on different maps, that were not used for training.

Very rarely the model is not cutting out cars (specifically black or white cars are problematic) or is missing some old faded paint (some of the missed crossings are even hard to spot for human, so it's not missing the obvious ones).

Poznan 2022 aerial orthophoto high resolution (the map that was used to create training set)

Results Results Results Results Results Results

Poznan 2022 (almost) whole city statistics

Just from curiosity the model was run on majority of Poznań at once to capture statistics about the percentage of are covered with pedestrian/bike crossings. Whole-Poznan

Poznan 2023 aerial orthophoto high resolution (the map was not used to create training set)

Results-2023 Results-2023 Results-2023 Results-2023

Poznan 2022 aerial orthophoto high resolution (places that are not perfect)

Results-bad Results-bad Results-bad Results-bad

Demo instructions and video

Gif

To reproduce the results use the Poznan 2022 aerial orthophoto high resolution map and the model from the onnx_model folder. You can zoom-in at the intersections from the gif, or use any other location.

People

The model was prepared by:

Extras:

Training other models

To train other models you can try the following commands

FPN (ResNet-34):

python scripts/run_training.py --model fpn_resnet34 

UNet++ (MobileNetV2)

python scripts/run_training.py --model unet_mobilenetv2 

UNet++ (EfficientNet-B0):

python scripts/run_training.py --model unet_effb0

UNet++ (ResNet-34)

python scripts/run_training.py --model unet_resnet34

DeepLabV3 (ResNet-34):

For training DeepLabV3, it is important to set the batch size different from 1 so the batch norm layers can work properly.

python scripts/run_training.py --model deeplabv3plus_resnet34

DeepLabV3 (ResNet-34):

python scripts/run_training.py --model deeplabv3_resnet34 

SegFormer (TU-SemNasNet-100):

python scripts/run_training.py --model segformer_tu-semnasnet_100

SegFormer (MiT-B0):

python scripts/run_training.py --model segformer_mit_b0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages