Pyramidbox.pytorch icon indicating copy to clipboard operation
Pyramidbox.pytorch copied to clipboard

运行wider_test.py遇到的问题

Open 1529046970 opened this issue 6 years ago • 6 comments

您好,谢谢您提供的代码!我在测试时遇到问题。detect到第1241张图片后traceback,在调用wider_test.py下的bbox_vote函数时,没有进入while循环(报错:UnboundLocalError:local variable 'dets' referenced before assignment),您可以对我的遇到的错误给一些意见吗?谢谢!

1529046970 avatar Apr 10 '19 13:04 1529046970

报错的原因是因为没有检测到人脸框,所以会报错,你可以写一个判断机制,如果det.shape[0]==0返回一个一维全是0 的det,比如dets = np.array([0,0,0,0,0])的代码,这样就不会出现dets没有被赋值了

yxlijun avatar Apr 10 '19 13:04 yxlijun

非常感谢您的回复!我按照您建议的方法试了一下,在bbox_vote()中加入了判断,发现还是报一样的错,我尝试在while中输出信息,发现在traceback之前,进入了一次while循环。您可以帮我看一下是哪里出了问题吗?再次谢谢您! IMG_2866

1529046970 avatar Apr 11 '19 05:04 1529046970

我找到问题原因,得到了正确结果!谢谢了!

1529046970 avatar Apr 11 '19 11:04 1529046970

麻烦问一下,我出现了和你一样的错误,请问你是如何结局的呢,谢谢 @1529046970

Xu-jingjing avatar Apr 12 '19 09:04 Xu-jingjing

bbox_vote()中加入了判断,det.shape[0]==1时,就直接返回det

1529046970 avatar Apr 12 '19 09:04 1529046970

bbox_vote()中if merge_index.shape[0] <= 1:可改为<,不然可能会报错

zhaoxin111 avatar Apr 29 '20 06:04 zhaoxin111