Skip to content

FarInHeight/Real-Time-Anomaly-Segmentation-for-Road-Scenes

Repository files navigation

Real-Time Anomaly Segmentation for Road Scenes

This repository contains the code of the Real-Time Anomaly Segmentation for Road Scenes project of the Advanced Machine Learning course 23/24 - Politecnico di Torino

This repository was built on the following repository base: erfnet_pytorch.
A brief overview of the project is available at s326619_s330509_project4.pdf.

Sample Results

Example of Anomaly scores calculated by an ERFNet model using the MaxLogit inference method.

Original Images

Tractor Phone Box

Ground Truth Anomaly

Tractor Ground Truth Anomaly Phone Box Truth Anomaly

Anomaly Scores

Tractor Anomaly Scores Phone Box Anomaly Scores

Packages

For instructions, please refer to the README in each folder:

  • train contains tools for training the networks for semantic segmentation.
  • eval contains tools for evaluating/visualizing the networks' output and performing anomaly segmentation.
  • imagenet contains scripts and model for pretraining ERFNet's encoder in Imagenet.
  • trained_models contains some trained models used in the papers (almost all the models are available in the Releases section).

Datasets

  • The Cityscapes dataset: Download the "leftImg8bit" for the RGB images and the "gtFine" for the labels. Please note that for training you should use the "_labelTrainIds" and not the "_labelIds", you can download the cityscapes scripts and use the conversor to generate trainIds from labelIds
  • For testing the anomaly segmentation models: All testing images are provided here.

Networks

The repo provides the following pre-trained networks that can be used to perform anomaly segmentation:

  • Erfnet trained on 19 classes of the Cityscapes dataset using a Cross-Entropy loss, Logit Norm + Cross Entropy, Logit Norm + Focal Loss, IsoMax+ + Cross Entropy and IsoMax+ + Focal Loss
  • BiSeNetV1 trained on 20 classes (19 + void class) of the Cityscapes dataset
  • Enet trained on 20 classes (19 + void class) of the Cityscapes dataset

Notebook

The AML_Project.ipynb can be opened on Colab to run all the evaluation commands.

Authors

License

Please refer to the following repo and license for the use and modification of the material contained in the linked repository and modified in this repo.