AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.6k stars 7.95k forks source link

GRAD CAM for test images #7845

Open SaraPiresNobrega opened 3 years ago

SaraPiresNobrega commented 3 years ago

Hello ! I am developing my master's degree dissertation and I would like to used GRAD CAM or other class activation maps to corroborate the test results of my object detection model (YOLOv4).

Using the information present in https://github.com/AlexeyAB/darknet/issues/5117 it is possible to do that ?

AlexeyAB commented 3 years ago

@SaraPiresNobrega Hi,

Yes, use this in cfg-file for Grad-CAM:

[net]
adversarial_lr=0.5
attention=1
burn_in=0
learning_rate=0.001

And remove all stopbackward= lines from cfg-file (if they exist).

And run training command with your pre-trained weights.


For example:

You will see such results:

Although it looks less beautiful and less understandable, it is closer to the truth than other Grad-CAM implementations. image

JeremyKeusters commented 3 years ago

Thanks for this @AlexeyAB ! Very interesting to look at! Would it be easy to also have the labels displayed on these images?

SaraPiresNobrega commented 3 years ago

@AlexeyAB thank you very much ! This approach will be very helpful in my master's degree dissertation ! I thought that there was some way to visualize the GRAD CAM maps using the "test" command but I think that this way I can also do what I want.

AlexeyAB commented 3 years ago

Also try the latest commit, I fixed a bug recently.

SaraPiresNobrega commented 3 years ago

@AlexeyAB thank you very much !