Home

Awesome

BBAM: Bounding Box Attribution Map for Weakly Supervised Semantic and Instance Segmentation

The implementation of BBAM: Bounding Box Attribution Map for Weakly Supervised Semantic and Instance Segmentation, Jihun Yi, Chaehun Shin, and Sungroh Yoon, CVPR 2021. [paper]

Input image and predicted box for 'banana' (red box)BBAM over iterations
ab

Installation

We kindly refer to INSTALLATION from maskrcnn-benchmark.

Examples

Step 1. Prepare Dataset

Step 2. Prepare pre-trained object detector

Step 3. Obtain BBAMs for PASCAL VOC validation images

python tools/BBAM/BBAM_FRCNN.py --gpu 0 --img_idx 30 --visualize True

img_idx denotes image index of PASCAL VOC validation images to be explained, ranging from 0 to 1448 (inclusive).

Step 4. Obtain pseudo ground-truth masks for PASCAL VOC training images

python tools/BBAM/BBAM_training_images_multi.py
python tools/BBAM/make_annotation/make_cocoann_topCRF_parallel.py
python tools/BBAM/make_annotation/BBAM_plus_mcg.py
python tools/BBAM/make_annotation/create_semantic_labels.py

Step 5. Train an instance segmentation network.

CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 tools/train_net.py --config-file configs/pascal_voc/BBAM_VOC_aug_FPN_R101_MaskRCNN.yaml
CUDA_VISIBLE_DEVICES=0 python tools/test_net.py --config-file "configs/pascal_voc/BBAM_VOC_aug_FPN_R101_MaskRCNN.yaml" --ckpt BBAM_Mask_RCNN_logs_mcg85/model_final.pth TEST.IMS_PER_BATCH 1
python tools/BBAM/CRF_for_prediction.py

Step 6. Train a semantic segmentation network.

Reference