yolov9 icon indicating copy to clipboard operation
yolov9 copied to clipboard

Please use `train.py` to train gelan models, and use `train_dual.py` to train yolov9 models.

Open SZHOU551 opened this issue 1 year ago • 4 comments

          Please use `train.py` to train gelan models, and use `train_dual.py` to train yolov9 models.

Originally posted by @WongKinYiu in https://github.com/WongKinYiu/yolov9/issues/27#issuecomment-1960679596

when we train the 2048*2448-size dataset for gelan.yaml, both train.py and train_dual.py report issue:

File "D:\PythonCode\yolov9-main\utils\loss_tal_dual.py", line 175, in pred_distri, pred_scores = torch.cat([xi.view(feats[0].shape[0], self.no, -1) for xi in feats], 2).split( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: shape '[67, 67, -1]' is invalid for input of size 428800

training for yolov9.yaml is ok.

By the way, how to output the pixel position of the each visual object in the detection?

SZHOU551 avatar Feb 24 '24 17:02 SZHOU551

size should be multiples of 64.

WongKinYiu avatar Feb 25 '24 02:02 WongKinYiu

size should be multiples of 64.

Thank you for your prompt reply. sorry, this is my first time using Yolo, what does it mean?

SZHOU551 avatar Feb 25 '24 11:02 SZHOU551

Because the architecture include dowansampling modules and upsampling modules which strides equal to 2. if the input width and height are not multiples of 64, it may cause shape mismatch error. You could use 20482432-size or 20482496-size to train the model.

WongKinYiu avatar Feb 26 '24 01:02 WongKinYiu

dualDetect branch at the bottom of the yolov9-c.yaml ( [[31, 34, 37, 16, 19, 22], 1, DualDDetect, [nc]], # DualDDetect(A3, A4, A5, P3, P4, P5) ) so train_dual.py (line 315) will have two list. pred[0] -->3 heads pred[1] --> 3 heads

and other one, for example, gelan-c.yaml you can not find dual branch. there is only single branch ([[15, 18, 21], 1, DDetect, [nc]], # DDetect(P3, P4, P5)) so train.py (line 303) will have only one list. pred --> 3 heads

so if you want to run like gelan-c.yaml then you shoud use train.py not train_dual.py

Kimyuhwanpeter avatar Feb 27 '24 08:02 Kimyuhwanpeter