This project was made for the Machine Learning course at EPFL (CS-433). We will do road segmentation on a dataset provided by the teachers of the course, and comparing the performances on two nets, and three processings of the original dataset.
Clone this repository to your machine to run. You will find instructions on how to use ResNet and UNET in the README of their respective folders.
The dataset can be downloaded here. Several processing techniques are proposed and required below.
Prerequisites for ResNet and UNET can be found in the README of their respective folders.
Both ResNet and UNET only take 256x256 images as input, while our dataset has 400x400 and 608x608 images. We provide cropping and uncropping functions in the file cropping.py.
We trained the nets on three processings of this cropped dataset:
- Base dataset: the original cropped dataset
- Augmented dataset: the original dataset, augmented with rotations and flipping of each image of the original dataset, generated by augmentation.py
- Segmented dataset: in order to have inputs closer to the output, we segmented the original dataset using thresholding. This dataset is generated by segmentation.py
Download the dataset, put it in the folder dataset and run:
python cropping.py
This will crop the dataset and put it in the corresponding the folders of each net, so that they can be run on this dataset.
Download the dataset, put it in the folder dataset and run:
python augmentation.py
This will generate the cropped and augmented dataset and put it in the corresponding the folders of each net, so that they can be run on this dataset.
Download the dataset, put it in the folder dataset and run:
python segmentation.py
This will generate the cropped and segmented dataset and put it in the corresponding the folders of each net, so that they can be run on this dataset.
Each net has a specific exectuable in their own folder:
- ResNet/run_resnet.py for ResNet
- UNET/unet_run.py for unet
The global executable run.py will generate the test outputs for the best results we could get through all of our tests of the two nets. It requires that the model's pth file be downloaded (as it was too big for the submission). Please download the pth file from here and place it in
ResNet/results/best_model.pth
You can then run
python run.py
To get our best results
Work used for UNET and ResNet specifically can be found in the readme of their respective folders.