Skip to content

🎓 ML project for EPFL course CS-433 Machine Learning. Comparing ResNet and UNET for a road segmentation task.

Notifications You must be signed in to change notification settings

Minauras/road-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Road segmentation with ML: comparing the performances of ResNet and UNET

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.

Getting Started

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

Prerequisites for ResNet and UNET can be found in the README of their respective folders.

Preparing the dataset

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

Base dataset

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.

Augmented 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.

Segmented 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.

Running nets

Each net has a specific exectuable in their own folder:

Running the best model

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

Authors

Work used for UNET and ResNet specifically can be found in the readme of their respective folders.

About

🎓 ML project for EPFL course CS-433 Machine Learning. Comparing ResNet and UNET for a road segmentation task.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages