argusswift / YOLOv4-pytorch

This is a pytorch repository of YOLOv4, attentive YOLOv4 and mobilenet YOLOv4 with PASCAL VOC and COCO
1.68k stars 330 forks source link

How to train model using dataset with another resolution? #246

Closed psc1453 closed 2 years ago

psc1453 commented 2 years ago

I have modified the resolution settings in cfg.py. My dataset has the resolution of 640x480. However, It gives me error like this.

OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 OpenCV can't augment image: 640 x 480 Epoch 1/300: 0%| | 0/271 [00:01<?, ?img/s] Traceback (most recent call last): File "/home/psc/PycharmProjects/FYP/pytorch-YOLOv4/train.py", line 627, in train(model=model, File "/home/psc/PycharmProjects/FYP/pytorch-YOLOv4/train.py", line 380, in train loss, loss_xy, loss_wh, loss_obj, loss_cls, loss_l2 = criterion(bboxes_pred, bboxes) File "/home/psc/anaconda3/envs/FYP/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/home/psc/PycharmProjects/FYP/pytorch-YOLOv4/train.py", line 242, in forward output = output.view(batchsize, self.n_anchors, n_ch, fsize, fsize) RuntimeError: shape '[4, 3, 6, 60, 60]' is invalid for input of size 345600