jbeomlee93 / AdvCAM

Anti-Adversarially Manipulated Attributions for Weakly and Semi-Supervised Semantic Segmentation (CVPR 2021)
MIT License
128 stars 16 forks source link

the result of obtian_cam_masking.py and the pseudo mask #17

Open whiterAutumn opened 2 years ago

whiterAutumn commented 2 years ago

Hi,thanks for your sharing!But i still have some questions look forward to your answer! is the result of the obtian_cam_masking.py a pseudo mask dirtectly used in training segmentation network?if not, can you tell how to generate it? Thank you!

jbeomlee93 commented 2 years ago

Hi,

You can run "get_mask_quality.sh" for a whole process.

More specifically, after obtaining CAM with "obtian_cam_masking.py", you should run "python run_sample.py" to generate the final pseudo ground-truth masks.

Thanks

whiterAutumn commented 2 years ago

I'm glad to receive your quick reply! According to my understanding of the code,the ".npy" file used in obtian_cam_masking.py is generated by resnet50_cam.

model = getattr(importlib.import_module(args.cam_network), 'CAM')()
 model.load_state_dict(torch.load(args.cam_weights_name + '.pth'), strict=True)
 model.eval()

However, the make_sem_seg_labels.py and make_sem_seg_labels.py are based on resnet50_irn

model = getattr(importlib.import_module(args.irn_network), 'EdgeDisplacement')()
    print(args.irn_weights_name)
    model.load_state_dict(torch.load(args.irn_weights_name), strict=False)
    model.eval()

In this paper, it said that irn is the baseline。so the model obtian_cam_masking.py used should be changed to resnet50_irn

Is there any deviation in my understanding?look forward for your relpy sincerely!

jbeomlee93 commented 2 years ago

IRN (resnet50_irn) is the network to refine the initial seed (CAM), which is obtained from the classifier (resnet50_cam).

So, we first obtain the CAM from resnet50_cam, and then refine the CAM using resnet50_irn.

The official implementation of IRN (https://github.com/jiwoon-ahn/irn) also follows this process.

Thanks!

whiterAutumn commented 2 years ago

I’m very sorry that don't carefully reading ! Thanks!