multispectral-object-detection icon indicating copy to clipboard operation
multispectral-object-detection copied to clipboard

'TransformerBlock' object has no attribute 'conv'

Open JuggerNau opened this issue 3 years ago • 4 comments

Thanks for your work. And I have two questions:

  1. When I run the test.py or detect_twostream with pre-trained model 'yolov5l_transformerx3_llvip_s1024_bs32_e200', there is always a Error: 'TransformerBlock' object has no attribute 'conv'.
  2. Can you upload a simple example of the dataset (the training list, the images(rgb and IR) and the annotation), because I changed the code and read the annotation from xml file directly, and I am not sure if I did it correctly.

JuggerNau avatar Feb 22 '22 02:02 JuggerNau

I have the same problem

XueZ-phd avatar Feb 26 '22 00:02 XueZ-phd

I have the same problem

I know the reason. The architecture of the released pretrained model is different from the codes. I train the model again, and the inference codes run correctly.

JuggerNau avatar Feb 26 '22 08:02 JuggerNau

Sorry for the late reply. Yes, the reason is exactly what you said.
Because I didn't realize that the TransformerBlock module already exists in the yolov5 repository when I first trained. Later, to distinguish this module from the original TransformerBlock module in YOLOv5, I named it myTransformerBlock. If you want to detect it with pre-trained model 'yolov5l_transformerx3_llvip_s1024_bs32_e200', pls change the name of the myTransformerBlock module in models/common.py to TransformerBlock.

https://github.com/DocF/multispectral-object-detection/blob/6905a036e39fa4c411a9ddda961b88aa578cf7b1/models/common.py#L516 ↓ class TransformerBlock(nn.Module):

DocF avatar Feb 28 '22 04:02 DocF

thanks for your response

发自我的iPhone

在 2022年2月28日,12:23,Richard Fang @.***> 写道:

 Sorry for the late reply. Yes, the reason is exactly what you said. Because I didn't realize that the TransformerBlock module already exists in the yolov5 repository when I first trained. Later, to distinguish this module from the original TransformerBlock module in YOLOv5, I named it myTransformerBlock. If you want to detect it with pre-trained model 'yolov5l_transformerx3_llvip_s1024_bs32_e200', pls change the name of the myTransformerBlock module in models/common.py to TransformerBlock.

https://github.com/DocF/multispectral-object-detection/blob/6905a036e39fa4c411a9ddda961b88aa578cf7b1/models/common.py#L516 ↓ class TransformerBlock(nn.Module):

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.

XueZ-phd avatar Feb 28 '22 04:02 XueZ-phd