Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打扰一下,训练代码报错 #70

Open
haotlong opened this issue May 26, 2020 · 4 comments
Open

打扰一下,训练代码报错 #70

haotlong opened this issue May 26, 2020 · 4 comments

Comments

@haotlong
Copy link

错误详情:
Traceback (most recent call last):
File "train.py", line 444, in
device=device, )
File "train.py", line 320, in train
loss, loss_xy, loss_wh, loss_obj, loss_cls, loss_l2 = criterion(bboxes_pred, bboxes)
File "E:\anaconda\envs\python3.6\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "train.py", line 204, in forward
pred[..., 0] += self.grid_x[output_id]
RuntimeError: The size of tensor a (8) must match the size of tensor b (76) at non-singleton dimension 3
python3.6版本 pytorch1.50 cpu版

train.txt文件样例:
00000016.jpg 260,252,424,379,3 594,236,663,316,3 602,181,650,229,3
训练语句:
python train.py -l 0.001 -pretrained ./yolov4.conv.137.pth -classes 11 -dir J:\data\mio\MIO-TCD-Localization1\MIO-TCD-Localization\train

未修改其他部分,还望指出错误在哪,打扰作者了,谢谢

@hnqin-xdu
Copy link

I have met similar problem, did you solve it?

@wallcuber
Copy link

wallcuber commented Jun 25, 2020

train.py line 93
The image_size is locked. If you want to train your own dataset, you should modify this line.
You need to add a "img_size" parameter, and write
"self.img_size = img_size
#image_size = 608"

also in line 110" fsize = image_size // self.strides[i]" should be modified.
line 300 "criterion = Yolo_loss(device=device, batch=config.batch // config.subdivisions,n_classes=config.classes)" should also add an parameter"img_size".
微信图片_20200625174721

@bochuanwu
Copy link

train.py line 93
The image_size is locked. If you want to train your own dataset, you should modify this line.
You need to add a "img_size" parameter, and write
"self.img_size = img_size
#image_size = 608"

also in line 110" fsize = image_size // self.strides[i]" should be modified.
line 300 "criterion = Yolo_loss(device=device, batch=config.batch // config.subdivisions,n_classes=config.classes)" should also add an parameter"img_size".
微信图片_20200625174721

great answer!

@Rich2333
Copy link

What if the image size is 640*480?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants