ValueError: need at least one array to concatenate

最近研究MTCNN算法,在运行gen_hard_example.py时因为将阈值[0.6,0.7,0.7]修改成[0.5,0.5,0.3]之后,执行某张训练图像时,返回
Traceback (most recent call last):
File “gen_hard_example.py”, line 193, in
main(parse_arguments(sys.argv[1:]))
File “gen_hard_example.py”, line 70, in main
detectors,_=mtcnn_detector.detect_face(test_data)
File “/home/xxx/tensorflow-MTCNN-master/detection/MtcnnDetector.py”, line 87, in detect_face
boxes, boxes_c, landmark = self.detect_rnet(im, boxes_c)
File “/home/xxx/tensorflow-MTCNN-master/detection/MtcnnDetector.py”, line 180, in detect_rnet
cls_scores, reg, _ = self.rnet_detector.predict(cropped_ims)
File “/home/xxx/tensorflow-MTCNN-master/detection/detector.py”, line 63, in predict
return np.concatenate(cls_prob_list, axis=0), np.concatenate(bbox_pred_list, axis=0), np.concatenate(landmark_pred_list, axis=0)
ValueError: need at least one array to concatenate

调试代码之后发现, num_boxes=np.sum(np.where((np.minimum(tmpw,tmph)>=delete_size),ones,zeros))这里返回的num_boxes为0,所以产生了上述错误。
solution:在上述代码下面增加一行
if num_boxes == 0:
return None, None, None
即可。ps:相关代码的缩进要注意修改。

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值