后台小程序开发的全方位指南
992
2022-10-31
Tensorflow小型人脸检测器,实现“查找微小的面孔”
Tiny Face Detector in TensorFlow
A TensorFlow port(inference only) of Tiny Face Detector from authors' MatConvNet codes[1].
Requirements
Codes are written in python. At first install Anaconda. Then install OpenCV, TensorFlow.
Usage
Converting a pretrained model
matconvnet_hr101_to_pickle reads weights of the MatConvNet pretrained model and write back to a pickle file which is used in a TensorFlow model as initial weights.
Download a ResNet101-based pretrained model(hr_res101.mat) from the authors' repo. Convert the model to a pickle file by:
python matconvnet_hr101_to_pickle.py --matlab_model_path /path/to/pretrained_model --weight_file_path /path/to/pickle_file
Tesing Tiny Face Detector in TensorFlow
Prepare images in a directory. tiny_face_eval.py reads images one by one from the image directory and write images to an output directory with bounding boxes of detected faces.
python tiny_face_eval.py --weight_file_path /path/to/pickle_file --data_dir /path/to/input_image_directory --output_dir /path/to/output_directory
Neural network diagram
This(pdf) is a network diagram of the ResNet101-based model used here for an input image(height: 1150, width: 2048, channel: 3).
Examples
Though this model is developed to detect tiny faces, I apply this to several types of images including 'faces' as experiments.
selfie with many people
This is the same image as one in the authors' repo[1].
Original image
selfie of celebrities
Original image
selfie of "celebrities"
Homer and "Meryl Streep" are missed.
Original image
zombies
Original image
monkeys
Original image
dogs
Original image
cats
Original image
figure1 from a paper[2]
figure8 from a paper[2].
Facebook's face detector failed to detect these faces(as of the paper publication date[14 Feb 2016]).
figure3 from a paper[2]
figure6 from a paper[2]
Acknowledgments
Many python codes are borrowed from chinakook's MXNet tiny face detectorparula colormap table is borrowed from fake_parula.py.
Disclaimer
Codes are tested only on CPUs, not GPUs.
References
Hu, Peiyun and Ramanan, Deva, Finding Tiny Faces, The IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2017). project page, arXiv Michael J. Wilber, Vitaly Shmatikov, Serge Belongie, Can we still avoid automatic face detection, 2016. arXiv
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~