Learning Saliency Propagation for Semi-supervised Instance Segmentation

Overview

Learning Saliency Propagation for Semi-supervised Instance Segmentation

illustration

PyTorch Implementation

This repository contains:

  • the PyTorch implementation of ShapeProp.
  • the Classwise semi-supervision (COCO's VOC->Non-VOC) demo.

Please follow the instruction below to install it and run the experiment demo.

Prerequisites

  • Linux (tested on ubuntu 16.04LTS)
  • NVIDIA GPU + CUDA CuDNN (tested on 8x GTX 2080 Ti)
  • COCO 2017 Dataset (download and unzip)
  • Please use PyTorch1.1 + Apex(#1564802) to avoid compilation errors

Getting started

  1. Create a conda environment:

    conda create --name ShapeProp -y
    conda activate ShapeProp
  2. Clone this repo:

    # git version must be greater than 1.9.10
    git clone https://github.com/ucbdrive/ShapeProp.git
    cd ShapeProp
    export DIR=$(pwd)
  3. Install dependencies via a single command bash $DIR/scripts/install.sh or do it manually as follows:

    # Python
    conda install -y ipython pip
    # PyTorch
    conda install -y pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
    # Install deps
    pip install ninja yacs cython matplotlib tqdm opencv-python
    rm -r libs
    mkdir libs
    # COCOAPI
    cd $DIR/libs
    git clone https://github.com/cocodataset/cocoapi.git
    cd cocoapi/PythonAPI
    python setup.py build_ext install
    # APEX
    cd $DIR/libs
    git clone https://github.com/NVIDIA/apex.git
    cd apex
    python setup.py install --cuda_ext --cpp_ext
    # ShapeProp
    cd $DIR
    python setup.py build develop
    
  4. Prepare dataset:

    cd $DIR
    mkdir datasets
    ln -s PATH_TO_YOUR_COCO_DATASET datasets/coco
    bash scripts/prepare_data.sh
  5. Run the classwise semi-supervision demo:

    cd $DIR
    # Mask R-CNN w/ ShapeProp
    bash scripts/train_shapeprop.sh
    # Mask R-CNN
    bash scripts/train_baseline.sh

Citation

If you use the code in your research, please cite:

@INPROCEEDINGS{Zhou2020ShapeProp,
    author = {Zhou, Yanzhao and Wang, Xin and and Jiao, Jianbin and Darrell, Trevor and Yu, Fisher},
    title = {Learning Saliency Propagation for Semi-supervised Instance Segmentation},
    booktitle = {CVPR},
    year = {2020}
}
You might also like...
 QueryInst: Parallelly Supervised Mask Query for Instance Segmentation
QueryInst: Parallelly Supervised Mask Query for Instance Segmentation

QueryInst is a simple and effective query based instance segmentation method driven by parallel supervision on dynamic mask heads, which outperforms previous arts in terms of both accuracy and speed.

Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CVPR 2021)
Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CVPR 2021)

Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CAC) Xin Lai*, Zhuotao Tian*, Li Jiang, Shu Liu, Hengshuang Zhao, Li

[CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
[CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision

TorchSemiSeg [CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision by Xiaokang Chen1, Yuhui Yuan2, Gang Zeng1, Jingdong Wang

ST++: Make Self-training Work Better for Semi-supervised Semantic Segmentation

ST++ This is the official PyTorch implementation of our paper: ST++: Make Self-training Work Better for Semi-supervised Semantic Segmentation. Lihe Ya

DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision
DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision

The Official PyTorch Implementation of DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision

[ICCV 2021] A Simple Baseline for Semi-supervised Semantic Segmentation with Strong Data Augmentation

[ICCV 2021] A Simple Baseline for Semi-supervised Semantic Segmentation with Strong Data Augmentation

The PyTorch implementation of DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision.
The PyTorch implementation of DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision.

DiscoBox: Weakly Supervised Instance Segmentation and Semantic Correspondence from Box Supervision The PyTorch implementation of DiscoBox: Weakly Supe

[CVPR 2022] Semi-Supervised Semantic Segmentation Using Unreliable Pseudo-Labels
[CVPR 2022] Semi-Supervised Semantic Segmentation Using Unreliable Pseudo-Labels

Using Unreliable Pseudo Labels Official PyTorch implementation of Semi-Supervised Semantic Segmentation Using Unreliable Pseudo Labels, CVPR 2022. Ple

[cvpr22] Perturbed and Strict Mean Teachers for Semi-supervised Semantic Segmentation
[cvpr22] Perturbed and Strict Mean Teachers for Semi-supervised Semantic Segmentation

PS-MT [cvpr22] Perturbed and Strict Mean Teachers for Semi-supervised Semantic Segmentation by Yuyuan Liu, Yu Tian, Yuanhong Chen, Fengbei Liu, Vasile

Comments
  • Generalization with less data experiment

    Generalization with less data experiment

    Hi,

    first of all, really nice work! I very much enjoyed reading it.

    I'm working on a similar topic and wonder if you also uploaded the code for your experiment "Generalization with less data", shown in figure 6 of your work. I looked through your code but could not find it ad-hoc.

    Best, David,

    opened by dbtmpl 1
  • compilation error and solution

    compilation error and solution

    I encounter the compilation error with the computer configuration: cuda 10.0, pytorch1.1, python 3.7. I do not know the meaning of Apex(#1564802), but i have solved my problem with this method: https://github.com/NVIDIA/apex/issues/802#issuecomment-618699214

    opened by XueZ-phd 0
  • RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' in call to _th_and

    RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' in call to _th_and

    I run the classwise semi-supervision demo guided by the readme, I have only one GPU so run the command as: python shapeprop/tools/train_net.py --config-file configs/coco_voc_mask_rcnn_r50_fpn_1x.yml and error occurs when executing:

    File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 192, in main() File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 185, in main model = train(cfg, args.local_rank, args.distributed) File "/home/pzs/pzs/ShapeProp/shapeprop/tools/train_net.py", line 85, in train arguments, File "/home/pzs/pzs/ShapeProp/shapeprop/engine/trainer.py", line 69, in do_train loss_dict = model(images, targets) File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/detector/generalized_rcnn.py", line 56, in forward x, result, detector_losses = self.roi_heads(features, proposals, targets) File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/roi_heads.py", line 42, in forward x, detections, loss_mask = self.mask(mask_features, detections, targets) File "/home/pzs/.pyenv/versions/3.7.8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/mask_head.py", line 77, in forward loss_mask = self.loss_evaluator(proposals, mask_logits, targets) File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/loss.py", line 119, in call labels, mask_targets, valid_inds = self.prepare_targets(proposals, targets) File "/home/pzs/pzs/ShapeProp/shapeprop/modeling/roi_heads/mask_head/loss.py", line 91, in prepare_targets valid_masks = (labels_per_image > 0) & matched_targets.get_field("valid_masks").to(dtype=torch.uint8) RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' in call to _th_and

    I think my coco datasets should be configured properly. Ubuntu 20.04 CUDA 10.0(Nvidia 2080Ti) PyTorch 1.4.0+cu100 Python 3.7.8

    opened by pzs7602 0
Owner
Berkeley DeepDrive
Berkeley DeepDrive
Leveraging Instance-, Image- and Dataset-Level Information for Weakly Supervised Instance Segmentation

Leveraging Instance-, Image- and Dataset-Level Information for Weakly Supervised Instance Segmentation This paper has been accepted and early accessed

Yun Liu 39 Sep 20, 2022
This is the official implementation of the paper "Object Propagation via Inter-Frame Attentions for Temporally Stable Video Instance Segmentation".

[CVPRW 2021] - Object Propagation via Inter-Frame Attentions for Temporally Stable Video Instance Segmentation

Anirudh S Chakravarthy 6 May 3, 2022
Project looking into use of autoencoder for semi-supervised learning and comparing data requirements compared to supervised learning.

Project looking into use of autoencoder for semi-supervised learning and comparing data requirements compared to supervised learning.

Tom-R.T.Kvalvaag 2 Dec 17, 2021
UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning

UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning This is the official PyTorch implementation for UniMoCo pape

dddzg 49 Jan 2, 2023
Semi Supervised Learning for Medical Image Segmentation, a collection of literature reviews and code implementations.

Semi-supervised-learning-for-medical-image-segmentation. Recently, semi-supervised image segmentation has become a hot topic in medical image computin

Healthcare Intelligence Laboratory 1.3k Jan 3, 2023
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Task-related Saliency Network For Few-shot learning

Task-related Saliency Network For Few-shot learning This is an official implementation in Tensorflow of TRSN. Abstract An essential cue of human wisdo

null 1 Nov 18, 2021
Shape-aware Semi-supervised 3D Semantic Segmentation for Medical Images

SASSnet Code for paper: Shape-aware Semi-supervised 3D Semantic Segmentation for Medical Images(MICCAI 2020) Our code is origin from UA-MT You can fin

klein 125 Jan 3, 2023
Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CVPR 2021)

Semi-supervised Semantic Segmentation with Directional Context-aware Consistency (CAC) Xin Lai*, Zhuotao Tian*, Li Jiang, Shu Liu, Hengshuang Zhao, Li

Jia Research Lab 137 Dec 14, 2022
Anti-Adversarially Manipulated Attributions for Weakly and Semi-Supervised Semantic Segmentation (CVPR 2021)

Anti-Adversarially Manipulated Attributions for Weakly and Semi-Supervised Semantic Segmentation Input Image Initial CAM Successive Maps with adversar

Jungbeom Lee 110 Dec 7, 2022