From ba8b517404db8d40044b43beab73d04dc281af50 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 10 Feb 2024 21:22:29 +0000 Subject: [PATCH] package version added into the interface --- README.md | 4 +++- package_info.json | 3 +++ retinaface/RetinaFace.py | 1 + retinaface/__init__.py | 1 + setup.py | 9 +++++++-- tests/test_package.py | 13 +++++++++++++ 6 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 package_info.json create mode 100644 tests/test_package.py diff --git a/README.md b/README.md index 2505860..0cefe35 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ for face in faces:

+If you prefer to prioritize alignment before detection, you may opt to set the `align_first` parameter to True. By following this approach, you will eliminate the black pixel areas that arise as a result of alignment following detection. This functionality is applicable only when the provided image contains a single face. + **Face Recognition** - [`Demo`](https://youtu.be/WnUVYQP4h44) Notice that face recognition module of insightface project is [ArcFace](https://sefiks.com/2020/12/14/deep-face-recognition-with-arcface-in-keras-and-python/), and face detection module is RetinaFace. ArcFace and RetinaFace pair is wrapped in [deepface](https://github.com/serengil/deepface) library for Python. Consider to use deepface if you need an end-to-end face recognition pipeline. @@ -151,7 +153,7 @@ If you are using RetinaFace in your research, please consider to cite its [origi } ``` -Finally, if you use this RetinaFace re-implementation in your GitHub projects, please add retina-face dependency in the requirements.txt. +Finally, if you use this RetinaFace re-implementation in your GitHub projects, please add `retina-face` dependency in the requirements.txt. ## Licence diff --git a/package_info.json b/package_info.json new file mode 100644 index 0000000..92ca348 --- /dev/null +++ b/package_info.json @@ -0,0 +1,3 @@ +{ + "version": "0.0.15" +} \ No newline at end of file diff --git a/retinaface/RetinaFace.py b/retinaface/RetinaFace.py index f8c109b..48be2e5 100644 --- a/retinaface/RetinaFace.py +++ b/retinaface/RetinaFace.py @@ -6,6 +6,7 @@ import numpy as np import tensorflow as tf +from retinaface import __version__ from retinaface.model import retinaface_model from retinaface.commons import preprocess, postprocess from retinaface.commons.logger import Logger diff --git a/retinaface/__init__.py b/retinaface/__init__.py index e69de29..6561790 100644 --- a/retinaface/__init__.py +++ b/retinaface/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.15" diff --git a/setup.py b/setup.py index 846b3f6..c0710f0 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import json import setuptools with open("README.md", "r", encoding="utf-8") as fh: @@ -6,13 +7,17 @@ with open("requirements.txt", "r", encoding="utf-8") as f: requirements = f.read().split("\n") +with open("package_info.json", "r", encoding="utf-8") as f: + package_info = json.load(f) + + setuptools.setup( name="retina-face", # pip install retina-face - version="0.0.14", + version=package_info["version"], author="Sefik Ilkin Serengil", author_email="serengil@gmail.com", description="RetinaFace: Deep Face Detection Framework in TensorFlow for Python", - data_files=[("", ["README.md", "requirements.txt"])], + data_files=[("", ["README.md", "requirements.txt", "package_info.json"])], long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/serengil/retinaface", diff --git a/tests/test_package.py b/tests/test_package.py new file mode 100644 index 0000000..936f18b --- /dev/null +++ b/tests/test_package.py @@ -0,0 +1,13 @@ +import json +from retinaface import RetinaFace +from retinaface.commons.logger import Logger + +logger = Logger("tests/test_package.py") + + +def test_version(): + with open("./package_info.json", "r", encoding="utf-8") as f: + package_info = json.load(f) + + assert RetinaFace.__version__ == package_info["version"] + logger.info("✅ versions are matching in both package_info.json and retinaface/__init__.py")