Home

Awesome

LPCAM

The official code of CVPR 2023 paper (Extracting Class Activation Maps from Non-Discriminative Features as well). arXiv

Prerequisite

conda env create -f environment.yml

Usage (PASCAL VOC)

Step 1. Prepare dataset.

Step 2. Train classification network and generate LPCAM seeds.

CUDA_VISIBLE_DEVICES=0 python run_sample.py --voc12_root ./VOCdevkit/VOC2012/ --work_space YOUR_WORK_SPACE --train_cam_pass True --make_cam_pass True --make_lpcam_pass True --eval_cam_pass True 

Step 3. Train IRN and generate pseudo masks.

CUDA_VISIBLE_DEVICES=0 python run_sample.py --voc12_root ./VOCdevkit/VOC2012/ --work_space YOUR_WORK_SPACE --cam_to_ir_label_pass True --train_irn_pass True --make_sem_seg_pass True --eval_sem_seg_pass True 

You can download the pseudo labels from this link.

Step 4. Train semantic segmentation network.

To train DeepLab-v2, we refer to deeplab-pytorch. We use the ImageNet pre-trained model for DeepLabV2 provided by AdvCAM. Please replace the groundtruth masks with generated pseudo masks.

Usage (MS COCO)

Step 1. Prepare dataset.

Step 2. Train classification network and generate LPCAM seeds.

CUDA_VISIBLE_DEVICES=0 python run_sample_coco.py --mscoco_root ../MSCOCO/ --work_space YOUR_WORK_SPACE --train_cam_pass True --make_cam_pass True --make_lpcam_pass True --eval_cam_pass True 

Step 3. Train IRN and generate pseudo masks.

CUDA_VISIBLE_DEVICES=0 python run_sample_coco.py --mscoco_root ../MSCOCO/ --work_space YOUR_WORK_SPACE --cam_to_ir_label_pass True --train_irn_pass True --make_sem_seg_pass True --eval_sem_seg_pass True 

You can download the pseudo labels from this link.

Step 4. Train semantic segmentation network.

Acknowledgment

This code is borrowed from IRN and ReCAM.