Skip to content

Unofficial python implementation of the paper "Lazy Random Walks for Superpixel Segmentation"

Notifications You must be signed in to change notification settings

ishaanshah/lrw_superpixel

Repository files navigation

Lazy Random Walks for Superpixel Segmentation

made-with-python Code style: black

Table of contents

This repository contains a python implementation of the paper Lazy Random Walks for Superpixel Segmentation. The repository provides a minimal GUI built using the Tkinter library. The GUI exposes various parameters which can be used to tweak the quality of the results obtained. A brief overview of all the parameters and their usage has been given below. For more details about them please refer to the original paper.

Iterative process of LRW followed by energy optimisation
Iterative process of LRW followed by energy optimisation

Parameters

  • Seed Count: The seed count refers to the total number of superpixels we want to have in the final image.

  • Beta: Beta is the Gaussian parameter. It dictates how much the intensity difference between neighbouring pixels affects the result.

  • Lazy Parameter: Lazy parameter is the probability with which the random walk algorithm leaves the node it currently is on. That is it stays on the same node with probability equation where equation is the lazy parameter.

  • Threshold: Threshold is the value of area after which a split in a superpixel will happen. The area function used in the paper is the Local Binary Pattern function which effectively measures the texture content of a region.

  • Max Iterations: Max iterations refer to the maximum number of times the LRW and area optimisation algorithm will be run.

GUI GUI
Screenshots of the GUI

Results

We ran our algorithm on the Berkely Segmentation Dataset (BSDS300) and have provided the results in a OneDrive folder. We also performed qualitative and quantitative comparisons of our algorithm with several other well known algorithms such as Random Walk, Compact Watershed and SLIC.

GUI
Qualitative comparison of various algorithms

Installation

To run the GUI, first install the python dependencies defined in requirements.txt using:

pip install -r requirements.txt

Alternatively if you use NixOS or the Nix package manager you can easily enter a shell provisioned with the needed dependencies using:

nix-shell

Once the dependencies have been installed you can run the GUI using:

python main.py

Repository Structure

.
├── benchmark.ipynb     (Notebook containing benchmarks and comparisons with other algorithms)
├── experiments.ipynb   (Notebook containing experiments performed on hyperparameters)
├── images              (Directory containing all the images used)
├── main.py             (Entrypoint for the GUI)
├── media               (Media files neeeded for the repository and presentation)
├── README.md
├── requirements.txt    (PyPi Dependancies)
├── shell.nix           (Nix Dependancies)
└── src
    ├── dataset_test.py (Code for testing on BSDS300)
    ├── lrw.py          (Code containing the main algorithm)
    └── utils.py        (Commonly needed utility functions)

About

Unofficial python implementation of the paper "Lazy Random Walks for Superpixel Segmentation"

Topics

Resources

Stars

Watchers

Forks

Languages