Skip to content

Commit

Permalink
release 1
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lyon committed Jun 4, 2020
1 parent 0c51d44 commit baee67e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# face-comparison
AI Face comparison using FaceNet
AI Face comparison using FaceNet, compare two photos and see if they are the same person.

## Installation
```
pip install face-compare
```

## Usage
Use `compare_faces.py` to compare two images of people to see if they are the same person.
```bash
compare_faces.py --input-one /path/to/image_one.png --input-two /path/to/image_two.png
```

Optionally output the cropped image output to a directory (useful for inspecting input to AI model)
```bash
compare_faces.py --input-one /path/to/image_one.png --input-two /path/to/image_two.png -s /path/to/outputs/
```

## Steps Involved
1. A cascade classifier is used to detect the face within the input images.
2. The bounding box of this segmentation is then used to crop the images, and fed into the AI model.
3. The FaceNet model then calculates the image embeddings for the two cropped images.
4. Finally the second embedding is subtracted from the first, and the Euclidean norm of that vector is calculated.
5. A threshold of 0.7 is used to determine whether they are the same person or not.


## References
This module uses the AI model FaceNet, which can be found [here](https://github.com/davidsandberg/facenet), and the journal article [here](https://arxiv.org/abs/1503.03832).
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#!/usr/bin/env python3
'''Use this to install module'''
from os import path
from setuptools import setup, find_packages

version = '1.0.0'
this_dir = path.abspath(path.dirname(__file__))
with open(path.join(this_dir, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='face_compare',
version='1.0.0',
name='face-compare',
version=version,
description='Compare if two faces are from the same person.',
author='Matt Lyon',
author_email='[email protected]',
url='https://github.com/mattlyon93/face-comparison',
download_url='https://github.com/mattlyon93/face-comparison/archive/v{}.tar.gz'.format(version),
long_description=long_description,
long_description_content_type='text/markdown',
python_requires='>=3.7',
license='MIT License',
packages=find_packages(),
Expand All @@ -22,5 +32,6 @@
'Operating System :: MacOS',
],
scripts=['bin/compare_faces.py'],
keywords=['ai', 'cv', 'computer-vision', 'face-detection'],
include_package_data=True
)

0 comments on commit baee67e

Please sign in to comment.