Interactive Image Segmentation with Latent Diversity
This is a Tensorflow implementation of Interactive Image Segmentation with Latent Diversity. It receives positive and negative clicks and produces segmentation masks.
Required python libraries: Tensorflow (>=1.3) + OpenCV + Scipy + Numpy.
Tested in Ubuntu 16.04 LTS + Intel i7 CPU + Nvidia Titan X (Pascal) with Cuda (>=8.0) and CuDNN (>=6.0).
- Clone this repository.
- Download the pre-trained model from this link. Unzip it and put them into the "Models" folder.
- Run "IntSeg_GUI.py", and a window will show up.
- Open an image (one sample image is provided in "imgs"); the image will show on the up-left.
- Use the mouse to input positive (left) and/or negative (right) clicks.
The segmentation mask will show on the bottom-left, and the overlying image will show on the up-right. The bottom-right window can be ignored at this moment. The click inputs and segmentation results will be saved in the "res" folder under a random user id specified folder.
Note that the GUI is designed for demonstration only, and thus it is not optimized for images with arbitrary resolution.
The MATLAB script "genIntSegPairs.m" is provided for automatically generating positive/negative clicks. Note that the synthesizing strategies follow "Deep interactive object selection" (arxiv link).
With the generated positive/negative clicks, run "IntSeg_Train.py" to start training after the "im_path" and "seg_path" are properly set.
The current implementation processes the SBD dataset (link), and it can be modified to process any dataset with image and intance mask pairs.
If you use our code for research, please cite our paper:
Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Interactive Image Segmentation with Latent Diversity. In CVPR 2018.
If you have any question or request about the code and data, please email me at email@example.com.