Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于输入大小和retinaface 的问题 #7

Closed
wangergou135 opened this issue Oct 13, 2019 · 16 comments
Closed

关于输入大小和retinaface 的问题 #7

wangergou135 opened this issue Oct 13, 2019 · 16 comments

Comments

@wangergou135
Copy link

想问下我的理解对不对:
1.wider face的结果,这里提到的input 320240 和 640480是专指训练的时候的大小吗,inference的时候直接输入原图对吧?
2.mobilenev1_0.25版的retinaface先按照640*480的训练,再在原图上inference得到 0.879 | 0.807 | 0.481的结果吗?

@Linzaer
Copy link
Owner

Linzaer commented Oct 13, 2019

用640x480输入推理

@Linzaer
Copy link
Owner

Linzaer commented Oct 13, 2019

我测的是固定中小输入下的精度,现实场景一般都是固定大小输入,比如320或者640

@wangergou135
Copy link
Author

@Linzaer
wider face测试的图片和./imgs目录下的图片不是固定输入大小,detect_img.py run_video_face_detect.py里并没有resize操作而是直接读取图片再predict。
所以我不太明白的是,用640*480的输入推理是怎么在wider face和./imgs目录下的图片进行推理的?

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@yushanhu12345 有resize的哦,在PredictionTransform里,封装到预处理里了

@wangergou135
Copy link
Author

@Linzaer
哦,明白了!
难怪很多大图识别效果不好,准备尝试一下把大图crop出几个vga的tile分别predict,效果应该会好不少

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@yushanhu12345 可以尝试修改图片输入大小,比如detect_imgs.py里面修改开头第11行的input_img_size,可以适当加大,默认提供(128/160/320/480/640/1280)这几个输入可选。同时如果你想识别大图小人脸场景,建议使用 Mb_Tiny_RFB_FD_train_input_640.pth这个模型,是用640x480训练的,更加适合大分辨率输入,误报低。

@wangergou135
Copy link
Author

@Linzaer
自己训练的一些模型和你这个模型,好像都有个问题,就是用大分辨率训练的模型,误检少,对小脸的recall低,
用小分辨率训练的模型,误检多,对小脸的recall高。
刚用Mb_Tiny_RFB_FD_train_input_320.pth和Mb_Tiny_RFB_FD_train_input_640.pth测试过,其他条件都一样(输入640×480的图片,从原图上crop, threshold=0.3)

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@yushanhu12345 一般来说是都这样的,应该是不同大小输入训练的感受野对应原图大小区域的问题。

@Jay-Liu
Copy link

Jay-Liu commented Oct 14, 2019

来围观一下大神@-@

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@Jay-Liu 没没没,我也在学习中,也都是在其他大佬的肩膀上玩,开源就是和大家互相交流学习哈~

@leiyu1980
Copy link

可以说说训练这个检测器的心得嘛。效果确实不错,速度也快。

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@leiyu1980 调参压榨结构,炼丹

@nttstar
Copy link

nttstar commented Oct 14, 2019

问一下anchor是如何设置的?

@Linzaer
Copy link
Owner

Linzaer commented Oct 14, 2019

@nttstar 大佬好~anchor设计参考了于老师的libfacedetection,四分支3/2/2/3个数配比正方形,加强小人脸和大人脸能力。320x240输入得到的四个feature尺寸(40,20,10,5),然后8*n关系设置大小,每层2倍增加。我也用check_gt_box.py得到训练集的尺寸分布调整过数值,效果差不多。

Repository owner deleted a comment from Jay-Liu Oct 14, 2019
@Linzaer Linzaer closed this as completed Oct 14, 2019
@tfygg
Copy link

tfygg commented Oct 16, 2019

有个疑惑,如上代码是crop出一个h=w的正方形图像,数据扩展也没有padding的过程,那这样在直接resize后人脸会有形变呀。

@Linzaer
Copy link
Owner

Linzaer commented Oct 16, 2019

@tfygg 你好,由于人脸主要贴近正方形,所以选的纵横比是1,但是能等于1 的时候几率是非常低的,几乎不会进入下面的randomcrop,所以绝大部分数据几乎是原图,而且如果等于1,resize一定的形变也是可以接受的,因为即使有Expand,当randomcrop出小区域的不同比例的时候,resize之后也是会形变的。由于模型比较小,所以没采用Expand去扩展原图来加强小人脸检出能力,测试调参发现去掉Expand效果会好点,可能是原本数据集的小人脸就已经足够去拟合了。不过这是我的测试结果和想法,你也可以去调参试试~期待更好的结果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants