alignfaces 1.0.1__py3-none-any.whl

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.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: alignfaces
3
+ Version: 1.0.1
4
+ Summary: Automatically align and warp face images
5
+ Author-email: Carl Michael Gaspar <carl.michael.gaspar@icloud.com>, "Oliver G.B. Garrod" <oliver.garrod@fabdata.io>
6
+ License: Apache-2.0
7
+ Keywords: face-alignment,face-morphing,psychophysics,psychology-experiments
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.txt
11
+ Requires-Dist: dlib
12
+ Requires-Dist: scikit-image
13
+ Dynamic: license-file
14
+
15
+ Automatic Face Alignment (AFA)
16
+ ================
17
+ Carl M. Gaspar & Oliver G.B. Garrod
18
+
19
+ #### You have lots of photos of faces like this:
20
+ ![](https://github.com/SourCherries/auto-face-align/raw/main/demos/demo_1_alignment/collage_originals.png)
21
+
22
+ #### But you want to line up all of the faces like this:
23
+ ![](https://github.com/SourCherries/auto-face-align/raw/main/demos/demo_1_alignment/collage_aligned.png)
24
+
25
+ #### Perhaps you would also like to window the faces to show only inner facial features like this:
26
+ ![](https://github.com/SourCherries/auto-face-align/raw/main/demos/demo_1_alignment/collage_aligned_windowed.png)
27
+
28
+ #### All of the above can be done using AFA like this:
29
+ ```python
30
+ import alignfaces as afa
31
+
32
+ faces_path = "/Users/Me/faces_for_my_study/"
33
+ pfx = "" # relevant input files may start with a string
34
+ sfx = "jpg" # input image format
35
+
36
+ afa.get_landmarks(
37
+ faces_path,
38
+ file_prefix=pfx,
39
+ file_postfix=sfx,
40
+ )
41
+
42
+ aligned_path = afa.align_procrustes(
43
+ faces_path,
44
+ file_prefix=pfx,
45
+ file_postfix=sfx,
46
+ )
47
+
48
+ afa.get_landmarks(
49
+ aligned_path,
50
+ file_prefix=pfx,
51
+ file_postfix=sfx,
52
+ )
53
+
54
+ the_aperture, aperture_path = afa.place_aperture(
55
+ aligned_path,
56
+ file_prefix=pfx,
57
+ file_postfix=sfx,
58
+ )
59
+ ```
60
+ To better understand how to write a script for your specific purposes, we direct you to [demo 1](https://github.com/SourCherries/auto-face-align/tree/main/demos/demo_1_alignment/README.md). [Demo 1](https://github.com/SourCherries/auto-face-align/tree/main/demos/demo_1_alignment/README.md) also describes how AFA alignment works.
61
+
62
+ All of these functions depend on reliable detection of facial landmarks, which is provided by the [DLIB](http://dlib.net) library. Alignment is based on generalized Procrustes analysis (GPA), which extensively unit tested.
63
+
64
+ # Additional functions (warping)
65
+ Automatic landmark detection means that it is also easy to separate **shape** and **texture** in order to produce various kinds of **warped** images.
66
+
67
+ AFA provides functions for two types of face-warping manipulations common in face perception research.
68
+
69
+ ### Morphing between faces
70
+ To learn how to do this please see [demo 2](https://github.com/SourCherries/auto-face-align/tree/main/demos/demo_2_morphing/README.md).
71
+
72
+ ### Enhanced average of facial identity
73
+ To learn how to do this please see [demo 3](https://github.com/SourCherries/auto-face-align/tree/main/demos/demo_3_averaging/README.md).
74
+
75
+ # Setup
76
+
77
+ It is highly recommended that you have **conda** installed, preferably **miniconda** rather than full fat **anaconda**.
78
+
79
+ If you do have **conda**, then this is the easiest way to install:
80
+
81
+ ```bash
82
+ conda create --name myenv "conda-forge::dlib<19.24.2" "python>=3.9" scikit-image
83
+
84
+ conda activate myenv
85
+
86
+ conda install -c conda-forge matplotlib
87
+ ```
88
+
89
+ To install AFA next you have two options:
90
+
91
+ You either do this:
92
+
93
+ ```bash
94
+ pip install "alignfaces @ git+https://git@github.com/SourCherries/auto-face-align.git"
95
+ ```
96
+
97
+ Or if instead you want a readable and editable copy of AFA on your local machine, then first clone this repository, go to the root folder `auto-face-align`, and then do this:
98
+
99
+ ```bash
100
+ pip install .
101
+ ```
102
+
103
+ Regardless of how you installed AFA, the above process will create a new virtual environment called `myenv`. You can use another name for that. You'll need to activate this environment using `conda activate myenv` whenever you want to use AFA. To deactivate, simply type `conda deactivate myenv`.
104
+
105
+ If you have a readable/editable copy of AFA on your local machine, you will have copies of all the demos. Most users will want those demo scripts to get started on their projects.
106
+
107
+ Other users may want a readable/editable copy of AFA to contribute to AFA, or to evaluate AFA by running the analyses under `results` or the unit tests. To run the unit tests, go to the root folder `auto-face-align` then do this:
108
+
109
+ ```bash
110
+ pip install -U pytest
111
+ pytest -v src/alignfaces/tests/
112
+ ```
113
+
114
+ # How well does this work?
115
+ In addition to unit-testing critical computations, I evaluated both landmark estimation (DLIB) and the outcome of the entire alignment procedure using various face databases. The results are described [here](https://github.com/SourCherries/auto-face-align/tree/main/results/README.md).
116
+
117
+ <!-- ## Ensure that you have the proper C compiler
118
+ On Linux, you will already have an appropriate C compiler.
119
+
120
+ On Windows, you need to install Microsoft Visual Studio.
121
+
122
+ On Mac, you need to install Xcode Command Line Tools.
123
+ 1. Find an Xcode version compatible with your [macOS version](https://en.wikipedia.org/wiki/Xcode).
124
+ 2. Get the right version of [Xcode Command Line Tools](https://developer.apple.com/downloads/index.action).
125
+ ``` -->
126
+
127
+ # Citation
128
+ If you use this package for your research, please cite the following preprint:
129
+ >Gaspar, C. M., & Garrod, O. G. B. (2021, November 8). A Python toolbox for Automatic Face Alignment (AFA). Retrieved from psyarxiv.com/erc8a
130
+
131
+ DOI:
132
+ >10.31234/osf.io/erc8a
133
+
134
+ # License
135
+ This module is under an Apache-2.0 license.
@@ -0,0 +1,27 @@
1
+ alignfaces/__init__.py,sha256=lbKkA2sHvuMXMfykWOhcSc2vHCLUQe-7_6b1qUnq5zE,345
2
+ alignfaces/aperture_tools.py,sha256=WcJ6plLU-GPBXYbCxx1B7QnCpWrT-D8Xf1rc08Jz9Cs,8090
3
+ alignfaces/contrast_tools.py,sha256=biy9Mc7XT_rBGZUSs77-4zWydCAVOLdrWUDf9QZwRoA,4352
4
+ alignfaces/contrast_tools_.py,sha256=NOxvNyIbW95zhFkaC34owB2azxN0A9724HNUJ0KX4c8,4332
5
+ alignfaces/face_landmarks.py,sha256=Jx9j8JxyAgzidlSfFBAM1J_1DNiNcH8P9pMLM8_9S04,9748
6
+ alignfaces/make_aligned_faces.py,sha256=7Kw1aw6gjix4EaM5STCKvh39MrA8g5-oVOBQ8hdVWsU,51972
7
+ alignfaces/make_aligned_faces_.py,sha256=mU0SaD7_5Gmx76fVaHl13NBnZp2zfBiqU-ZBLHo3pFA,51552
8
+ alignfaces/make_files.py,sha256=grxFSfss6qrSpkpIZRGhqfvMKv4dtrumjcg8S8_stus,1583
9
+ alignfaces/make_files_.py,sha256=3Ohk0271mVc35s20Z278yu3sOgDXpC6f-Nhc5dbDutk,1577
10
+ alignfaces/make_files_OLD.py,sha256=Zm97xj6FrlItiQsFrXyTbloQO2kgQGt8E1Y4eVuUUwA,3288
11
+ alignfaces/phase_cong_3.py,sha256=wGW-UHBDeYDTcuvIimBXAtoscJMpNOvYhTrI2O_qY1k,26218
12
+ alignfaces/plot_tools.py,sha256=NstKasB93S2gSSLheFG2ABNVKY34Ktp_X5hGwQKMpDg,6129
13
+ alignfaces/procrustes_tools.py,sha256=tdWFeLHSjO1a0KjU7I1zwlHxYem1zxKMTNslrCU0mX0,5720
14
+ alignfaces/warp_tools.py,sha256=oVuR7qes5aQ7ch45Dc0nwQxRYl-JR4nsLZOXfJPYR4U,10345
15
+ alignfaces/data/shape_predictor_68_face_landmarks.dat,sha256=-9wsuA65qnp1hnLL_doyumMA7-m25seimf9-c2sRuS8,99693937
16
+ alignfaces/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ alignfaces/tests/_test_pawarp.py,sha256=4gva1rLWcSv7SKYoHRRxahHlelt75cmrqsvq_jzUeDk,8371
18
+ alignfaces/tests/test_procrustes_tools.py,sha256=oPglnK0VaFBFsVIGrEySjxSIO8Ea0dLh9JNq7PThej4,22345
19
+ alignfaces/tests/test_warp_tools.py,sha256=V0CVg3dCX4qrkzFa0Xd7JxmIqnSd56-5AEdrPMoERHA,10508
20
+ alignfaces/tests/R/align_reference.csv,sha256=fliCYaGnvdxxq6KumISzehKF4mwpFn9u4aSyI2SqGU4,457
21
+ alignfaces/tests/R/align_shapes.csv,sha256=ca1aPlRiaCpEz2h2CnP6VwmEjeCgoZq-z6808LFcvaE,18241
22
+ alignfaces/tests/R/input_shapes.csv,sha256=uH25QAKQ-tsWvVKbhqQm22cx0Su3Hhs4HMdeGxviza4,8857
23
+ alignfaces-1.0.1.dist-info/licenses/LICENSE.txt,sha256=bZvZeGJgnC6_aLZOQgPlaIr4qnZtml3ePc9CZjuLDSk,557
24
+ alignfaces-1.0.1.dist-info/METADATA,sha256=m_LOPZDBbTaZuCySRh5amXYooXQD6PFIDMoG2XSJjhs,5461
25
+ alignfaces-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ alignfaces-1.0.1.dist-info/top_level.txt,sha256=g2p6npb5XYp9YJ4DTCT9sS3PcwdLbdQi9Ml7ka-C0lk,11
27
+ alignfaces-1.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,13 @@
1
+ Copyright 2021 Carl Michael Gaspar
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1 @@
1
+ alignfaces