{"id":19195092,"url":"https://github.com/ksachdeva/opencv-mtcnn","last_synced_at":"2025-05-08T23:02:24.084Z","repository":{"id":61578704,"uuid":"130436685","full_name":"ksachdeva/opencv-mtcnn","owner":"ksachdeva","description":"An implementation of MTCNN Face detector using OpenCV's DNN module","archived":false,"fork":false,"pushed_at":"2020-06-03T16:16:59.000Z","size":2198,"stargazers_count":68,"open_issues_count":7,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T14:09:45.770Z","etag":null,"topics":["dnn","face-detection","inference","mtcnn","opencl","opencv","opencv-dnn"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksachdeva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-21T03:33:16.000Z","updated_at":"2024-09-26T03:06:21.000Z","dependencies_parsed_at":"2022-10-19T13:15:31.040Z","dependency_job_id":null,"html_url":"https://github.com/ksachdeva/opencv-mtcnn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fopencv-mtcnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fopencv-mtcnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fopencv-mtcnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fopencv-mtcnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksachdeva","download_url":"https://codeload.github.com/ksachdeva/opencv-mtcnn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160765,"owners_count":21863627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dnn","face-detection","inference","mtcnn","opencl","opencv","opencv-dnn"],"created_at":"2024-11-09T12:08:19.200Z","updated_at":"2025-05-08T23:02:24.032Z","avatar_url":"https://github.com/ksachdeva.png","language":"C++","readme":"# opencv-mtcnn\n\nThis is an inference implementation of MTCNN (Multi-task Cascaded Convolutional Network) to perform Face Detection and Alignment using OpenCV's DNN module.\n\n## MTCNN\n\n[ZHANG2016] Zhang, K., Zhang, Z., Li, Z., and Qiao, Y. (2016). Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 23(10):1499–1503.\n\nhttps://kpzhang93.github.io/MTCNN_face_detection_alignment/paper/spl.pdf\n\n## OpenCV's DNN module\n\nSince OpenCV 3.1 there is a module called DNN that provides the inference support. The module is capable of taking models \u0026 weights from various popular frameworks such as Caffe, tensorflow, darknet etc.\n\nYou can read more about it here - https://github.com/opencv/opencv/wiki/Deep-Learning-in-OpenCV\n\nNote that at present there is no support to perform training in OpenCV's DNN module and if I understood correctly there is no intention either.\n\n## Compile / Run\n\n### Requirements\n\n* OpenCV 3.4+\n* Boost FileSystem (1.58+)  [only required for the sample application]\n* CMake 3.2+\n\nI am using CMake as the build tool. Here are the steps to try the implementation -\n\n```bash\n# compiling the library and the sample application\ngit clone https://github.com/ksachdeva/opencv-mtcnn\ncd opencv-mtcnn\nmkdir build\ncd build\ncmake ..\ncmake --build .\n```\n\n```bash\n# running the sample application\ncd build\n./sample/app \u003cpath_to_models_dir\u003e \u003cpath_to_test_image\u003e\n\n# here are some example cmd lines to run with the model and images in the test repository\n\n# An image with 0 human faces (have picture of 4 dogs)\n./sample/app ../data/models ../data/dogs.jpg\n\n# An image with 1 face\n./sample/app ../data/models ../data/Aaron_Peirsol_0003.jpg\n\n# An image with 7 faces\n./sample/app ../data/models ../data/2007_007763.jpg\n```\n\n## Result\n\nHere is an example of how the execution of the sample application looks like\n\n![Result](data/2007_007763_result.jpg)\n\n## Acknowledgments\n\nMost of the implementations of MTCNN are based on either Caffe or Tensorflow. I wanted to play with OpenCV's DNN implementation and understand the paper bit better. While implementing it, I looked at various other C++ implementations (again all of them use Caffe) and more specifically borrowed utilities from https://github.com/golunovas/mtcnn-cpp. IMHO, I found his implementation (in C++) that is based on Caffe to be the cleanest amongst many others.\n\nThe model files are taken from https://github.com/kpzhang93/MTCNN_face_detection_alignment/tree/master/code\n\nThe image file \"Aaron_Peirsol_0003.jpg\" is from the LFW database (http://vis-www.cs.umass.edu/lfw/)\n\nThe image files \"dog.jpg\" \u0026 \"2007_007763.jpg\" are from dlib's github repository (https://github.com/davisking/dlib/blob/master/examples/faces)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksachdeva%2Fopencv-mtcnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksachdeva%2Fopencv-mtcnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksachdeva%2Fopencv-mtcnn/lists"}