GANPerf / SAM

29 stars 7 forks source link

The purpose of "grayscale_cam" and "weights_gradcam" in main.py #4

Open demidovd98 opened 1 year ago

demidovd98 commented 1 year ago

Hello,

Could you please explain what's the purpose of the "grayscale_cam" and "weights_gradcam" variables in main.py (line 148) ?

These variables are never used, but they are probably important since they come from the "cam_algorithm" function. However, I haven't found any link to the variables in the code.

Is it a mistake, or is it supposed to be like this?

Thank you.

demidovd98 commented 1 year ago

Also, could you please check if the uploaded version of the code is the final one? Seems like there are several bugs and typos, especially in the main.py and datasets preparation files.

Thank you.

GANPerf commented 1 year ago

Hi guys, Thank you for your questions. "weights_gradcam" is used for generated gradcam-based weights. You can see line 159. It is an alternative to using cam or gradcam weight. Some variable is never used because the current code runs in the cam case, while those variables are related to the gradcam case. Some others still need to change, e.g., CBP or BP to used. Details can see line 58-86 in method.py.Apologise for the inconvenience. Also, I add some document declarations in datasets preparation files, e.g., line 29 ''train10'' in cub200.py. It may be some bugs when you run --label_ratio 10 if missing line 29 in dataset txt. Following your attention, I also fix some typos and bugs. You can run again. Wish this will help you.

demidovd98 commented 1 year ago

Hi guys, Thank you for your questions. "weights_gradcam" is used for generated gradcam-based weights. You can see line 159. It is an alternative to using cam or gradcam weight. Some variable is never used because the current code runs in the cam case, while those variables are related to the gradcam case. Some others still need to change, e.g., CBP or BP to used. Details can see line 58-86 in method.py.Apologise for the inconvenience. Also, I add some document declarations in datasets preparation files, e.g., line 29 ''train10'' in cub200.py. It may be some bugs when you run --label_ratio 10 if missing line 29 in dataset txt. Following your attention, I also fix some typos and bugs. You can run again. Wish this will help you.

Thank you for the reply. But why would it be just CAM in the default code? Seems like the default method is GradCAM, and the performance is also reported for GradCAM.

Is it possible to adapt the code to use GradCAM by default?

HashmatShadab commented 1 year ago

Kindly update on the above questions. Proper documentation of how to run the experiments to reproduce the main experiments reported in the paper would be appreciated.

GANPerf commented 1 year ago

Hi guys, Thank you for your questions. "weights_gradcam" is used for generated gradcam-based weights. You can see line 159. It is an alternative to using cam or gradcam weight. Some variable is never used because the current code runs in the cam case, while those variables are related to the gradcam case. Some others still need to change, e.g., CBP or BP to used. Details can see line 58-86 in method.py.Apologise for the inconvenience. Also, I add some document declarations in datasets preparation files, e.g., line 29 ''train10'' in cub200.py. It may be some bugs when you run --label_ratio 10 if missing line 29 in dataset txt. Following your attention, I also fix some typos and bugs. You can run again. Wish this will help you.

Thank you for the reply. But why would it be just CAM in the default code? Seems like the default method is GradCAM, and the performance is also reported for GradCAM.

Is it possible to adapt the code to use GradCAM by default?

Thank you for your question. I have now separated the file into two parts: src/main_bp_cam.py and src/main_bp_gradcam.py. Please take a look at them.

GANPerf commented 1 year ago

Kindly update on the above questions. Proper documentation of how to run the experiments to reproduce the main experiments reported in the paper would be appreciated.

Thank you for your question. I have now separated the file into two parts: src/main_bp_cam.py and src/main_bp_gradcam.py. Please take a look at them.