Giter Site home page Giter Site logo

giacomopiccinini / unsupervisedimagesegmentation Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 45 KB

Unsupervised Image Segmentation using PyTorch

Python 100.00%
deep-learning image-segmentation pytorch segmentation unsupervised unsupervised-segmentation

unsupervisedimagesegmentation's Introduction

Unsupervised Image Segmentation

In this repository I re-implement from scratches the code for unsupervised image segmentation described in the paper

Wonjik Kim*, Asako Kanezaki*, and Masayuki Tanaka. Unsupervised Learning of Image Segmentation Based on Differentiable Feature Clustering. IEEE Transactions on Image Processing, accepted, 2020. (arXiv)

or in the GitHub repository.

Novel Contributions

Besides re-organising the entire process, I have added (and will keep adding with time) a number of features.

  • It is now possible to train on multiple images, and not just one. This might make sense if we have multiple very similar images (or for any other application you might see suited).
  • I have generalised the loss function: in addition to the continuity and similarity loss functions presented in the paper, I have added a contribution coming from very big and very small areas. This is to ensure that creation of too wide or too narrow segmentation is disfavoured.
  • Each component of the loss function is weighted by a parameter that can be set through the parser.

Run

To get started, place a (possibly small) colour image inside the input directory. Then, run the script with

python main.py <FILENAME>

Options

There are various options available:

  • --path <path>: pass the input directory images should be read from. Default is Input;
  • --n_channels <3 or 1>: number of channels (colours) of input images;
  • --n_features <integer>: dimension of latent space after CNN;
  • --n_classes <integer>: number of classes (distinct regions) the image is initially segmented with;
  • --min_classes <integer>: minimum number of classes (distinct regions) the image can be segmented into;
  • --n_convolutions <integer>: number of convolutional steps to be applied to the image;
  • --batch_size <integer>: batch size;
  • --learning_rate <float>: learning rate for the SGD optimizer;
  • --momentum <float>: momentum for the SGD optimizer;
  • --epochs <integer>: epochs for training;
  • --mu <float>: float for weight of similarity loss function;
  • --nu <float>: float for weight of continuity loss function (overall);
  • --nu_x <float>: float for weight of continuity loss function along x;
  • --nu_y <float>: float for weight of continuity loss function along y;
  • --M <float>: float for weight of max area loss function;
  • --m <float>: float for weight of min area loss function;
  • --model_path <path>: path for saved model;
  • --show: show the results of segmentation as the training runs.

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.