Giter Site home page Giter Site logo

unet's Introduction

What this Repo is about

Semantic Segmentation is done by assigning each pixel in the image a class. This is a key problem in th field of computer vision. In this repo, we would look at using UNet to do this:

learning

How to set up

what you need

Anaconda (download from here)

steps

  1. Clone the Repo
  2. open a terminal (bash)

In bash type the following

cd UNet
conda env create -f=environment.yml # this would download the necessary python packages from anaconda cloud
conda activate my_unet
cd data
tar -xvzf iccv09Data.tar.gz
mv iccv09Data raw # renames folder to raw for data integrity
cd ..
python src/processing.py
python src/train_unet.py

To Launch Jupyter notebook

type the following in your bash

jupyter notebook

Test data

After running src/train_unet.py, you should have some weights. You can run the follwing step to see your results.

python src/load_weights_and_test.py -w <PATH OF TRAINED MODEL>

Data

The data is taken from ICCV09 [1] which contains 715 images sourced from LabelMe, MSRC, PASCAL VOC, and Geometric Context. Labels were obtained using Amazon's Mechanical Turk (AMT). Data can be downloaded from here

The labels are:

  • horizons.txt : image dimensions and location of horizon
  • labels/*.regions.txt : integer matrix indicating each pixel's semantic class (sky, tree, road, grass, water, building, mountain, or foreground object). A negative number indicates unknown.
  • labels/*.surfaces.txt : integer matrix indicating each pixel's geometric class (sky, horizontal, or vertical).
  • labels/*.layers.txt : integer matrix indicating distinct image regions.

What is UNet?

UNet[2] is Convolutional Neural Network (CNN) which builds on the well known FCN[3]. Compared to the traditional sliding window approach, which won the Electron Microscopy Segmentation challenge at ISBI 2012, the FCN pose a more elegant architecture which reduces redundant overlapping patches its predecessor had.

The Unet consists of 23 convolutional layers with one contraction and one, more or less symmetric, expansion path. A concatenation of high resolution features from the contracting path to the unsampled features from the expanding path allows for localization.

The UNet architecture can be seen below

UNet

Training

In this repo, we would be using a small version of UNet and train it over 50 epoch. The accuracy_loss_plot is shown below

Accuracy plot

Accuracy plot

Loss plot

Loss plot

Reference

[1] Decomposing a Scene into Geometric and Semantically Consistent Regions, Stephen Gould, Richard Fulton, Daphne Koller, ICCV 2009

[2] U-Net: Convolutional Networks for Biomedical Image Segmentation. Olaf Ronneberger, Philipp Fischer, Thomas Brox

[3] Fully Convolutional Networks for Semantic Segmentation. Jonathan Long, Evan Shelhamer, Trevor Darrell. UN Berkeley

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.