zeusees / License-Plate-Detector

基于Yolov5车牌检测,更快更准.
http://www.zeusee.com
1.21k stars 400 forks source link

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

Open Aruen24 opened 2 years ago

Aruen24 commented 2 years ago

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      mAP@.5  mAP@.5:.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)

panda-lab commented 2 years ago

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

hpc203 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@neverstoplearn 是的

neverstoplearn commented 2 years ago

@neverstoplearn 好的 谢谢

maikelaolin commented 7 months ago

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 commented 7 months ago

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      mAP@.5  mAP@.5:.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)

你好请问解决了吗