The overall goal of this project is perform an image segmentation on aerial/satellite image to find the roads.
This project aims to develop a machine learning model to predict the likelihood of a pixel in an image to be a road or not. Based on that prediction we will attribute a label to each pixel of a satellite image. With road beeing set to white and non-road set to black (road=1, background=0).
Example :

You may want to run the code with UNet_pred.ipynb.
-
Clone the repository
Open your terminal and run the following command to clone this repository:cd YOUR_CLONING_DIRECTORY git clone https://github.com/CS-433/ml-project-2-notaname_p2 cd ml-project-2-notaname_p2
-
Get the environment and activate it
conda env create -f environment.yml conda activate ML_project2
-
Get pretrained Models
You will need to redownload the UNet_model.pth and RC_params_opti.pth files and place them in the project folder. If you don't you might enconter an error stating the files are corrupted. By using a pretrained model the prediction time would be around 10 minutes, if you want to train the model your self it might take several hours.
-
Get the best prediction
open UNet_pred.ipynb on any editor, selected the ML_project2 enviromnent and run all cells
To get best prediction that we obtained, run UNet_pred.ipynb with all parameters set to False (already done by default).
If you want to predict best parameters (best number of layers/bases,...), set UNET_SEARCH to True.
If you want in addition to save them, set both SAVE_UNET and UNET_TRAIN to True. For the hyperparameter search for postprocessing part, set ROAD_CORRECTION_SEARCH to True (to save them set SAVE_RC_PARAMS to True).
The last parameter THRESHOLD_SEARCH is for searching optimal threshold to minimize F1 loss.