{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Facial Recognition and Alignment\n## What's this?\n\nThis repository contains a refactored implementation of David Sandberg's [FaceNet](https://github.com/davidsandberg/facenet) and [InsightFace](https://github.com/deepinsight/insightface) for facial recognition. It also contains an implementation of [MTCNN](https://github.com/ipazc/mtcnn) and [Faceboxes](https://github.com/TropComplique/FaceBoxes-tensorflow) for face cropping and alignment. What is in the refactor:\n\n- Made algorithms easily and efficiently usable with [convenience classes](https://github.com/armanrahman22/facenet/tree/master/facenet_sandberg/inference). \n- Added much more efficient methods of batch processing face recognition and alignment\n- Added true face alignment (with affine transformation) to align face to bottom-center of image: [code](https://github.com/armanrahman22/facenet/blob/f6cb32a193925002da41fb491c52bb85384bee55/facenet_sandberg/utils.py#L187)\n- Added proportional margin to alignment as per this [issue](https://github.com/davidsandberg/facenet/issues/283)\n- Ability to easily switch between [insightface](https://github.com/armanrahman22/facenet/blob/master/facenet_sandberg/inference/insightface_encoder.py) and [facenet](https://github.com/armanrahman22/facenet/blob/master/facenet_sandberg/inference/facenet_encoder.py) at [inference time](https://github.com/armanrahman22/facenet/blob/master/facenet_sandberg/inference/identifier.py)\n\nMore information on customizing and implementing new face detection algorithms can be found [here](./algorithms/README.md).\n\n## Installation\nTo use in other projects, this implementation can be pip installed as follows:\n```\npip install facenet_sandberg\n```\n\nTo use locally:\n1. Clone repo\n2. cd to base directory with setup.py \n3. run:\n```\npip install -e .\n```\n^(installs package in [development mode](https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode))\n\n## Important Requirements\n1. Python 3.5 \n2. Tensorflow==1.7\n3. Tensorlayer==1.7\nThe rest is specified in [requirements.txt](https://github.com/armanrahman22/facenet/blob/master/requirements.txt)\n\n## Models\nLinks to pretrained models: \n\n- [Facenet](https://redcrossstorage.blob.core.windows.net/images/facenet_model.pb)\n - Uses RGB images of size 160x160\n- [Insightface.zip](https://redcrossstorage.blob.core.windows.net/images/insightface_ckpt.zip)\n - Uses BGR images of size 112x112\n\n## Datasets\nLinks to download training datasets (!big files!):\n\n- [Emore](https://redcrossstorage.blob.core.windows.net/datasets/faces_emore.zip) \n- [MSM_refined_112x112](https://redcrossstorage.blob.core.windows.net/datasets/faces_ms1m-refine-v2_112x112.zip)\n- [VGG2_112x112](https://redcrossstorage.blob.core.windows.net/datasets/faces_vgg2_112x112.zip)\n\n## Image directory structure\nThis repo assumes images are in [LFW format](http://vis-www.cs.umass.edu/lfw/README.txt):\n```\n-/base_images_folder\n -/person_1\n -person_1_0001.jpg\n -person_1_0002.jpg\n -person_1_0003.jpg\n -/person_2\n -person_2_0001.jpg\n -person_2_0002.jpg\n ...\n```\n\nIf your dataset is not like this you can use [lfw.py](https://github.com/armanrahman22/facenet/blob/master/facenet_sandberg/lfw.py) to put your images into the right format like so (from facenet_sandberg/facenet_sandberg):\n```\npython lfw.py --image_directory PATH_TO_YOUR_BASE_IMAGE_DIRECTORY\n```\n\n## Alignment\nAlignment is done with a combination of Faceboxes and MTCNN. While Faceboxes is more accurate and works with more images than MTCNN, it does not return [facial landmarks](https://raw.githubusercontent.com/ipazc/mtcnn/master/result.jpg). Whichever algorithm returns more results is used.\n\nUse the [align_dataset.py](https://github.com/armanrahman22/facenet/blob/master/facenet_sandberg/align_dataset.py) script to align an entire image directory:\n```\npython align_dataset.py --input_dir PATH_TO_YOUR_BASE_IMAGE_DIRECTORY \\\n --output_dir PATH_TO_OUTPUT_ALIGNED_IMAGES \\\n --facenet_model_checkpoint PATH_TO_PRETRAINED_FACENET_MODEL \\\n --image_height DESIRED_IMAGE_HEIGHT \\\n --image_width DESIRED_IMAGE_WIDTH \\\n --margin DESIRED_PROPORTIONAL_MARGIN \\\n --scale_factor DESIRED_SCALE_FACTOR \\\n --steps_threshold DESIRED_STEPS \\\n --detect_multiple_faces \\\n --use_faceboxes \\\n --use_affine \\\n --num_processes NUM_PROCESSES_TO_USE\n```\n* Default values for most arguments are provided [here](https://github.com/armanrahman22/facenet/blob/f6cb32a193925002da41fb491c52bb85384bee55/facenet_sandberg/align_dataset.py#L262) \n\n## Generate Pairs.txt\nA pairs.txt file is used in training and testing. It follows this [format](http://vis-www.cs.umass.edu/lfw/README.txt). In order to generate your own pairs.txt run:\n```\npython align_dataset.py --image_dir PATH_TO_YOUR_BASE_IMAGE_DIRECTORY \\\n --pairs_file_name OUTPUT_NAME_OF_PAIRS_FILE \\\n --num_folds NUMBER_OF_FOLDS_FOR_CROSS_VALIDATION \\\n --num_matches_mismatches NUMBER_OF_MATCHES_AND_MISMATCHES\n```\n\n## Copyright\nMIT License from original repo https://github.com/davidsandberg/facenet/blob/master/LICENSE.md", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/armanrahman22/facenet", "keywords": "", "license": "MIT", "maintainer": "Arman Rahman", "maintainer_email": "armanrahman22@gmail.com", "name": "facenet-sandberg", "package_url": "https://pypi.org/project/facenet-sandberg/", "platform": "", "project_url": "https://pypi.org/project/facenet-sandberg/", "project_urls": { "Homepage": "https://github.com/armanrahman22/facenet" }, "release_url": "https://pypi.org/project/facenet-sandberg/0.0.8/", "requires_dist": null, "requires_python": ">=3.4", "summary": "Face recognition using TensorFlow", "version": "0.0.8" }, "last_serial": 4470049, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ea43a58af990f318cc644f834d0dc65b", "sha256": "176c614a5a0504bf9830dcaa69168d171e3dcb471987b947fad1b30b98d0477d" }, "downloads": -1, "filename": "facenet_sandberg-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ea43a58af990f318cc644f834d0dc65b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2058319, "upload_time": "2018-11-05T08:23:00", "url": "https://files.pythonhosted.org/packages/57/66/7ac8ba6ed3ca1ec37ecd24a9c9fbae0a2c10ff6c8923dfd5042dc31a6ced/facenet_sandberg-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5bf8dbd97b990c4d51f556d184cc8b17", "sha256": "a8f563aa720a20b582fb847bcb80bd84f29396e7eb23f67ee5c133424e5e928b" }, "downloads": -1, "filename": "facenet_sandberg-0.0.1.tar.gz", "has_sig": false, "md5_digest": "5bf8dbd97b990c4d51f556d184cc8b17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 66159, "upload_time": "2018-11-05T08:23:02", "url": "https://files.pythonhosted.org/packages/90/2a/f98454d085a46f1e969d1a10c8ceb20ae600f5e15ea78a6fdb84f16ecda4/facenet_sandberg-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e7f162145f6fa971cb3e631361be60ed", "sha256": "009eb795f095ba186103990ee85e0e789e3dcc37799faae9c26685eccd4548ae" }, "downloads": -1, "filename": "facenet_sandberg-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e7f162145f6fa971cb3e631361be60ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 74179, "upload_time": "2018-11-07T16:34:06", "url": "https://files.pythonhosted.org/packages/b4/83/fa1aa4383e34716d4f44192a502291057413241dd3c3c0b5b1234edea2b9/facenet_sandberg-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "128318b970c458e9d5ac84ec774943e2", "sha256": "e40d2591ecaba7a65c5bd57a6c609ab9153ba258eb81a1c0b2e7939c4850b1ee" }, "downloads": -1, "filename": "facenet_sandberg-0.0.3.tar.gz", "has_sig": false, "md5_digest": "128318b970c458e9d5ac84ec774943e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 74215, "upload_time": "2018-11-07T16:56:09", "url": "https://files.pythonhosted.org/packages/fb/d7/80805a27d10baab304860576961725614418130933c04ab61e2fb8afc280/facenet_sandberg-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "c0f6e1e36d63d2acd3c876091df29374", "sha256": "f65e75c5cc86c0842a0afe050e5a8f09b0722bc4d789344fb646027abd57a5c8" }, "downloads": -1, "filename": "facenet_sandberg-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c0f6e1e36d63d2acd3c876091df29374", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 74495, "upload_time": "2018-11-08T10:08:12", "url": "https://files.pythonhosted.org/packages/63/a8/73a7d912dd6c0e84e56aa77045d3db634f54b205ab77b9d8f62bdbaac6b7/facenet_sandberg-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "37f20359ea80fc8bd84233f6cb0d7589", "sha256": "51b3c5fce08ae539291c4ce6bc21dd9debfcd6c5b2794ec837a26c74ac4e7181" }, "downloads": -1, "filename": "facenet_sandberg-0.0.5.tar.gz", "has_sig": false, "md5_digest": "37f20359ea80fc8bd84233f6cb0d7589", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 33784, "upload_time": "2018-11-09T12:09:57", "url": "https://files.pythonhosted.org/packages/6c/8b/b2f364a236260e70e48a07de93e7da51707bff6ee84c27c8ccadeae984f0/facenet_sandberg-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "246a0f24513aa7134758a8c61aa961f1", "sha256": "0757c21fc4c955da5351922a234ac300b09a4f87b60684fb27d4e8b2529ce643" }, "downloads": -1, "filename": "facenet_sandberg-0.0.6.tar.gz", "has_sig": false, "md5_digest": "246a0f24513aa7134758a8c61aa961f1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 44370, "upload_time": "2018-11-09T13:47:50", "url": "https://files.pythonhosted.org/packages/87/a7/fd8533ba73704b0805ae7050a47a9025355fec95ca0047e93c66fd016442/facenet_sandberg-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "d848a25d6377466a05988d83a14a25ec", "sha256": "fb5f164a42681553bf4da7546ccd4d91ee15cda2aee2e052c22ecec885c2704d" }, "downloads": -1, "filename": "facenet_sandberg-0.0.7.tar.gz", "has_sig": false, "md5_digest": "d848a25d6377466a05988d83a14a25ec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 42644, "upload_time": "2018-11-09T15:34:50", "url": "https://files.pythonhosted.org/packages/e1/23/de9de693401cc3bc5e352a3e63fff4bbdbe1c6b387e856d3b73eb4629253/facenet_sandberg-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "1584912265b6c3ed9e45eda2a339a16e", "sha256": "57924a03f8ecdf034e105055fd67f33a08172060718aeb3edee063358bc8a35e" }, "downloads": -1, "filename": "facenet_sandberg-0.0.8.tar.gz", "has_sig": false, "md5_digest": "1584912265b6c3ed9e45eda2a339a16e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 42792, "upload_time": "2018-11-09T16:30:59", "url": "https://files.pythonhosted.org/packages/5a/f4/bbe35ad554c4e3bfd1957d38493d73344c2f25b45b85e9db15b09ef33ad0/facenet_sandberg-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1584912265b6c3ed9e45eda2a339a16e", "sha256": "57924a03f8ecdf034e105055fd67f33a08172060718aeb3edee063358bc8a35e" }, "downloads": -1, "filename": "facenet_sandberg-0.0.8.tar.gz", "has_sig": false, "md5_digest": "1584912265b6c3ed9e45eda2a339a16e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 42792, "upload_time": "2018-11-09T16:30:59", "url": "https://files.pythonhosted.org/packages/5a/f4/bbe35ad554c4e3bfd1957d38493d73344c2f25b45b85e9db15b09ef33ad0/facenet_sandberg-0.0.8.tar.gz" } ] }