WongKinYiu / yolov9

Implementation of paper - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
GNU General Public License v3.0
8.82k stars 1.37k forks source link

Issue Integrating CBAM with YOLOv9 - Spatial Dimension Mismatch Error #494

Open aziziselma opened 2 months ago

aziziselma commented 2 months ago

I am currently working on integrating the Convolutional Block Attention Module (CBAM) into the YOLOv9 model. Here are the steps I followed to add CBAM:

-Modified the yolo.py file to support the CBAM module. -Added the CBAM module in common.py. -Updated the model configuration YAML file to include CBAM. However, when I run the training script, I encounter the following error: ValueError: Input and output must have the same number of spatial dimensions, but got input with spatial dimensions of [16] and output size of torch.Size([32, 32]). Please provide input tensor in (N, C, d1, d2, ...,dK) format and output size in (o1, o2, ...,oK) format.

The error seems to occur when applying the CBAM module, particularly when the tensor dimensions do not match as expected. Does anyone have suggestions or advice on how to resolve this dimension mismatch issue when integrating CBAM into YOLOv9? Thank you in advance for your assistance!

WongKinYiu commented 2 months ago

You have to add CBAM into yolo.py too.

aziziselma commented 2 months ago

You have to add CBAM into yolo.py too. I've already added CBAM to yolo.py

p-dot-max commented 1 month ago

Any updates ?

Umsh commented 1 week ago

@p-dot-max have yo solved this?