haofanwang / Score-CAM

Official implementation of Score-CAM in PyTorch
MIT License
399 stars 66 forks source link

At the end of the model must have two full-connection layers? #11

Closed wwwnnn668 closed 3 years ago

wwwnnn668 commented 3 years ago

Dear author:

First of all, thanks for your great work! In the paper i find FC layer is out of model.But in the code,i find the two FC-layer is inside the model. When I want to visualize the yolov4 that has pretrained,I find it dont have two FC behind the model.If I add two FC which is not pre-trained.It will random initialization what causes each layer of visualization map is not fixed.I don't know if I understand right or do you have any good suggestions.Looking forward to your reply!

haofanwang commented 3 years ago

Hi, @wwwnnn668,

I don't fully understand what you means, could you clarify? Do you mean in YOLOv4, you have 2 FC layers after the final Conv layer?

I don't think the number of FC layers matters. You only need two steps, extract the feature maps first, then do forward propagation with masked input. Why you need to add two FC layers?

wwwnnn668 commented 3 years ago

In your structure of the paper,I find two FC layers were added after the model.In the code ,I find the model output a one-dimensional vector,for example (1000,1).I am wondering whether the model can be finished without FC.

haofanwang commented 3 years ago

If there is no FC, how would you know the confidence score of the target class?

wwwnnn668 commented 3 years ago

You mean the model must be followed by FC layer, right?Now I want to visualize the pre-trained YOLOV4 model, which has no FC layer behind it.Therefore, a FC layer must be added to the model, and the parameters of the FC layer are randomly initialized.Does this cause the visual image to change?Thanks for your reply.

haofanwang commented 3 years ago

As a detection model, if I remember correctly, it will assign a confidence score for each bbox which indicates the class of this bbox, right? You can use the score here.

wwwnnn668 commented 3 years ago

I see. Thank you.

haofanwang commented 3 years ago

Closed. Please let me know if you have further questions.