WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.98k stars 524 forks source link

关于plot_images的索引超出范围的问题 #52

Open LaoGanGit opened 2 years ago

LaoGanGit commented 2 years ago

作者你好,我在运行我自己的数据集,到了最后一个epoch时,出现了下面的错误 Traceback (most recent call last): File "F:/jinyuan/yolor-main/train.py", line 537, in train(hyp, opt, device, tb_writer, wandb) File "F:/jinyuan/yolor-main/train.py", line 344, in train log_imgs=opt.log_imgs if wandb else 0) File "F:\jinyuan\yolor-main\test.py", line 226, in test plot_images(img, output_to_target(output, width, height), paths, f, names) # predictions File "F:\jinyuan\yolor-main\utils\plots.py", line 163, in plot_images cls = names[cls] if names else cls IndexError: list index out of range 因为这个问题,导致最后在run里面少了很多图片,没有mAp的曲线图

请教,这是什么原因导致的呢,有何解决的方法,谢谢

WongKinYiu commented 2 years ago

https://github.com/WongKinYiu/yolor/blob/main/test.py#L312 這裡要改成您的names fiile

LaoGanGit commented 2 years ago

https://github.com/WongKinYiu/yolor/blob/main/test.py#L312 這裡要改成您的names fiile

好的,非常感谢您的解答

LaoGanGit commented 2 years ago

https://github.com/WongKinYiu/yolor/blob/main/test.py#L312 這裡要改成您的names fiile 作者您好,我按您的建议修改了下还是出现原来的错误,您看下我这个自定的names.file和yaml有问题吗? 是否除了test.py的names修改外还有哪些跟着修改呢? 另外detect.py#176的names我也修改成跟test.py一样的路径和内容了 1627202452(1) image image image

Hu-nie commented 2 years ago

hello

I have the same problem. Did you figure it out?

Hu-nie commented 2 years ago

I solved this problem.

https://github.com/WongKinYiu/yolor/pull/17

wgggSg commented 2 years ago

请问你解决掉这个问题了吗?我也遇到了相同的问题

francescotaioli commented 2 years ago

I also have this problem even if I create a custom data.names file with the correct label

x-yy0 commented 2 years ago

I have the same problem. Did you figure it out?

WenTianWuHuo commented 1 week ago

You need to change the. cfg file you are using, changing 'classes=80' to 'classes=yours classes' and' filters=225 'to' filters=(5+yours classes) * 3 '.