LeslieZhoa / tensorflow-MTCNN

人脸检测MTCNN算法,采用tensorflow框架编写,从理解到训练,中文注释完全,含测试和训练,支持摄像头
364 stars 141 forks source link

hard_example转换问题 #9

Open djjandXMU opened 5 years ago

djjandXMU commented 5 years ago

请问楼主,你在util函数中,convert_to_square子函数转换为更大正方形极有可能超出图像索引,请问这样是否正确?

LeslieZhoa commented 5 years ago

Hi @djjandXMU 确实会有可能超出, https://github.com/LeslieZhoa/tensorflow-MTCNN/blob/d017494a63955cd68887f1d48e245ef78d6ff488/preprocess/gen_hard_example.py#L130 此处会去除掉超出的框

lunar-r commented 5 years ago

你好!@djjandXMU问一下hard_example训练o_net网络时有没有出现以下报错?麻烦解答一下,谢谢。 lunar@lunar-virtual-machine:~/PycharmProjects/tensorflow_mtcnn/preprocess$ python gen_hard_example.py 24 2019-05-12 09:33:06.690596: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 载入数据 8247it [2:47:10, 1.26it/s]Traceback (most recent call last): File "gen_hard_example.py", line 193, in main(parse_arguments(sys.argv[1:])) File "gen_hardexample.py", line 70, in main detectors,=mtcnn_detector.detect_face(test_data) File "../detection/MtcnnDetector.py", line 87, in detect_face boxes, boxes_c, landmark = self.detect_rnet(im, boxes_c) File "../detection/MtcnnDetector.py", line 181, in detect_rnet clsscores, reg, = self.rnet_detector.predict(cropped_ims) File "../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

djjandXMU commented 5 years ago

你好,我没有出现这个问题。我是在ubuntu上运行的。直接在命令行输入作者给的代码即可

------------------ 原始邮件 ------------------ 发件人: "mmcgg"notifications@github.com; 发送时间: 2019年5月12日(星期天) 晚上8:59 收件人: "LeslieZhoa/tensorflow-MTCNN"tensorflow-MTCNN@noreply.github.com; 抄送: "沐雨弟"2712316242@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [LeslieZhoa/tensorflow-MTCNN] hard_example转换问题 (#9)

你好!@djjandXMU问一下hard_example训练o_net网络时有没有出现以下报错?麻烦解答一下,谢谢。 lunar@lunar-virtual-machine:~/PycharmProjects/tensorflow_mtcnn/preprocess$ python gen_hard_example.py 24 2019-05-12 09:33:06.690596: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 载入数据 8247it [2:47:10, 1.26it/s]Traceback (most recent call last): File "gen_hard_example.py", line 193, in main(parse_arguments(sys.argv[1:])) File "gen_hardexample.py", line 70, in main detectors,=mtcnn_detector.detect_face(test_data) File "../detection/MtcnnDetector.py", line 87, in detect_face boxes, boxes_c, landmark = self.detect_rnet(im, boxes_c) File "../detection/MtcnnDetector.py", line 181, in detect_rnet clsscores, reg, = self.rnet_detector.predict(cropped_ims) File "../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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lunar-r commented 5 years ago

谢谢啦!我是在Ubuntu下pycharm环境下用命令运行的,p_net、r_net都可以正常生成数据

lwihtittlee commented 4 years ago

array

我也遇到了同样的问题,请问您解决了吗?

djjandXMU commented 4 years ago

直接用即可,代码没有出错。

------------------ 原始邮件 ------------------ 发件人: "ZJUWLAN"<notifications@github.com>; 发送时间: 2019年11月20日(星期三) 下午3:04 收件人: "LeslieZhoa/tensorflow-MTCNN"<tensorflow-MTCNN@noreply.github.com>; 抄送: "沐雨弟"<2712316242@qq.com>; "Mention"<mention@noreply.github.com>; 主题: Re: [LeslieZhoa/tensorflow-MTCNN] hard_example转换问题 (#9)

array

我也遇到了同样的问题,请问您解决了吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

long2double commented 4 years ago

我也遇到同样的问题了,请问具体怎么解决的?

djjandXMU commented 4 years ago

没有问题,虽然是负的,最后通过max(x,0)操作就会归于零,注意看代码后面部分  

------------------ 原始邮件 ------------------ 发件人: "魇魇"<notifications@github.com>; 发送时间: 2019年12月19日(星期四) 上午10:48 收件人: "LeslieZhoa/tensorflow-MTCNN"<tensorflow-MTCNN@noreply.github.com>; 抄送: "沐雨弟"<2712316242@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [LeslieZhoa/tensorflow-MTCNN] hard_example转换问题 (#9)

我也遇到同样的问题了,请问具体怎么解决的?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ztfmars commented 4 years ago

array

我也遇到了同样的问题,请问您解决了吗?

调试代码之后发现, num_boxes=np.sum(np.where((np.minimum(tmpw,tmph)>=delete_size),ones,zeros))这里返回的num_boxes为0,所以产生了上述错误。

这个感觉应该是好多在win10上跑的小伙伴才会有的问题吧,可以在添加在MtcnnDetector.py的detect_rnet(self,im,dets)里面,修改如下:

在上述代码(num_boxes=np.sum(np.where((np.minimum(tmpw,tmph)>=delete_size),ones,zeros)))下面增加一行 if num_boxes == 0: return None, None, None 即可。 希望可以帮到后续的同学