Real-Time-Anomaly-Segmentation [Course Project]
This repository provides a starter-code setup for the Real-Time Anomaly Segmentation project of the Machine Learning Course. It consists of the code base for training ERFNet on the Cityscapes dataset and perform anomaly segmentation.
For instructions, please refer to the README in each folder:
- train contains tools for training the network for semantic segmentation.
- eval contains tools for evaluating/visualizing the network's output and performing anomaly segmentation.
- imagenet Contains script and model for pretraining ERFNet's encoder in Imagenet.
- trained_models Contains the trained models used in the papers.
- 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
- Python 3.6: If you don't have Python3.6 in your system, I recommend installing it with Anaconda
- PyTorch: Make sure to install the Pytorch version for Python 3.6 with CUDA support (code only tested for CUDA 8.0).
- Additional Python packages: numpy, matplotlib, Pillow, torchvision and visdom (optional for --visualize flag)
- For testing the anomaly segmentation model: Road Anomaly, Road Obstacle, and Fishyscapes dataset. All testing images are provided here Link.
- The repo provides a pre-trained ERFNet on the cityscapes dataset that can be used to perform anomaly segmentation on test anomaly datasets.
- Anomaly Inference Command:
python evalAnomaly.py --input '/home/shyam/ViT-Adapter/segmentation/unk-dataset/RoadAnomaly21/images/*.png
. Change the dataset path'/home/shyam/ViT-Adapter/segmentation/unk-dataset/RoadAnomaly21/images/*.png
accordingly.