Author 1 - Guru Deep Singh ([email protected])
Author 2 - Nadine Duursman ([email protected])
In this repository we will describe our implementation to reproduce the deep learning model: “W-Net: A Deep Model for Fully Unsupervised Image Segmentation” [1] in Pytorch. We are doing this for a student assignment for the course Deep Learning 2020 – 2021 at Delft University of Technology. W-Net is a deep learning model that is used for unsupervised image segmentation. This is becoming increasingly important because image labelling is time consuming and it is difficult to obtain in novel domains. The W-Net architecture consists of an encoder that outputs the image segmentations, and a decoder that reconstructs the images from these segmentations. We have modified and concatenated three existing Github repositories to do so.
This repository is self-contained.
- Train a W-net model with parameters mentioned in another config file. [Train] [Config]
- Plot the graph for reconstruction and N-cut loss. [Plot-Graph]
- Create Segmentations for the test data. [Test]
- Calculate SC, PRI and VI for the segmentation. [Metric] Some other python scripts to make the approach more modular.
The Repository also provides a pre-trained model which we trained ourselves from scratch and created segmentations of BSDS300 and segmentations of BSDS500.
- Clone the Repository
- Setup the Config file (If you want to try something else)
- Execute train.py
- In test.py select the type of dataset you want to create segmentations for "500" or "300". All the images are already placed in their respective paths. So you do not need to worry about that.
datasets/BSDS500Val/test/images_300 datasets/BSDS500Val/test/images_500
- Run the script.
- Generated Segmentations will be in the following depending on the type you chose
datasets/BSDS500val/test/segmentations_pred_300 datasets/BSDS500val/test/segmentations_pred_500
- Copy paste the generated segmentations to the segs folder.
- Run the test_bench.py
Note- If you want to visualize the predicted segmentation against ground truth. Open the test_bench.py and set "vis" variable as True.