Code Monkey home page Code Monkey logo

homework3_ele2765's Introduction

Homework 3 ELE2765

Homework 3 of Deep Learning class on Electrical Engineering Master's at PUC-Rio

Introduction

This Project has the objective of learning how a semantic segmentation network works, implementing more specifically U-Net, in a remote sensing dataset. As long as the dataset has a huge imabalance problem we used weighted cross entropy loss, which is also implemented in tensorflow 2.x (keras), to handle class imbalance problem. The idea of the project is to compare the results among different trails of the same dataset extracted with different patch sizes, since remote sensing images have a quite big resolution and see how the patch size affects the performance of the network.

The number of pixels by class can be seen on the image below, to show clearly the imabalance problem:

Number of pixels by class

The weights calculation of each class for the loss function can be seen below:

Class weights for loss function

If this weight calculation doesn't fit for you, you can try a normalized version (the sum of all classes are equal to 1).

Training

inside the notebook train_model.ipynb you have all the necessary scripts to train U-Net, including U-Net architecture implementation, patches extraction, weighted cross entropy custom loss and more.

I used a stride with half the size of patch size, to enhance the the size of training data, since I had only one image to train. Also, if you have a powerful GPU, use a bigger patch size.

The model hyperparameters of the three trials, can be seen below:

Number of pixels by class

If you want to reproduce results the dataset is in this drive: https://drive.google.com/drive/folders/17sy0-ljxP9xQH8ANvjsZTru8aCOxZz4x?usp=sharing

Testing

On testing notebook Test_model.ipynb you have all the preprocess scripts and also prediction patches reconstruction and patches visualization code.

Results

Model histories

We can see an intresting observation in model training histories. As long as we reduce the patch size more noisy is the training:

Model 1 history

Model 2 history

Model 3 history

Model metrics

Also, looking into the metrics we can see model 1, with the greater patch size, is the best model.

Model 1 metrics

Model 2 metrics

Model 3 metrics

Predictions reconstruction

reference test image

Test reference

Model 1 pred reconstruction

Model 1 prediction reconstruction

Model 2 pred reconstruction

Model 2 prediction reconstruction

Model 3 pred reconstruction

Model 3 prediction reconstruction

homework3_ele2765's People

Contributors

thimabru1010 avatar

Watchers

 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.