HHHit / DL-based-Tumor-Classification

Deep Learning Based Tumor Type Classification Using Gene Expression Data
MIT License
22 stars 16 forks source link

visulization problem #1

Closed AFOXCOW closed 5 years ago

AFOXCOW commented 5 years ago

Excuse me. I have a very simple question about visulization in your code. There are only GradCam.py and its cuda version in your code, while no python file to call those functions and generate those final guided-grad-cam pictures. Did I miss something? Sorry to bother you and can you provide the whole .py files? Thanks again!!

HHHit commented 5 years ago

GradCam.py itself should be the one. In it there is a function to save the images. The other is for the other experiment which I didn’t include in my paper.

AFOXCOW commented 5 years ago

Thanks for your reply. I try to follow your paper and use guided-grad-cam to generate the heatmap pics.

` gcam = GradCAM(model=model)

gbp = GuidedBackPropagation(model=model)

probs, ids = gcam.forward(images)

_ = gbp.forward(images)

gcam.backward(idx=ids[i])

regions = gcam.generate(target_layer=target_layer)

gbp.backward(idx=ids[i])

gradients = gbp.generate() `

Above is the main process of using your GradCam_cuda.py(cause the defination of Net arch in GracCam.py is not the same in Training_testing.py, I guess it is used for other purpose as mentioned in your reply) Both gcam and gbp instance`s self.image.grad is nonetype as is shown in pics. Because the grad-cam does not need the grad of input image, it works. But the guied bp did not work which makes the guided grad cam pics can not be generated. Am I using GradCam_cuda.py in a wrong way? 2019-08-12 20-08-02屏幕截图

AFOXCOW commented 5 years ago

Sorry to bother you again. My bad. It is just a wrong usage of pytorch. I find the solution here. https://discuss.pytorch.org/t/strange-behavior-of-variable-cuda-and-variable-grad/1642