Home

Awesome

Image Segmentation and Object Detection in Pytorch

Pytorch-Segmentation-Detection is a library for image segmentation and object detection with reported results achieved on common image segmentation/object detection datasets, pretrained models and scripts to reproduce them.

Segmentation

PASCAL VOC 2012

Implemented models were tested on Restricted PASCAL VOC 2012 Validation dataset (RV-VOC12) or Full PASCAL VOC 2012 Validation dataset (VOC-2012) and trained on the PASCAL VOC 2012 Training data and additional Berkeley segmentation data for PASCAL VOC 12.

You can find all the scripts that were used for training and evaluation here.

This code has been used to train networks with this performance:

ModelTest dataMean IOUMean pix. accuracyPixel accuracyInference time (512x512 px. image)Model Download LinkRelated paper
Resnet-18-8sRV-VOC1259.0in prog.in prog.28 ms.DropboxDeepLab
Resnet-34-8sRV-VOC1268.0in prog.in prog.50 ms.DropboxDeepLab
Resnet-50-16sVOC1266.5in prog.in prog.in prog.in prog.DeepLab
Resnet-50-8sVOC1267.0in prog.in prog.in prog.in prog.DeepLab
Resnet-50-8s-deep-supVOC1267.1in prog.in prog.in prog.in prog.DeepLab
Resnet-101-16sVOC1268.6in prog.in prog.in prog.in prog.DeepLab
PSP-Resnet-18-8sVOC1268.3n/an/an/ain prog.PSPnet
PSP-Resnet-50-8sVOC1273.6n/an/an/ain prog.PSPnet

Some qualitative results:

Alt text

Endovis 2017

Implemented models were trained on Endovis 2017 segmentation dataset and the sequence number 3 was used for validation and was not included in training dataset.

The code to acquire the training and validating the model is also provided in the library.

Additional Qualitative results can be found on this youtube playlist.

Binary Segmentation

ModelTest dataMean IOUMean pix. accuracyPixel accuracyInference time (512x512 px. image)Model Download Link
Resnet-9-8sSeq # 3 *96.1in prog.in prog.13.3 ms.Dropbox
Resnet-18-8sSeq # 396.0in prog.in prog.28 ms.Dropbox
Resnet-34-8sSeq # 3in prog.in prog.in prog.50 ms.in prog.

Resnet-9-8s network was tested on the 0.5 reduced resoulution (512 x 640).

Qualitative results (on validation sequence):

Alt text

Multi-class Segmentation

ModelTest dataMean IOUMean pix. accuracyPixel accuracyInference time (512x512 px. image)Model Download Link
Resnet-18-8sSeq # 381.0in prog.in prog.28 ms.Dropbox
Resnet-34-8sSeq # 3in prog.in prog.in prog.50 ms.in prog

Qualitative results (on validation sequence):

Alt text

Cityscapes

The dataset contains video sequences recorded in street scenes from 50 different cities, with high quality pixel-level annotations of 5 000 frames. The annotations contain 19 classes which represent cars, road, traffic signs and so on.

ModelTest dataMean IOUMean pix. accuracyPixel accuracyInference time (512x512 px. image)Model Download Link
Resnet-18-32sValidation set61.0in prog.in prog.in prog.in prog.
Resnet-18-8sValidation set60.0in prog.in prog.28 ms.Dropbox
Resnet-34-8sValidation set69.1in prog.in prog.50 ms.Dropbox
Resnet-50-16s-PSPValidation set71.2in prog.in prog.in prog.in prog.

Qualitative results (on validation sequence):

Whole sequence can be viewed here.

Alt text

Installation

This code requires:

  1. Pytorch.

  2. Some libraries which can be acquired by installing Anaconda package.

    Or you can install scikit-image, matplotlib, numpy using pip.

  3. Clone the library:

git clone --recursive https://github.com/warmspringwinds/pytorch-segmentation-detection

And use this code snippet before you start to use the library:

import sys
# update with your path
# All the jupyter notebooks in the repository already have this
sys.path.append("/your/path/pytorch-segmentation-detection/")
sys.path.insert(0, '/your/path/pytorch-segmentation-detection/vision/')

Here we use our pytorch/vision fork, which might be merged and futher merged in a future. We have added it as a submodule to our repository.

  1. Download segmentation or detection models that you want to use manually (links can be found below).

About

If you used the code for your research, please, cite the paper:

@article{pakhomov2017deep,
  title={Deep Residual Learning for Instrument Segmentation in Robotic Surgery},
  author={Pakhomov, Daniil and Premachandran, Vittal and Allan, Max and Azizian, Mahdi and Navab, Nassir},
  journal={arXiv preprint arXiv:1703.08580},
  year={2017}
}

During implementation, some preliminary experiments and notes were reported: