yolor icon indicating copy to clipboard operation
yolor copied to clipboard

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

Open LaoGanGit opened this issue 3 years ago • 9 comments

作者你好,我在运行我自己的数据集,到了最后一个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的曲线图

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

LaoGanGit avatar Jul 23 '21 08:07 LaoGanGit

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

WongKinYiu avatar Jul 24 '21 01:07 WongKinYiu

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

好的,非常感谢您的解答

LaoGanGit avatar Jul 25 '21 01:07 LaoGanGit

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

LaoGanGit avatar Jul 25 '21 08:07 LaoGanGit

hello

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

Hu-nie avatar Aug 08 '21 06:08 Hu-nie

I solved this problem.

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

Hu-nie avatar Aug 08 '21 07:08 Hu-nie

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

wgggSg avatar Sep 03 '21 02:09 wgggSg

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

francescotaioli avatar Sep 29 '21 15:09 francescotaioli

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

x-yy0 avatar Apr 22 '22 06:04 x-yy0