Giter Site home page Giter Site logo

cs-433-project-2-road_king's Introduction

Road Segmentation with U-Net

AIcrowd username: dongxu AIcrowd submission ID: 108563 (F1=0.875)

Team Members: Dongxu Guo, Jiaan Zhu, Lei Wang

This GitHub page hosts the code for Project 2 of Machine Learnin(CS-433). In this project we implement and train neural network for road segmentation, i.e. assigning labels road=1, background=0 to each pixel in satilite images. The model is based on U-Net from Ronneberger et al. (2015).

The train and test data contains 100 and 50 images of size 400x400 and 604x604 respectively. Please kindly download the images from the official site on AiCrowd.

Environment and Dependencies

The setup requires a default Unix Environment. The interface is written and tested using python 3.8. The interface also requires the following external libraries:

  • PyTorch(v1.7)
  • scikit-learn
  • scikit-image

Training and Prediction

To generate our final AICrowd submission of F1-score 0.875, please download our pretrained model link. Unzip and place the state dictionary (weights) in /pretrained folder. Then execute run.py, you will get the submission.csv under the /submission folder and prediction in /pred folder. In some systems you may need to modify the system path.

You can always retrain our model by running:

python3 train.py

with the appropriate optional arguments, if needed.

The optional arguments can be used to:

  • specify the train/validation split ratio
  • change the hyper-parameters
  • modify the model architecture
  • specify the model save path and saving conditions

The defualt setting is what gives us the best performed model. Howerver, since we use random data augmentation and do not set the seed, the exact reproducibility of our result is not ensured.

If TensorBoard is installed, metrics (training losses and validation score) can be tracked and visualized. To launch Tensorboard, run:

tensorboard --logdir=path/to/logdir

Modules

All modules are provided in src. Addionally we provide a small ipynb script to give a a glance about our segmentation results.

run.py

Script to generate the same submission file as we submitted in AICrowd with pretrained models.

train.py

Main script to retrain models with your customized settings.

UNet.py

Implementation of the modified U-Net model(with optional dropout and batch-normalization).

loader.py

Dataloader for loading training and testing data.

training.py

Fucnctions for training, validaing, saving and loading models.

dice.py

Define Dice coefficient, the metric we use for validation.

rotate.py

Functions for random rotations in data augmentation

mask_to_submission.py

Helper functions for generating AICrowd submission file.

License

The project is licensed under the MIT License.

cs-433-project-2-road_king's People

Contributors

dongxuguo avatar dongxuguo1997 avatar jiaanzhu avatar

Stargazers

Yujie He avatar

Watchers

James Cloos avatar Matteo Pagliardini avatar gortizji avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.