-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,62 @@ | ||
# Real-Time-Anomaly-Segmentation [[Course Project](https://docs.google.com/document/d/1ElljsAprT2qX8RpePSQ3E00y_3oXrtN_CKYC6wqxyFQ/edit?usp=sharing)] | ||
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. | ||
# 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 | ||
|
||
### Sample Results | ||
|
||
#### First Example | ||
|
||
* Original Image <br/> | ||
<img src="eval/saved_anomalies/tractor.png" alt="Tractor" style="height:256px;width:512px;width:512px;"/> | ||
|
||
* Ground Truth Anomaly <br/> | ||
<img src="eval/saved_anomalies/tractor_label.png" alt="Tractor Ground Truth Anomaly" style="height:256px;width:512px;"/> | ||
|
||
* Anomaly Scores <br/> | ||
<img src="eval/saved_anomalies/tractor_anomaly_scores.png" alt="Tractor Anomaly Scores" style="height:256px;width:512px;"/> | ||
|
||
#### Second Example | ||
|
||
* Original Image <br/> | ||
<img src="eval/saved_anomalies/phone_box.png" alt="Phone Box" style="height:256px;width:512px;"/> | ||
|
||
* Ground Truth Anomaly <br/> | ||
<img src="eval/saved_anomalies/phone_box_label.png" alt="Phone Box Truth Anomaly" style="height:256px;width:512px;"/> | ||
|
||
* Anomaly Scores <br/> | ||
<img src="eval/saved_anomalies/phone_box_anomaly_scores.png" alt="Phone Box Anomaly Scores" style="height:256px;width:512px;"/> | ||
|
||
## Packages | ||
For instructions, please refer to the README in each folder: | ||
For instructions, please refer to the __README__ in each folder: | ||
|
||
* [train](train) contains tools for training the network for semantic segmentation. | ||
* [eval](eval) contains tools for evaluating/visualizing the network's output and performing anomaly segmentation. | ||
* [imagenet](imagenet) Contains script and model for pretraining ERFNet's encoder in Imagenet. | ||
* [trained_models](trained_models) Contains the trained models used in the papers. | ||
* [train](train) contains tools for training the networks for semantic segmentation. | ||
* [eval](eval) contains tools for evaluating/visualizing the networks' output and performing anomaly segmentation. | ||
* [imagenet](imagenet) contains scripts and model for pretraining ERFNet's encoder in Imagenet. | ||
* [trained_models](trained_models) contains the trained models used in the papers (some networks are in the Releases section of the Repo). | ||
|
||
## Requirements: | ||
## Datasets | ||
|
||
* [**The Cityscapes dataset**](https://www.cityscapes-dataset.com/): 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](https://github.com/mcordts/cityscapesScripts) and use the [conversor](https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/preparation/createTrainIdLabelImgs.py) to generate trainIds from labelIds** | ||
* [**Python 3.6**](https://www.python.org/): If you don't have Python3.6 in your system, I recommend installing it with [Anaconda](https://www.anaconda.com/download/#linux) | ||
* [**PyTorch**](http://pytorch.org/): 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](https://drive.google.com/file/d/1r2eFANvSlcUjxcerjC8l6dRa0slowMpx/view). | ||
|
||
## Anomaly Inference: | ||
* 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. | ||
* **For testing the anomaly segmentation models**: All testing images are provided [here](https://drive.google.com/file/d/1r2eFANvSlcUjxcerjC8l6dRa0slowMpx/view). | ||
|
||
## 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 | ||
|
||
|
||
## Anomaly Inference | ||
To run the anomaly inferences method is possible to use the following command | ||
* Anomaly Inference Command: ```python evalAnomaly.py --input='/content/validation_dataset/RoadAnomaly21/images/*.png'```. Change the dataset path ```'/content/validation_dataset/RoadAnomaly21/images/*.png'``` accordingly. | ||
|
||
## Notebook | ||
The `AML_Project.ipynb` can be opened on Colab to run all the evaluation commands. | ||
|
||
## Authors | ||
|
||
- [Davide Sferrazza s326619](https://github.com/FarInHeight/) | ||
- [Davide Vitabile s330509](https://github.com/Vitabile/) | ||
- [Yonghu Liu s313442](https://github.com/Liu-Yonghu) | ||
|
||
## License | ||
[MIT License](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.