• Stars
    star
    173
  • Rank 219,021 (Top 5 %)
  • Language
    Python
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[ICIP 2021] Puzzle-CAM: Improved localization via matching partial and full features.

PWC PWC

Puzzle-CAM

The official implementation of "Puzzle-CAM: Improved localization via matching partial and full features".

Citation

  • Accepted to ICIP 2021
  • Please cite our paper if the code is helpful to your research. arxiv
@inproceedings{jo2021puzzle,
  title={Puzzle-CAM: Improved localization via matching partial and full features},
  author={Jo, Sanghyun and Yu, In-Jae},
  booktitle={2021 IEEE International Conference on Image Processing (ICIP)},
  pages={639--643},
  year={2021},
  organization={IEEE}
}

Abstract

Weakly-supervised semantic segmentation (WSSS) is introduced to narrow the gap for semantic segmentation performance from pixel-level supervision to image-level supervision. Most advanced approaches are based on class activation maps (CAMs) to generate pseudo-labels to train the segmentation network. The main limitation of WSSS is that the process of generating pseudo-labels from CAMs which use an image classifier is mainly focused on the most discriminative parts of the objects. To address this issue, we propose Puzzle-CAM, a process minimizes the differences between the features from separate patches and the whole image. Our method consists of a puzzle module (PM) and two regularization terms to discover the most integrated region of in an object. Without requiring extra parameters, Puzzle-CAM can activate the overall region of an object using image-level supervision. In experiments, Puzzle-CAM outperformed previous state-of-the-art methods using the same labels for supervision on the PASCAL VOC 2012 test dataset.

Overview

Overall architecture


Prerequisite

  • Python 3.8, PyTorch 1.7.0, and more in requirements.txt
  • CUDA 10.1, cuDNN 7.6.5
  • 4 x Titan RTX GPUs

Usage

Install python dependencies

python3 -m pip install -r requirements.txt

Download PASCAL VOC 2012 devkit

Follow instructions in http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit

1. Train an image classifier for generating CAMs

CUDA_VISIBLE_DEVICES=0,1,2,3 python3 train_classification_with_puzzle.py --architecture resnest101 --re_loss_option masking --re_loss L1_Loss --alpha_schedule 0.50 --alpha 4.00 --tag ResNeSt101@Puzzle@optimal --data_dir $your_dir

2. Apply Random Walk (RW) to refine the generated CAMs

2.1. Make affinity labels to train AffinityNet.

CUDA_VISIBLE_DEVICES=0 python3 inference_classification.py --architecture resnest101 --tag ResNeSt101@Puzzle@optimal --domain train_aug --data_dir $your_dir
python3 make_affinity_labels.py --experiment_name ResNeSt101@Puzzle@optimal@train@scale=0.5,1.0,1.5,2.0 --domain train_aug --fg_threshold 0.40 --bg_threshold 0.10 --data_dir $your_dir

2.2. Train AffinityNet.

CUDA_VISIBLE_DEVICES=0 python3 train_affinitynet.py --architecture resnest101 --tag AffinityNet@ResNeSt-101@Puzzle --label_name ResNeSt101@Puzzle@optimal@train@scale=0.5,1.0,1.5,2.0@aff_fg=0.40_bg=0.10 --data_dir $your_dir

3. Train the segmentation model using the pseudo-labels

3.1. Make segmentation labels to train segmentation model.

CUDA_VISIBLE_DEVICES=0 python3 inference_rw.py --architecture resnest101 --model_name AffinityNet@ResNeSt-101@Puzzle --cam_dir ResNeSt101@Puzzle@optimal@train@scale=0.5,1.0,1.5,2.0 --domain train_aug --data_dir $your_dir
python3 make_pseudo_labels.py --experiment_name AffinityNet@ResNeSt-101@Puzzle@train@beta=10@exp_times=8@rw --domain train_aug --threshold 0.35 --crf_iteration 1 --data_dir $your_dir

3.2. Train segmentation model.

CUDA_VISIBLE_DEVICES=0,1,2,3 python3 train_segmentation.py --backbone resnest101 --mode fix --use_gn True --tag DeepLabv3+@ResNeSt-101@Fix@GN --label_name AffinityNet@ResNeSt-101@Puzzle@train@beta=10@exp_times=8@rw@crf=1 --data_dir $your_dir

4. Evaluate the models

CUDA_VISIBLE_DEVICES=0 python3 inference_segmentation.py --backbone resnest101 --mode fix --use_gn True --tag DeepLabv3+@ResNeSt-101@Fix@GN --scale 0.5,1.0,1.5,2.0 --iteration 10

python3 evaluate.py --experiment_name DeepLabv3+@ResNeSt-101@Fix@GN@val@scale=0.5,1.0,1.5,2.0@iteration=10 --domain val --data_dir $your_dir/SegmentationClass

5. Results

Qualitative segmentation results on the PASCAL VOC 2012 validation set. Top: original images. Middle: ground truth. Bottom: prediction of the segmentation model trained using the pseudo-labels from Puzzle-CAM. Overall architecture

Methods background aeroplane bicycle bird boat bottle bus car cat chair cow diningtable dog horse motorbike person pottedplant sheep sofa train tvmonitor mIoU
Puzzle-CAM with ResNeSt-101 88.9 87.1 38.7 89.2 55.8 72.8 89.8 78.9 91.3 26.8 84.4 40.3 88.9 81.9 83.1 34.0 60.1 83.6 47.3 59.6 38.8 67.7
Puzzle-CAM with ResNeSt-269 91.1 87.2 37.3 86.8 61.4 71.2 92.2 86.2 91.8 28.6 85.0 64.1 91.8 82.0 82.5 70.7 69.4 87.7 45.4 67.0 37.7 72.2

6. Provide the trained weights and training logs

  • "experiments.zip" includes all of trained weights and training logs (Puzzle-CAM, AffinityNet, and DeepLabv3+). experiments.zip

  • Release the final masks by our models.

Model val test
DeepLabv3+ ResNeSt-101 val.tgz test.tgz
DeepLabv3+ ResNeSt-269 val.tgz test.tgz

For any issues, please contact Sanghyun Jo, [email protected]

More Repositories

1

RecurSeed_and_EdgePredictMix

[Under Review] RecurSeed and EdgePredictMix: Single-stage learning is sufficient for Weakly-Supervised Semantic Segmentation
Python
44
star
2

Tensorflow_RetinaFace

[Re-implementation] RetinaFace: Single-stage Dense Face Localisation in the Wild
Python
25
star
3

Tensorflow_Improving_Pairwise_Ranking_for_Multi-label_Image_Classification

[Re-implementation] Improving Pairwise Ranking for Multi-label Image Classification (CVPR2017)
Python
20
star
4

MARS

[ICCV 2023] MARS: Model-agnostic Biased Object Removal without Additional Supervision for Weakly-Supervised Semantic Segmentation
Dockerfile
20
star
5

Tensorflow_FixMatch

[Re-implementation] FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence
Python
15
star
6

Tensorflow_GIoU

[Re-implementation] Generalized Intersection Over Union: A Metric and a Loss for Bounding Box Regression (CVPR2019)
Python
14
star
7

Tensorflow_FCOS

FCOS: Fully Convolutional One-Stage Object Detection
Python
11
star
8

Tensorflow_YOLOv1

You Only Look Once: Unified, Real-Time Object Detection
Python
10
star
9

DHR

[ECCV 2024] DHR: Dual Features-Driven Hierarchical Rebalancing in Inter- and Intra-Class Regions for Weakly-Supervised Semantic Segmentation
Dockerfile
9
star
10

TTD

[ECCV 2024] TTD: Text-Tag Self-Distillation Enhancing Image-Text Alignment in CLIP to Alleviate Single Tag Bias
Dockerfile
6
star
11

Tensorflow_Pixel2Pixel

Image-to-Image Translation with Conditional Adversarial Networks
Python
5
star
12

Tensorflow_MixUp

mixup: Beyond Empirical Risk Minimization
Python
4
star
13

Tensorflow_DSSD

DSSD: Deconvolutional Single Shot Detector
Python
3
star
14

Tensorflow_A_Neural_Algorithm_of_Artistic_Style

Basic Style Transfer !!
Python
3
star
15

Tensorflow_FCN

Fully Convolutional Networks for Semantic Segmentation
Python
3
star
16

Fast_Neural_Style_Transfer

Jupyter Notebook
2
star
17

Tensorflow_GAN

Python
2
star
18

DeepLearning-Tutorials-and-Advanced-Techniques

Python
2
star
19

Tensorflow_EfficientNet

EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. ICML 2019
Python
1
star
20

DeepLearning_Papers_with_Code

Python
1
star
21

DataStructure

C/C++, Java, Python
C
1
star
22

sanghyunjo

Wrapped utility functions for existing AI packages to simplify their usage
Python
1
star
23

Python_DataAugmentation

Python
1
star
24

Tensorflow_Learning_Deep_Features_for_Discriminative_Localization

Learning Deep Features for Discriminative Localization (CVPR2016)
Python
1
star
25

DACON_Judgement_of_Court_1st_Solution

Jupyter Notebook
1
star