FaceMaskDetection icon indicating copy to clipboard operation
FaceMaskDetection copied to clipboard

ValueError: operands could not be broadcast together with shapes

Open GJXS1980 opened this issue 5 years ago • 4 comments

在Ubuntu系统下面测试pytorch_infer调用摄像头会遇到下面的报错: FaceMaskDetection/utils/anchor_decode.py", line 21, in decode_bbox predict_center_x = raw_outputs_rescale[:, :, 0:1] * anchors_w + anchor_centers_x ValueError: operands could not be broadcast together with shapes (1,5456,1) (1,11000,1)

GJXS1980 avatar Apr 15 '20 14:04 GJXS1980

在Ubuntu系统下面测试pytorch_infer调用摄像头会遇到下面的报错: FaceMaskDetection/utils/anchor_decode.py", line 21, in decode_bbox predict_center_x = raw_outputs_rescale[:, :, 0:1] * anchors_w + anchor_centers_x ValueError: operands could not be broadcast together with shapes (1,5456,1) (1,11000,1)

因为目标的尺寸不正确, 参考image inference, 将target_shape改为(360, 360)

AlgoJay1991 avatar Apr 16 '20 03:04 AlgoJay1991

是的,这个代码将输入限定到(260, 260)了。如果您要用360,需要将anchor size也改成对应的大小, feature_map_sizes = [[33, 33], [17, 17], [9, 9], [5, 5], [3, 3]] 改成 feature_map_sizes = [[45, 45], [23, 23], [12, 12], [6, 6], [3, 3]] 不过不一定能保证效果,因为训练的时候没有做多尺度训练。

AIZOOTech avatar Apr 16 '20 10:04 AIZOOTech

是的,这个代码将输入限定到(260, 260)了。如果您要用360,需要将anchor size也改成对应的大小, feature_map_sizes = [[33, 33], [17, 17], [9, 9], [5, 5], [3, 3]] 改成 feature_map_sizes = [[45, 45], [23, 23], [12, 12], [6, 6], [3, 3]] 不过不一定能保证效果,因为训练的时候没有做多尺度训练。

大神, 我测了一下人脸的检测效果不是很好, 但是口罩带没带判断的很准确. PS : 训练的代码能开源么?

AlgoJay1991 avatar Apr 16 '20 10:04 AlgoJay1991

如果有需要,可以添加我们的微信小助手AIZOOTech沟通。 @haige-algo

AIZOOTech avatar Apr 16 '20 13:04 AIZOOTech