YudeWang / SEAM

Self-supervised Equivariant Attention Mechanism for Weakly Supervised Semantic Segmentation, CVPR 2020 (Oral)
MIT License
539 stars 97 forks source link

dCRF on CAMs #25

Closed Ferenas closed 3 years ago

Ferenas commented 3 years ago

Hi, thanks for sharing your great work,I have one question about dCRF in your paper and wish for your reply. In your paper, a bunch of CAMs can be generated after training the SEAM.py, I want to know how to proceed the dCRF process in these CAMs (56.83% in table 1). Proceed the dCRF on the CAMs after combing with the best background scores from (0,60) or simply using foreground images ?

YudeWang commented 3 years ago

Hi @Ferenas , The training of AffinityNet use the crf result of SEAM step. And the inference of AffinityNet only use the 55.41% result in table 1. Please follow the default parameter setting in this repository.

Ferenas commented 3 years ago

Thanks a lot for your reply, I have figured out the whole process!!Btw, Can you please give me some hints about how to fine tune the parameters in Affinity training and inference process? Now I'am using it to refine results generated by my model, and I found that Affinity Net does not always improve much MIOU....

YudeWang commented 3 years ago

Thanks a lot for your reply, I have figured out the whole process!!Btw, Can you please give me some hints about how to fine tune the parameters in Affinity training and inference process? Now I'am using it to refine results generated by my model, and I found that Affinity Net does not always improve much MIOU....

  1. In infer_SEAM.py, make sure the crf threshold across the best background score https://github.com/YudeWang/SEAM/blob/c55601649c5fa676836d3ec70ec044541b7d1d83/infer_SEAM.py#L31 Tips: There is a transformation between background score and crf_alpha, take a look at it firstly. https://github.com/YudeWang/SEAM/blob/c55601649c5fa676836d3ec70ec044541b7d1d83/infer_SEAM.py#L108
  2. In infer_aff.py, pick a args.alpha firstly and fix it, then grid search args.beta and args.logt
  3. Best background score of SEAM not always the ideal threshold. It always over-activated too much in background region. A smaller one will be good for AffinityNet.

If you use the trained model in this repo, please follow the default setting. Good luck :)

Ferenas commented 3 years ago

Thanks greatly for ur hints! However, I have a question about ur first hint. For example, In your trained model, the best MIOU of the CAM with a fixed background value is about 55.4%, and the MIOU of CAM with alpha = 4 and alpha = 24 is 56.0% and 45% (in my test). Do you mean that the best value 55.4% has in the [45%,56%]?

YudeWang commented 3 years ago

Thanks greatly for ur hints! However, I have a question about ur first hint. For example, In your trained model, the best MIOU of the CAM with a fixed background value is about 55.4%, and the MIOU of CAM with alpha = 4 and alpha = 24 is 56.0% and 45% (in my test). Do you mean that the best value 55.4% has in the [45%,56%]?

https://github.com/YudeWang/SEAM/blob/c55601649c5fa676836d3ec70ec044541b7d1d83/infer_SEAM.py#L94 The transformation between background score and alpha is (1-bkg_score)^alpha=bkg_score alpha=4--->bkg_score=0.27xxx alpha=24--->bkg_score=0.09xxx These two bkg_scores should across the best bkg_score (here is 0.26)

Ferenas commented 3 years ago

thanks for ur reply,however,here the code is np.max(v),resulting in a multi-value instead of a single-value vector. Do you mean that for the generation of crf alpha affinity,we should calculate the background value by (1-0.26)^4 and (1-0.26)^24 respectively?

YudeWang commented 3 years ago

thanks for ur reply,however,here the code is np.max(v),resulting in a multi-value instead of a single-value vector. Do you mean that for the generation of crf alpha affinity,we should calculate the background value by (1-0.26)^4 and (1-0.26)^24 respectively?

...... Forget it, just set bkg_score_low<best bkg_score<bkg_score_high

Ferenas commented 3 years ago

thanks for ur reply,however,here the code is np.max(v),resulting in a multi-value instead of a single-value vector. Do you mean that for the generation of crf alpha affinity,we should calculate the background value by (1-0.26)^4 and (1-0.26)^24 respectively?

...... Forget it, just set bkg_score_low<best bkg_score<bkg_score_high

OK, I see, hah, I understand what you mean and seems like I have to try several approaches and parameters... Thanks a lot for your reply! thanks greatly and sincerely!

Italy2006 commented 2 years ago

I have a question about this. In my experiment, my bkg_score_best is 0.14. According to the above calculation, alpha can be set to 13 and 24, but I found that the results after crf under these two parameters are very close (64.49 vs 64.6), how can I adjust it? ?