License-Plate-Detector icon indicating copy to clipboard operation
License-Plate-Detector copied to clipboard

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

Open Aruen24 opened this issue 2 years ago • 7 comments

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 avatar Feb 16 '22 07:02 Aruen24

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

panda-lab avatar Mar 16 '22 13:03 panda-lab

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)

hpc203 avatar Apr 06 '22 02:04 hpc203

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吗 谢谢。

neverstoplearn avatar Jun 28 '22 07:06 neverstoplearn

@neverstoplearn 是的

Jinkham avatar Jun 29 '22 02:06 Jinkham

@neverstoplearn 好的 谢谢

neverstoplearn avatar Jun 29 '22 06:06 neverstoplearn

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 avatar Apr 09 '24 04:04 maikelaolin

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)

你好请问解决了吗

maikelaolin avatar Apr 09 '24 04:04 maikelaolin