This repository contains an implementation of weakly-supervised semantic segmentation using the Pascal VOC 2012 dataset. A Class Activation Map (CAM) based on a ResNet50 (pretrained on ImageNet) with a Conditional Random Field (CRF) is used to generate pseudo masks. The segmentation network is implemented using DeepLabv2 with a ResNet-101 backbone (pretrained on ImageNet).
| Pseudo Mask † | Segmentation Mask ‡ | |
|---|---|---|
| mIoU | 49.9 | 47.5 |
‡ Generated through a CRF post-processing of the CAM outputs.
‡ The result of fully-supervised semantic segmentation using the pseudo mask generated from CAM outputs as annotation.
bash install.sh -
Bring this repository(https://github.com/kazuto1011/deeplab-pytorch) into the
deeplab-pytorchfolder, excluding the files already present in my repository -
Download pretrained weights from this repository (https://github.com/jbeomlee93/AdvCAM) and locate it on this path
deeplab-pytorch/data/models/voc12/deeplabv1_resnet101-imagenet.pth
To train CAM based on ResNet50 using only the image-level annotations,
python main.py --work-dir work_dir/voc/resnet50 --config config/voc/resnet50_cam_m.yamlTo generate the pseudo masks through CRF post-processing of the CAM outputs,
python pseudo_mask_generator.py --config config/voc/resnet50_cam_m_eval.yamlTo evaluate mIoU between original pixcel-level annotation mask and pseudo mask on train set,
python pesudo_mask_evaluation.py > pseudo_miou.txtTo train segmentation model with pseudo mask as annotation on train set, and evaluate it on valid set,
cd deeplab-pytorch
bash exp.sh