pooya-mohammadi / yolov5-gradcam

Visualizing Yolov5's layers using GradCam
MIT License
281 stars 47 forks source link

KeyError: 'cv3' #14

Open zzff-sys opened 2 years ago

zzff-sys commented 2 years ago

My training weights were trained by adding the attention mechanism to YOLOv5's network, and there was an error when I used the code to export the thermal map: image What is the problem and how to solve it,Thank you very much

pooya-mohammadi commented 2 years ago

@zzff-sys Checked the model and works fine. Please check it again on colab

jccmoing-bit commented 2 years ago

@zzff-sys Checked the model and works fine. Please check it again on colab

I added an attention mechanism to the model and added related modules to common.py, but I also got an error in the end: KeyError: 'cv3'

jccmoing-bit commented 2 years ago

My training weights were trained by adding the attention mechanism to YOLOv5's network, and there was an error when I used the code to export the thermal map: image What is the problem and how to solve it,Thank you very much

how did you solve this problem?

pooya-mohammadi commented 2 years ago

@jccmoing-bit

  1. Your weights are trained on a custom dataset or you are using pretrained weights of yolov5?
  2. Secondly, have installed the requirements?
  3. Finally, have tried colab notebook provided for inferencing?
dayu178 commented 2 years ago

I have the same problem

dayu178 commented 2 years ago

Use yolov5 custom training with added attention mechanism

SolitudeWX commented 2 years ago

I have found the reason. See these lines in main.py: parser.add_argument('--target-layer', type=str, default='model_23_cv3_act', help='The layer hierarchical address to which gradcam will applied,' ' the names should be separated by underline') means what layer you want to find. The names after default should be the layer name in your model, but to see the name of layer, you should debug the code. 1658981751047