ICIP 2021

Puzzle-CAM

Improved localization via matching partial and full features

Sanghyun Jo1 In-Jae Yu2,†
1GYN 2KAIST School of Computing
† Corresponding author

Puzzle-CAM in four scenes. The CAM of an image and the CAMs of its tiled patches do not match, and Puzzle-CAM trains them to match. In the recorded ResNet-50 training runs, the CAMs of the same training images spread over the objects epoch by epoch with the puzzle module (CAM mIoU logged during training: 43.20 without it, 47.58 with it). The loss ablation of the paper goes from 47.82% to 51.53%, followed by segmentation results. The code repository reproduces this demo from the released training logs.

Key Insight

The CAM of an image classifier focuses on the most discriminative parts of an object, and the CAMs of isolated patches in a tiled image are significantly inconsistent with the CAM of the original image. Puzzle-CAM uses this difference as self-supervision: a puzzle module splits the image and merges the CAMs of its patches, and a reconstructing regularization matches the merged CAM with the CAM of the whole image, so the CAM covers the overall region of an object with image-level supervision and no extra parameters.

1Abstract

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 that 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 that minimizes differences between the features from separate patches and the whole image. Our method consists of a puzzle module and two regularization terms to discover the most integrated region in an object. Puzzle-CAM can activate the overall region of an object using image-level supervision without requiring extra parameters.

In experiments, Puzzle-CAM outperformed previous state-of-the-art methods using the same labels for supervision on the PASCAL VOC 2012 dataset. Code associated with our experiments is available at https://github.com/OFRIN/PuzzleCAM.

2Contributions

PROBLEM

Partial and Inconsistent CAMs

CAMs usually focus on small parts of the semantic objects, and the CAMs generated from isolated patches of a tiled image differ from those of the original image, which enlarges the supervision gap between fully- and weakly-supervised semantic segmentation.

METHOD

Tiling, Merging, Matching

Puzzle-CAM incorporates reconstructing regularization with a puzzle module that splits the image and merges the CAMs of its patches, to effectively enhance the quality of CAMs without adding layers.

RESULTS

State-of-the-Art Results

Puzzle-CAM outperformed existing state-of-the-art methods with the same level of supervision on the PASCAL VOC 2012 dataset, reaching 71.9% mIoU on the val set and 72.2% on the test set.

3Method

Puzzle-CAM is a Siamese network with a shared backbone: one branch takes the original image, the other takes its tiled patches, and the loss functions match the CAMs generated from the tiled image with those of the original image.

Overall architecture of Puzzle-CAM: the original image and its tiled patches pass through a shared backbone, the merging module joins the patch CAMs, and classification and reconstruction losses are applied

The overall architecture of Puzzle-CAM. The puzzle module tiles the image, generates the CAMs of the patches with the shared backbone, and merges them. The reconstruction loss matches the merged CAM with the CAM of the original image, and both CAMs pass through global average pooling (GAP) for classification.

The Puzzle Module: Tiling and Merging

From an input image I of size W × H, the tiling module generates four non-overlapping patches of size W/2 × H/2, and CAMs are generated for each patch. The merging module then attaches them into a single set of CAMs Are that has the same shape as As, the CAMs of I.

Classification Losses on Both CAMs

A GAP layer converts the CAMs of the original and the tiled images into prediction vectors, and a multi-label soft margin loss is applied to each: Lcls for the original image and Lp−cls for the reconstructed one. The two classification losses roughly estimate the region of the object.

Reconstructing Regularization

The reconstruction loss Lre is the L1 distance between As and Are. It reinforces the CAMs from the original image and narrows the gap between pixel-level and image-level supervision. The final loss is L = Lcls + Lp−cls + αLre, where α is linearly ramped up to its maximum of 4. During inference, the classifier is used without the puzzle module.

4Results

Puzzle-CAM is evaluated on the PASCAL VOC 2012 dataset. AffinityNet is trained on the CAMs of Puzzle-CAM to synthesize pseudo-labels, which then train a DeepLabv3+ segmentation model in full supervision mode.

71.9%
PASCAL VOC 2012 val
segmentation mIoU with the ResNeSt-269 backbone
72.2%
PASCAL VOC 2012 test
segmentation mIoU with image-level labels only
74.67%
Pseudo-labels
mIoU on the PASCAL VOC 2012 train set
+3.71
ResNet-50 ablation
CAM mIoU over the baseline, 47.82% to 51.53%

Comparison with Existing State-of-the-Art Methods

Table comparing Puzzle-CAM with AffinityNet, DSRG, SeeNet, IRNet, FickleNet, ICD and SEAM on the PASCAL VOC 2012 val and test sets

Comparison on the PASCAL VOC 2012 val and test sets (mIoU). Puzzle-CAM reaches 66.9 on val and 67.7 on test with ResNeSt-101, and 71.9 and 72.2 with ResNeSt-269, using image-level labels only. I: image-level labels. S: external saliency models.

Qualitative Segmentation Results

Six PASCAL VOC 2012 val images with their ground-truth masks and the masks predicted by the segmentation model trained with Puzzle-CAM pseudo-labels

Qualitative segmentation results on the PASCAL VOC 2012 val set. Top: original images. Middle: ground truth. Bottom: prediction of the segmentation model trained using the pseudo-labels from Puzzle-CAM. The proposed method worked well on both large and small objects.

Quality of the Pseudo-Labels

Table of pseudo-label quality in mIoU for AffinityNet with ResNet-50 and Puzzle-CAM with ResNet-50, ResNeSt-50, ResNeSt-101 and ResNeSt-269: CAM, CAM with random walk, and CAM with random walk and dense CRF

Quality of the pseudo semantic segmentation labels in mIoU on the PASCAL VOC 2012 training set. With the same ResNet-50 backbone, Puzzle-CAM improves the CAMs of the AffinityNet baseline from 47.82% to 51.53%, and with ResNeSt-269 the final pseudo-labels reach 74.67%. RW: random walk with AffinityNet. dCRF: dense conditional random field.

5Ablation Study

Loss Functions

Ablation table of the Puzzle-CAM loss functions with ResNet-50: classification loss only 47.82, with patch classification loss 47.70, with reconstruction loss 49.21, with all three 51.53 mIoU

Ablation of the Puzzle-CAM loss functions with ResNet-50 as the backbone. The reconstructing regularization Lre boosts the baseline from 47.82% to 49.21% mIoU, while the classification loss from the tiled patches Lp−cls alone is similar to the baseline. Using both improves the baseline by 3.71, to 51.53%.

Effect of Each Loss on the CAMs

Prediction tags and CAMs of one image for four loss combinations: (a) classification loss, (b) with patch classification loss, (c) with reconstruction loss, (d) all three losses

Prediction tags and CAMs by combinations of loss functions. With only Lre added in (c), localization improves for some classes but several classes are no longer predicted. With all losses in (d), the final CAMs not only suppress over-activation but also expand into complete object activation coverage.

6Citation

BibTeX
@inproceedings{jo2021puzzlecam,
  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)},
  year      = {2021},
  pages     = {639-643},
  doi       = {10.1109/ICIP42928.2021.9506058}
}