face-engine 2.1.0__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. face_engine-3.0.0/PKG-INFO +147 -0
  2. face_engine-3.0.0/README.rst +108 -0
  3. face_engine-3.0.0/docs/source/conf.py +61 -0
  4. face_engine-3.0.0/face_engine/__init__.py +16 -0
  5. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine/core.py +142 -100
  6. face_engine-3.0.0/face_engine/fetching.py +142 -0
  7. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine/models/__init__.py +7 -6
  8. face_engine-3.0.0/face_engine/models/basic_estimator.py +68 -0
  9. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine/models/dlib_models.py +40 -28
  10. face_engine-3.0.0/face_engine/models/insightface_models.py +142 -0
  11. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine/tools.py +26 -12
  12. face_engine-3.0.0/face_engine.egg-info/PKG-INFO +147 -0
  13. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine.egg-info/SOURCES.txt +7 -2
  14. face_engine-3.0.0/face_engine.egg-info/requires.txt +19 -0
  15. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine.egg-info/top_level.txt +2 -0
  16. face_engine-3.0.0/pyproject.toml +67 -0
  17. face_engine-3.0.0/tests/test_face_engine.py +277 -0
  18. face_engine-3.0.0/tests/test_face_engine_models.py +205 -0
  19. face_engine-3.0.0/tests/test_face_engine_persistence.py +114 -0
  20. face_engine-3.0.0/tests/test_fetching.py +87 -0
  21. face-engine-2.1.0/PKG-INFO +0 -88
  22. face-engine-2.1.0/README.rst +0 -61
  23. face-engine-2.1.0/face_engine/__init__.py +0 -18
  24. face-engine-2.1.0/face_engine/fetching.py +0 -94
  25. face-engine-2.1.0/face_engine/models/basic_estimator.py +0 -48
  26. face-engine-2.1.0/face_engine/models/insightface_models.py +0 -53
  27. face-engine-2.1.0/face_engine.egg-info/PKG-INFO +0 -88
  28. face-engine-2.1.0/face_engine.egg-info/requires.txt +0 -9
  29. face-engine-2.1.0/setup.py +0 -57
  30. {face-engine-2.1.0 → face_engine-3.0.0}/LICENSE +0 -0
  31. {face-engine-2.1.0 → face_engine-3.0.0}/MANIFEST.in +0 -0
  32. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine/exceptions.py +0 -0
  33. {face-engine-2.1.0 → face_engine-3.0.0}/face_engine.egg-info/dependency_links.txt +0 -0
  34. {face-engine-2.1.0 → face_engine-3.0.0}/setup.cfg +0 -0
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: face-engine
3
+ Version: 3.0.0
4
+ Summary: Face Recognition Engine
5
+ Author-email: Daniyar Kussainov <ohw0sseug@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/guesswh0/face_engine
8
+ Classifier: Natural Language :: English
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy<3,>=1.26
23
+ Requires-Dist: pillow>=12.2
24
+ Requires-Dist: tqdm<5,>=4.66.3
25
+ Requires-Dist: platformdirs>=4
26
+ Provides-Extra: insightface
27
+ Requires-Dist: insightface>=1.0.1; extra == "insightface"
28
+ Requires-Dist: onnxruntime>=1.19; extra == "insightface"
29
+ Provides-Extra: dlib
30
+ Requires-Dist: dlib>=19.24; extra == "dlib"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest; extra == "dev"
33
+ Requires-Dist: ruff; extra == "dev"
34
+ Requires-Dist: black; extra == "dev"
35
+ Requires-Dist: sphinx; extra == "dev"
36
+ Requires-Dist: sphinx-rtd-theme; extra == "dev"
37
+ Requires-Dist: face-engine[insightface]; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ FaceEngine
41
+ ==========
42
+
43
+ FaceEngine is a lightweight python library that provides an easy interface to
44
+ work with **face recognition** tasks.
45
+
46
+ .. code-block:: python
47
+
48
+ >>> from face_engine import FaceEngine
49
+ >>> engine = FaceEngine()
50
+ >>> engine.fit(['bubbles1.jpg', 'drive.jpg'], [1, 2])
51
+ >>> engine.make_prediction('bubbles2.jpg')
52
+ ([(270, 75, 406, 211)], [1])
53
+
54
+
55
+ Installation
56
+ ------------
57
+
58
+ It is distributed on `PyPi`_, and can be installed with pip:
59
+
60
+ .. code-block:: console
61
+
62
+ $ pip install face-engine[insightface]
63
+
64
+ FaceEngine is supported only on Python 3.11 and above.
65
+
66
+ .. _PyPi: https://pypi.org/project/face-engine/
67
+
68
+ Models
69
+ ------
70
+
71
+ FaceEngine is built on top of three model interfaces ``Detector``, ``Embedder``
72
+ and ``Estimator`` (see `models`_), and leans on user provided implementations
73
+ of these models.
74
+
75
+ The default backend is `insightface`_ (the ``[insightface]`` extra), with
76
+ these bundled model implementations:
77
+
78
+ ======================= ========== ============ ===========================
79
+ name role model pack notes
80
+ ======================= ========== ============ ===========================
81
+ ``scrfd`` detector buffalo_l default; deprecated alias
82
+ ``retina_face``
83
+ ``arcface`` embedder buffalo_l default, 512-d
84
+ ``scrfd_antelopev2`` detector antelopev2 opt-in
85
+ ``arcface_antelopev2`` embedder antelopev2 strongest insightface
86
+ embedder, 512-d
87
+ ======================= ========== ============ ===========================
88
+
89
+ .. note::
90
+ The ``[insightface]`` extra installs the CPU build of onnxruntime.
91
+ For NVIDIA GPU inference replace it with the GPU build — both
92
+ packages provide the same ``onnxruntime`` module, so the CPU build
93
+ must be removed first::
94
+
95
+ pip uninstall onnxruntime && pip install onnxruntime-gpu
96
+
97
+ The models use the CUDA execution provider automatically when
98
+ available.
99
+
100
+ Legacy `dlib python api`_ models (``hog``, ``mmod`` detectors and ``resnet``
101
+ embedder with dlib pre-trained model `files`_) are kept as an optional
102
+ fallback backend used when insightface is not installed.
103
+
104
+ .. note::
105
+ FaceEngine installation is not installing dlib by default.
106
+ To install it, either run ``pip install dlib`` (requires cmake),
107
+ install prebuilt wheels with ``pip install dlib-bin``, or follow
108
+ `build instructions`_.
109
+
110
+ To work with your own custom models you have to implement required
111
+ `models`_ and import it. FaceEngine models are used to register all inheriting
112
+ imported subclasses (subclass registration `PEP 487`_).
113
+
114
+ Model weights licensing
115
+ -----------------------
116
+
117
+ The library code is Apache-2.0, but the downloaded pre-trained model weights
118
+ come with their own terms:
119
+
120
+ * insightface model packs (``buffalo_l``, ``antelopev2``) are available for
121
+ **non-commercial research purposes only** (see `insightface`_).
122
+ * dlib model files have their own terms, see `dlib-models`_.
123
+
124
+ Breaking changes in 3.0
125
+ -----------------------
126
+
127
+ * Python >= 3.11 is required.
128
+ * Pickle persistence was removed for security reasons: engines are saved as
129
+ JSON (``engine.save('engine.json')``) and estimator state as ``.npz`` +
130
+ ``.json`` files. Engines saved with face-engine < 3.0 cannot be loaded —
131
+ re-fit and save again.
132
+ * With insightface installed the default models are ``scrfd``/``arcface``
133
+ (previously dlib ``hog``/``resnet``).
134
+ * The ``retina_face`` detector was renamed to ``scrfd`` (the actual model
135
+ architecture); the old name is kept as a deprecated alias.
136
+ * Model downloads are verified against pinned SHA-256 checksums.
137
+
138
+ For more information read the full `documentation`_.
139
+
140
+ .. _models: https://github.com/guesswh0/face_engine/blob/master/face_engine/models/__init__.py
141
+ .. _insightface: https://github.com/deepinsight/insightface
142
+ .. _dlib python api: http://dlib.net/python/index.html
143
+ .. _files: https://github.com/davisking/dlib-models
144
+ .. _dlib-models: https://github.com/davisking/dlib-models
145
+ .. _build instructions: http://dlib.net/compile.html
146
+ .. _PEP 487: https://www.python.org/dev/peps/pep-0487/
147
+ .. _documentation: https://face-engine.readthedocs.io/en/latest/
@@ -0,0 +1,108 @@
1
+ FaceEngine
2
+ ==========
3
+
4
+ FaceEngine is a lightweight python library that provides an easy interface to
5
+ work with **face recognition** tasks.
6
+
7
+ .. code-block:: python
8
+
9
+ >>> from face_engine import FaceEngine
10
+ >>> engine = FaceEngine()
11
+ >>> engine.fit(['bubbles1.jpg', 'drive.jpg'], [1, 2])
12
+ >>> engine.make_prediction('bubbles2.jpg')
13
+ ([(270, 75, 406, 211)], [1])
14
+
15
+
16
+ Installation
17
+ ------------
18
+
19
+ It is distributed on `PyPi`_, and can be installed with pip:
20
+
21
+ .. code-block:: console
22
+
23
+ $ pip install face-engine[insightface]
24
+
25
+ FaceEngine is supported only on Python 3.11 and above.
26
+
27
+ .. _PyPi: https://pypi.org/project/face-engine/
28
+
29
+ Models
30
+ ------
31
+
32
+ FaceEngine is built on top of three model interfaces ``Detector``, ``Embedder``
33
+ and ``Estimator`` (see `models`_), and leans on user provided implementations
34
+ of these models.
35
+
36
+ The default backend is `insightface`_ (the ``[insightface]`` extra), with
37
+ these bundled model implementations:
38
+
39
+ ======================= ========== ============ ===========================
40
+ name role model pack notes
41
+ ======================= ========== ============ ===========================
42
+ ``scrfd`` detector buffalo_l default; deprecated alias
43
+ ``retina_face``
44
+ ``arcface`` embedder buffalo_l default, 512-d
45
+ ``scrfd_antelopev2`` detector antelopev2 opt-in
46
+ ``arcface_antelopev2`` embedder antelopev2 strongest insightface
47
+ embedder, 512-d
48
+ ======================= ========== ============ ===========================
49
+
50
+ .. note::
51
+ The ``[insightface]`` extra installs the CPU build of onnxruntime.
52
+ For NVIDIA GPU inference replace it with the GPU build — both
53
+ packages provide the same ``onnxruntime`` module, so the CPU build
54
+ must be removed first::
55
+
56
+ pip uninstall onnxruntime && pip install onnxruntime-gpu
57
+
58
+ The models use the CUDA execution provider automatically when
59
+ available.
60
+
61
+ Legacy `dlib python api`_ models (``hog``, ``mmod`` detectors and ``resnet``
62
+ embedder with dlib pre-trained model `files`_) are kept as an optional
63
+ fallback backend used when insightface is not installed.
64
+
65
+ .. note::
66
+ FaceEngine installation is not installing dlib by default.
67
+ To install it, either run ``pip install dlib`` (requires cmake),
68
+ install prebuilt wheels with ``pip install dlib-bin``, or follow
69
+ `build instructions`_.
70
+
71
+ To work with your own custom models you have to implement required
72
+ `models`_ and import it. FaceEngine models are used to register all inheriting
73
+ imported subclasses (subclass registration `PEP 487`_).
74
+
75
+ Model weights licensing
76
+ -----------------------
77
+
78
+ The library code is Apache-2.0, but the downloaded pre-trained model weights
79
+ come with their own terms:
80
+
81
+ * insightface model packs (``buffalo_l``, ``antelopev2``) are available for
82
+ **non-commercial research purposes only** (see `insightface`_).
83
+ * dlib model files have their own terms, see `dlib-models`_.
84
+
85
+ Breaking changes in 3.0
86
+ -----------------------
87
+
88
+ * Python >= 3.11 is required.
89
+ * Pickle persistence was removed for security reasons: engines are saved as
90
+ JSON (``engine.save('engine.json')``) and estimator state as ``.npz`` +
91
+ ``.json`` files. Engines saved with face-engine < 3.0 cannot be loaded —
92
+ re-fit and save again.
93
+ * With insightface installed the default models are ``scrfd``/``arcface``
94
+ (previously dlib ``hog``/``resnet``).
95
+ * The ``retina_face`` detector was renamed to ``scrfd`` (the actual model
96
+ architecture); the old name is kept as a deprecated alias.
97
+ * Model downloads are verified against pinned SHA-256 checksums.
98
+
99
+ For more information read the full `documentation`_.
100
+
101
+ .. _models: https://github.com/guesswh0/face_engine/blob/master/face_engine/models/__init__.py
102
+ .. _insightface: https://github.com/deepinsight/insightface
103
+ .. _dlib python api: http://dlib.net/python/index.html
104
+ .. _files: https://github.com/davisking/dlib-models
105
+ .. _dlib-models: https://github.com/davisking/dlib-models
106
+ .. _build instructions: http://dlib.net/compile.html
107
+ .. _PEP 487: https://www.python.org/dev/peps/pep-0487/
108
+ .. _documentation: https://face-engine.readthedocs.io/en/latest/
@@ -0,0 +1,61 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ import os
8
+ import sys
9
+
10
+ # -- Path setup --------------------------------------------------------------
11
+
12
+ # If extensions (or modules to document with autodoc) are in another directory,
13
+ # add these directories to sys.path here. If the directory is relative to the
14
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
15
+ #
16
+
17
+ autodoc_mock_imports = ["dlib", "insightface", "onnxruntime"]
18
+ sys.path.insert(0, os.path.abspath("../.."))
19
+
20
+ # -- Project information -----------------------------------------------------
21
+
22
+ project = "FaceEngine"
23
+ copyright = "2019-2026, Daniyar Kussainov"
24
+ author = "Daniyar Kussainov"
25
+
26
+ # The full version, including alpha/beta/rc tags
27
+ from face_engine import __version__
28
+
29
+ release = __version__
30
+
31
+ # -- General configuration ---------------------------------------------------
32
+
33
+ # The master toctree document.
34
+ master_doc = "index"
35
+
36
+ # Add any Sphinx extension module names here, as strings. They can be
37
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38
+ # ones.
39
+ extensions = ["sphinx.ext.autodoc"]
40
+
41
+ # Add any paths that contain templates here, relative to this directory.
42
+ templates_path = ["_templates"]
43
+
44
+ # List of patterns, relative to source directory, that match files and
45
+ # directories to ignore when looking for source files.
46
+ # This pattern also affects html_static_path and html_extra_path.
47
+ exclude_patterns = []
48
+
49
+ # -- Options for HTML output -------------------------------------------------
50
+
51
+ # The theme to use for HTML and HTML Help pages. See the documentation for
52
+ # a list of builtin themes.
53
+ #
54
+ html_theme = "sphinx_rtd_theme"
55
+
56
+ # Add any paths that contain custom static files (such as style sheets) here,
57
+ # relative to this directory. They are copied after the builtin static files,
58
+ # so a file named "default.css" will overwrite the builtin "default.css".
59
+ html_static_path = []
60
+
61
+ autodoc_member_order = "bysource"
@@ -0,0 +1,16 @@
1
+ """
2
+ Face Recognition Engine
3
+ """
4
+
5
+ __all__ = ["logger", "RESOURCES", "FaceEngine", "_models", "load_engine"]
6
+ __version__ = "3.0.0"
7
+ __author__ = "Daniyar Kussainov"
8
+ __license__ = "Apache License, Version 2.0"
9
+ __copyright__ = "Copyright 2019-2026 Daniyar Kussainov"
10
+
11
+ import logging
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ from face_engine.fetching import RESOURCES # noqa: E402
16
+ from face_engine.core import FaceEngine, _models, load_engine # noqa: E402