This project aims to classify roads on satellite images from Google Maps in suburban areas of the USA. We use a U-Net model to perform road segmentation, assigning each pixel a label: road=1 or background=0.
The dataset is sourced from the AIcrowd EPFL ML Road Segmentation challenge.
The results obtained on the test set can be visualized here
The key steps in the project include:
- Data Augmentation: Expanding the training set with rotated and cropped patches of size 256x256, followed by color adjustments.
- Model Training: Training a U-Net model with the augmented dataset.
- Prediction: Generating prediction masks for test images.
- Visualization: Overlaying test images with predicted road masks for evaluation.
- Submission: Generating a CSV file from prediction masks for submission.
git clone https://github.com/CS-433/ml-project-2-monkeylearning.git
cd ml-project-2-monkeylearningSet up a virtual environment and install the required dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtExecute the run.py script to perform the full pipeline of the best model:
python3 run.pyusage: python3 run.py [--prediction | -p] [--custom_prediction | -cp] [--show_train_graph | -stg] [--help]
Performs data augmentation, training and prediction
options:
-h, --help show this help message and exit
--prediction, -p prediction only
--custom_prediction, -cp
prediction only (use the custom test set)
--show_train_graph, -stg
displays the train history graph after training
-
data/
Contains the training set, test set, augmented images, and prediction masks. -
saved_models/
Directory for storing the trained U-Net model (unet.keras). -
requirements.txt
Defines all of the requirements to run the code. -
config.py
Defines all of the constants used. -
data_augmentation.py
Expands the training dataset with rotations, cropping, and color adjustments. -
model.py
Defines a 5-layer U-Net model and outputsunet.keras. -
training.py
Trains the U-Net model using augmented data. -
prediction.py
Creates prediction masks for the test set. -
viewer.py
Displays test images overlaid with prediction masks. -
mask_to_submissions.py
Converts prediction masks to asubmission.csvfile. -
run.py
Executes the entire pipeline, including training and predictions. -
report.pdf
Documents findings and project analysis.