Code Monkey home page Code Monkey logo

unsupervised-image-segmentation-by-wnet-with-normalizedcut's Introduction

Unsupervised-image-segmentation-by-WNet-with-NormalizedCut

A tensorflow implementation of WNet for unsupervised image segmentation on PASCAL VOC2012 dataset

This code is revised from FCN code by shekkizh

WNet

image

(Figure from the original WNet paper)

Two Unets are stacked as autoencoder to generate sementic segmentation of images.

An additional soft normalized cut term serve as a criterion to improve segmentation,

For details of normalized cut, please refer to the original paper

In short, normalized cut measure how good the segmentation is, the procedures are as follow:

(1) For a image, we calculate weight connections between any two pixels in image by their

(a) Distance of brightness between pixels i.e. (R+G+B)/3.

(b) Distances of position between pixels.
For pixels with strong connection, they are more likely belong to the same class.

(2) The association and disassociation is then calculated by weight connection:

(a) association: sum(weight_connection) within the class.

(b) disassociation: sum(weight_connection) between the class.

(c) normalized cut = disassociation / association

Run program

(1) The code was tested with tensorflow1.9, python3.6 and a GTX1080 graphic cards. 

(2) Train / visualize network
    cd to "unsupervised-image-segmentation-by-WNet-with-NormalizedCut"
    (a) Run "python src/WNet_naive.py" for segmentation without normalized cut.
    (b) Run "python src/WNet_bright.py" for segmentation with normalized cut.
    
    There are few arguments:
        --mode: [train/visualize/test] 
            train; 
            visualize: randomly select image from dataset and predict segmentation;
            test: load images in test_dir(by default is './data/test') and predict segmentation.
                  test_dir can be also specified by --test_dir.
        --logs_dir: specify the directroy to restore / save.
        --num_layers: specify the number of modules for UNet.
                    (for figure above, the #modules is 9.)
        --debug: [True/False] Print extra details (activations, gradients, ...) for debug.

Results

Unsupervised image segmentation is perform with and without soft normalized cut.

(1) A 5 modules WNet tested in this work. (2) The image from VOC2012 is resize to 128 * 128 pixels for limitation of memories. (3) The Wnet is first train with dropout rate 0.65 for 50000 iterations, then retrain with 0.3 for another 50000 iterations. (5) Learning rate is reduced by half every 10000 iterations.

(1) WNet naive (without soft normalized cut)

Training process

(for simplicity, we show only the fisrt training process.) image

Segmentation

image

(2) WNet bright

Training process

(for simplicity, we show only the fisrt training process.) image

Segmentation

image

unsupervised-image-segmentation-by-wnet-with-normalizedcut's People

Contributors

lwchen6309 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.