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

当训练多分类时,训练过程中跑test报错 #46

Open
Aruen24 opened this issue Feb 16, 2022 · 7 comments
Open

当训练多分类时,训练过程中跑test报错 #46

Aruen24 opened this issue Feb 16, 2022 · 7 comments

Comments

@Aruen24
Copy link

Aruen24 commented Feb 16, 2022

Starting training for 300 epochs...

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 0/299     3.91G     0.059   0.01828   0.02349      0.12    0.2208         6       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:52<00:00,  1.82it/s]

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 1/299     3.92G   0.05078   0.01312   0.01976   0.09381    0.1775         2       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:50<00:00,  1.89it/s]

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 2/299     3.92G   0.05082   0.01197   0.01861   0.09338    0.1748         2       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:48<00:00,  1.96it/s]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95:   0%|                                                                            | 0/10 [00:00<?, ?it/s]

Traceback (most recent call last):
File "train.py", line 516, in
train(hyp, opt, device, tb_writer, wandb)
File "train.py", line 349, in train
log_imgs=opt.log_imgs if wandb else 0)
File "/home/wyw/License-Plate-Detector/test.py", line 121, in test
output = non_max_suppression_plate(inf_out, conf_thres=conf_thres, iou_thres=iou_thres, labels=lb)
File "/home/wyw/License-Plate-Detector/utils/general.py", line 424, in non_max_suppression_plate
x = torch.cat((box[i], x[i, j + 13, None], x[:, 5:13] ,j[:, None].float()), 1)
RuntimeError: Sizes of tensors must match except in dimension 0. Got 2016 and 3248 (The offending index is 2)

@Aruen24 Aruen24 changed the title 训练过程中跑test报错 当训练多分类时,训练过程中跑test报错 Feb 17, 2022
@panda-lab
Copy link

训练的时候没遇到这个问题,你最后解决了吗?

@hpc203
Copy link

hpc203 commented Apr 6, 2022

x = torch.cat((box[i], x[i, j + 13, None], x[:, 5:13] ,j[:, None].float()), 1)

改成
x = torch.cat((box[i], x[i, j + 13, None], x[i, 5:13] ,j[:, None].float()), 1)

@neverstoplearn
Copy link

x = torch.cat((box[i], x[i, j + 13, None], x[:, 5:13] ,j[:, None].float()), 1)

改成 x = torch.cat((box[i], x[i, j + 13, None], x[i, 5:13] ,j[:, None].float()), 1)
你好 请问你标签格式是什么样的?是cls cx cy w h x1 y1 x2 y2 x3 y3 x4 y4吗 谢谢。

@Jinkham
Copy link
Member

Jinkham commented Jun 29, 2022

@neverstoplearn 是的

@neverstoplearn
Copy link

@neverstoplearn 好的 谢谢

@maikelaolin
Copy link

x = torch.cat((box[i], x[i, j + 13, None], x[:, 5:13] ,j[:, None].float()), 1)

改成 x = torch.cat((box[i], x[i, j + 13, None], x[i, 5:13] ,j[:, None].float()), 1)

你好换成你说的这个之后所有的mAP AP都是0

@maikelaolin
Copy link

Starting training for 300 epochs...

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 0/299     3.91G     0.059   0.01828   0.02349      0.12    0.2208         6       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:52<00:00,  1.82it/s]

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 1/299     3.92G   0.05078   0.01312   0.01976   0.09381    0.1775         2       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:50<00:00,  1.89it/s]

 Epoch   gpu_mem       box       obj       cls  landmark     total   targets  img_size
 2/299     3.92G   0.05082   0.01197   0.01861   0.09338    0.1748         2       640: 100%|█████████████████████████████████████████████████████████████████████| 95/95 [00:48<00:00,  1.96it/s]
           Class      Images     Targets           P           R      [email protected]  [email protected]:.95:   0%|                                                                            | 0/10 [00:00<?, ?it/s]

Traceback (most recent call last): File "train.py", line 516, in train(hyp, opt, device, tb_writer, wandb) File "train.py", line 349, in train log_imgs=opt.log_imgs if wandb else 0) File "/home/wyw/License-Plate-Detector/test.py", line 121, in test output = non_max_suppression_plate(inf_out, conf_thres=conf_thres, iou_thres=iou_thres, labels=lb) File "/home/wyw/License-Plate-Detector/utils/general.py", line 424, in non_max_suppression_plate x = torch.cat((box[i], x[i, j + 13, None], x[:, 5:13] ,j[:, None].float()), 1) RuntimeError: Sizes of tensors must match except in dimension 0. Got 2016 and 3248 (The offending index is 2)

你好请问解决了吗

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

6 participants