svjack commited on
Commit
9390e2c
1 Parent(s): f753113

Upload SPIGA with huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +5 -0
  2. SPIGA/.gitignore +23 -0
  3. SPIGA/LICENSE +29 -0
  4. SPIGA/MANIFEST.in +5 -0
  5. SPIGA/README.md +217 -0
  6. SPIGA/colab_tutorials/image_demo.ipynb +0 -0
  7. SPIGA/colab_tutorials/video_demo.ipynb +0 -0
  8. SPIGA/colab_tutorials/video_tools/record.py +78 -0
  9. SPIGA/colab_tutorials/video_tools/utils.py +52 -0
  10. SPIGA/pyproject.toml +7 -0
  11. SPIGA/requirements.txt +9 -0
  12. SPIGA/setup.cfg +74 -0
  13. SPIGA/spiga/__init__.py +0 -0
  14. SPIGA/spiga/data/__init__.py +0 -0
  15. SPIGA/spiga/data/annotations/300wprivate/db_info.json +98 -0
  16. SPIGA/spiga/data/annotations/300wprivate/test.json +0 -0
  17. SPIGA/spiga/data/annotations/300wprivate/train.json +0 -0
  18. SPIGA/spiga/data/annotations/300wpublic/db_info.json +98 -0
  19. SPIGA/spiga/data/annotations/300wpublic/test.json +0 -0
  20. SPIGA/spiga/data/annotations/300wpublic/train.json +0 -0
  21. SPIGA/spiga/data/annotations/cofw68/db_info.json +92 -0
  22. SPIGA/spiga/data/annotations/cofw68/test.json +0 -0
  23. SPIGA/spiga/data/annotations/merlrav/db_info.json +99 -0
  24. SPIGA/spiga/data/annotations/merlrav/test.json +3 -0
  25. SPIGA/spiga/data/annotations/merlrav/train.json +3 -0
  26. SPIGA/spiga/data/annotations/wflw/db_info.json +288 -0
  27. SPIGA/spiga/data/annotations/wflw/test.json +0 -0
  28. SPIGA/spiga/data/annotations/wflw/train.json +3 -0
  29. SPIGA/spiga/data/loaders/__init__.py +0 -0
  30. SPIGA/spiga/data/loaders/alignments.py +158 -0
  31. SPIGA/spiga/data/loaders/augmentors/__init__.py +0 -0
  32. SPIGA/spiga/data/loaders/augmentors/boundary.py +122 -0
  33. SPIGA/spiga/data/loaders/augmentors/heatmaps.py +39 -0
  34. SPIGA/spiga/data/loaders/augmentors/landmarks.py +307 -0
  35. SPIGA/spiga/data/loaders/augmentors/modern_posit.py +197 -0
  36. SPIGA/spiga/data/loaders/augmentors/utils.py +147 -0
  37. SPIGA/spiga/data/loaders/dataloader.py +41 -0
  38. SPIGA/spiga/data/loaders/dl_config.py +170 -0
  39. SPIGA/spiga/data/loaders/transforms.py +84 -0
  40. SPIGA/spiga/data/models3D/__init__.py +0 -0
  41. SPIGA/spiga/data/models3D/mean_face_3D_68.txt +68 -0
  42. SPIGA/spiga/data/models3D/mean_face_3D_98.txt +98 -0
  43. SPIGA/spiga/data/models3D/visualization.py +37 -0
  44. SPIGA/spiga/data/readme.md +72 -0
  45. SPIGA/spiga/data/visualize/__init__.py +0 -0
  46. SPIGA/spiga/data/visualize/inspect_dataset.py +181 -0
  47. SPIGA/spiga/data/visualize/inspect_heatmaps.py +92 -0
  48. SPIGA/spiga/data/visualize/plotting.py +97 -0
  49. SPIGA/spiga/demo/__init__.py +0 -0
  50. SPIGA/spiga/demo/analyze/__init__.py +0 -0
.gitattributes CHANGED
@@ -32,3 +32,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ SPIGA/spiga/data/annotations/merlrav/test.json filter=lfs diff=lfs merge=lfs -text
36
+ SPIGA/spiga/data/annotations/merlrav/train.json filter=lfs diff=lfs merge=lfs -text
37
+ SPIGA/spiga/data/annotations/wflw/train.json filter=lfs diff=lfs merge=lfs -text
38
+ SPIGA/spiga/eval/results/merlrav/results_merlrav_test.json filter=lfs diff=lfs merge=lfs -text
39
+ SPIGA/spiga/eval/results/wflw/results_wflw_test.json filter=lfs diff=lfs merge=lfs -text
SPIGA/.gitignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.pyc
2
+ *__pycache__*
3
+ *core.*
4
+ _ext
5
+ tmp
6
+ *.o*
7
+ *~
8
+ *.idea
9
+ *.mp4
10
+ *.avi
11
+ *.h5
12
+ *.pt
13
+ *.egg-info
14
+
15
+ # Build
16
+ /build
17
+ /dist
18
+
19
+ # Virtual enviroment
20
+ **/venv
21
+
22
+ # Dataset images
23
+ /spiga/data/databases
SPIGA/LICENSE ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, aprados
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SPIGA/MANIFEST.in ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ include spiga/data/annotations/**/db_info.json
2
+ include spiga/data/models3D/*.txt
3
+ include spiga/data/readme.md
4
+ include spiga/eval/benchmark/readme.md
5
+
SPIGA/README.md ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPIGA: Shape Preserving Facial Landmarks with Graph Attention Networks.
2
+
3
+ [![Project Page](https://badgen.net/badge/color/Project%20Page/purple?icon=atom&label)](https://bmvc2022.mpi-inf.mpg.de/155/)
4
+ [![arXiv](https://img.shields.io/badge/arXiv-2210.07233-b31b1b.svg)](https://arxiv.org/abs/2210.07233)
5
+ [![PyPI version](https://badge.fury.io/py/spiga.svg)](https://badge.fury.io/py/spiga)
6
+ [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE)
7
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/andresprados/SPIGA/blob/main/colab_tutorials/video_demo.ipynb)
8
+
9
+ This repository contains the source code of **SPIGA, a face alignment and headpose estimator** that takes advantage of the complementary benefits from CNN and GNN architectures producing plausible face shapes in presence of strong appearance changes.
10
+
11
+ <p align="center">
12
+ <img src="https://raw.githubusercontent.com/andresprados/SPIGA/main/assets/spiga_scheme.png" width="80%">
13
+ </p>
14
+
15
+ **It achieves top-performing results in:**
16
+
17
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/pose-estimation-on-300w-full)](https://paperswithcode.com/sota/pose-estimation-on-300w-full?p=shape-preserving-facial-landmarks-with-graph)
18
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/head-pose-estimation-on-wflw)](https://paperswithcode.com/sota/head-pose-estimation-on-wflw?p=shape-preserving-facial-landmarks-with-graph)
19
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/pose-estimation-on-merl-rav)](https://paperswithcode.com/sota/pose-estimation-on-merl-rav?p=shape-preserving-facial-landmarks-with-graph)
20
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-merl-rav)](https://paperswithcode.com/sota/face-alignment-on-merl-rav?p=shape-preserving-facial-landmarks-with-graph)
21
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-wflw)](https://paperswithcode.com/sota/face-alignment-on-wflw?p=shape-preserving-facial-landmarks-with-graph)
22
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-300w-split-2)](https://paperswithcode.com/sota/face-alignment-on-300w-split-2?p=shape-preserving-facial-landmarks-with-graph)
23
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-cofw-68)](https://paperswithcode.com/sota/face-alignment-on-cofw-68?p=shape-preserving-facial-landmarks-with-graph)
24
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-300w)](https://paperswithcode.com/sota/face-alignment-on-300w?p=shape-preserving-facial-landmarks-with-graph)
25
+
26
+
27
+ ## Setup
28
+ The repository has been tested on Ubuntu 20.04 with CUDA 11.4, the latest version of cuDNN, Python 3.8 and Pytorch 1.12.1.
29
+ To run the video analyzer demo or evaluate the algorithm, install the repository from the source code:
30
+
31
+ ```
32
+ # Best practices:
33
+ # 1. Create a virtual environment.
34
+ # 2. Install Pytorch according to your CUDA version.
35
+ # 3. Install SPIGA from source code:
36
+
37
+ git clone https://github.com/andresprados/SPIGA.git
38
+ cd spiga
39
+ pip install -e .
40
+
41
+ # To run the video analyzer demo install the extra requirements.
42
+ pip install -e .[demo]
43
+ ```
44
+ **Models:** By default, model weights are automatically downloaded on demand and stored at ```./spiga/models/weights/```.
45
+ You can also download them from [Google Drive](https://drive.google.com/drive/folders/1olrkoiDNK_NUCscaG9BbO3qsussbDi7I?usp=sharing).
46
+
47
+ ***Note:*** All the callable files provide a detailed parser that describes the behaviour of the program and their inputs. Please, check the operational modes by using the extension ```--help```.
48
+
49
+ ## Inference and Demo
50
+ We provide an inference framework for SPIGA available at ```./spiga/inference```. The models can be easily deployed
51
+ in third-party projects by adding a few lines of code. Check out our inference and application tutorials
52
+ for more information:
53
+
54
+ <div align="center">
55
+
56
+ Tutorials | Notebook |
57
+ :---: | :---: |
58
+ Image Inference Example | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/andresprados/SPIGA/blob/main/colab_tutorials/image_demo.ipynb) |
59
+ Face Video Analyzer Demo | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/andresprados/SPIGA/blob/main/colab_tutorials/video_demo.ipynb) |
60
+
61
+ </div>
62
+
63
+ ### Face Video Analyzer Demo:
64
+ The demo application provides a general framework for tracking, detecting and extracting features of human faces in images or videos.
65
+ You can use the following commands to run the demo:
66
+
67
+ ```
68
+ python ./spiga/demo/app.py \
69
+ [--input] \ # Webcam ID or Video Path. Dft: Webcam '0'.
70
+ [--dataset] \ # SPIGA pretrained weights per dataset. Dft: 'wflw'.
71
+ [--tracker] \ # Tracker name. Dft: 'RetinaSort'.
72
+ [--show] \ # Select the attributes of the face to be displayed. Dft: ['fps', 'face_id', 'landmarks', 'headpose']
73
+ [--save] \ # Save record.
74
+ [--noview] \ # Do not visualize window.
75
+ [--outpath] \ # Recorded output directory. Dft: './spiga/demo/outputs'
76
+ [--fps] \ # Frames per second.
77
+ [--shape] \ # Visualizer shape (W,H).
78
+ ```
79
+
80
+
81
+ <p align="center">
82
+
83
+ <img src="https://raw.githubusercontent.com/andresprados/SPIGA/main/assets/demo.gif" width=250px height=250px>
84
+ &nbsp;&nbsp;&nbsp;
85
+ <img src="https://raw.githubusercontent.com/andresprados/SPIGA/main/assets/results/carnaval.gif" width=300px height=250px>
86
+ &nbsp;&nbsp;&nbsp;
87
+ <img src="https://raw.githubusercontent.com/andresprados/SPIGA/main/assets/results/football.gif" width=230px height=250px>
88
+
89
+ </p>
90
+
91
+ ***Note:*** For more information check the [Demo Readme](spiga/demo/readme.md) or call the app parser ```--help```.
92
+
93
+
94
+ ## Dataloaders and Benchmarks
95
+ This repository provides general-use tools for the task of face alignment and headpose estimation:
96
+
97
+ * **Dataloaders:** Training and inference dataloaders are available at ```./spiga/data```.
98
+ Including the data augmentation tools used for training SPIGA and data-visualizer to analyze the dataset images and features.
99
+ For more information check the [Data Readme](spiga/data/readme.md) .
100
+
101
+ * **Benchmark:** A common benchmark framework to test any algorithm in the task of face alignment and headpose estimation
102
+ is available at ```./spiga/eval/benchmark```. For more information check the following Evaluation Section and the [Benchmark Readme](spiga/eval/benchmark/readme.md).
103
+
104
+ **Datasets:** To run the data visualizers or the evaluation benchmark please download the dataset images from the official websites
105
+ ([300W](https://ibug.doc.ic.ac.uk/resources/facial-point-annotations/),
106
+ [AFLW](https://www.tugraz.at/institute/icg/research/team-bischof/lrs/downloads/aflw/),
107
+ [WFLW](https://wywu.github.io/projects/LAB/WFLW.html), [COFW](http://www.vision.caltech.edu/xpburgos/ICCV13/)).
108
+ By default they should be saved following the next folder structure:
109
+ ```
110
+ ./spiga/data/databases/ # Default path can be updated by modifying 'db_img_path' in ./spiga/data/loaders/dl_config.py
111
+ |
112
+ └───/300w
113
+ │ └─── /images
114
+ │ | /private
115
+ │ | /test
116
+ | └ /train
117
+ |
118
+ └───/cofw
119
+ │ └─── /images
120
+ |
121
+ └───/aflw
122
+ │ └─── /data
123
+ | └ /flickr
124
+ |
125
+ └───/wflw
126
+ └─── /images
127
+ ```
128
+ **Annotations:** We have stored for simplicity the datasets annotations directly in ```./spiga/data/annotations```. We strongly recommend to move them out of the repository if you plan to use it as a git directory.
129
+
130
+ **Results:** Similar to the annotations problem, we have stored the SPIGA results in ```./spiga/eval/results/<dataset_name>```. Remove them if need it.
131
+
132
+ ## Evaluation
133
+ The models evaluation is divided in two scripts:
134
+
135
+ **Results generation**: The script extracts the data alignments and headpose estimation from the desired ``` <dataset_name>``` trained network. Generating a ```./spiga/eval/results/results_<dataset_name>_test.json``` file which follows the same data structure defined by the dataset annotations.
136
+
137
+ ```
138
+ python ./spiga/eval/results_gen.py <dataset_name>
139
+ ```
140
+
141
+ **Benchmark metrics**: The script generates the desired landmark or headpose estimation metrics. We have implemented an useful benchmark which allows you to test any model using a results file as input.
142
+
143
+ ```
144
+ python ./spiga/eval/benchmark/evaluator.py /path/to/<results_file.json> --eval lnd pose -s
145
+ ```
146
+
147
+ ***Note:*** You will have to interactively select the NME_norm and other parameters in the terminal window.
148
+
149
+ ### Results Sum-up
150
+ <details>
151
+ <summary> WFLW Dataset </summary>
152
+
153
+ |[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-wflw)](https://paperswithcode.com/sota/face-alignment-on-wflw?p=shape-preserving-facial-landmarks-with-graph)|NME_ioc|AUC_10|FR_10|NME_P90|NME_P95|NME_P99|
154
+ |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
155
+ |full|4.060|60.558|2.080|6.766|8.199|13.071|
156
+ |pose|7.141|35.312|11.656|10.684|13.334|26.890|
157
+ |expression|4.457|57.968|2.229|7.023|8.148|22.388|
158
+ |illumination|4.004|61.311|1.576|6.528|7.919|11.090|
159
+ |makeup|3.809|62.237|1.456|6.320|8.289|11.564|
160
+ |occlusion|4.952|53.310|4.484|8.091|9.929|16.439|
161
+ |blur|4.650|55.310|2.199|7.311|8.693|14.421|
162
+ </details>
163
+
164
+ <details>
165
+ <summary> MERLRAV Dataset </summary>
166
+
167
+ |[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-merl-rav)](https://paperswithcode.com/sota/face-alignment-on-merl-rav?p=shape-preserving-facial-landmarks-with-graph)|NME_bbox|AUC_7|FR_7|NME_P90|NME_P95|NME_P99|
168
+ |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
169
+ |full|1.509|78.474|0.052|2.163|2.468|3.456|
170
+ |frontal|1.616|76.964|0.091|2.246|2.572|3.621|
171
+ |half_profile|1.683|75.966|0.000|2.274|2.547|3.397|
172
+ |profile|1.191|82.990|0.000|1.735|2.042|2.878|
173
+ </details>
174
+
175
+ <details>
176
+ <summary> 300W Private Dataset </summary>
177
+
178
+ |[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-300w-split-2)](https://paperswithcode.com/sota/face-alignment-on-300w-split-2?p=shape-preserving-facial-landmarks-with-graph)|NME_bbox|AUC_7|FR_7|NME_P90|NME_P95|NME_P99|
179
+ |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
180
+ |full|2.031|71.011|0.167|2.788|3.078|3.838|
181
+ |indoor|2.035|70.959|0.333|2.726|3.007|3.712|
182
+ |outdoor|2.027|37.174|0.000|2.824|3.217|3.838|
183
+ </details>
184
+
185
+ <details>
186
+ <summary> COFW68 Dataset </summary>
187
+
188
+ |[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-cofw-68)](https://paperswithcode.com/sota/face-alignment-on-cofw-68?p=shape-preserving-facial-landmarks-with-graph)|NME_bbox|AUC_7|FR_7|NME_P90|NME_P95|NME_P99|
189
+ |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
190
+ |full|2.517|64.050|0.000|3.439|4.066|5.558|
191
+ </details>
192
+
193
+ <details>
194
+ <summary> 300W Public Dataset </summary>
195
+
196
+ |[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/shape-preserving-facial-landmarks-with-graph/face-alignment-on-300w)](https://paperswithcode.com/sota/face-alignment-on-300w?p=shape-preserving-facial-landmarks-with-graph)|NME_ioc|AUC_8|FR_8|NME_P90|NME_P95|NME_P99|
197
+ |:--:|:--:|:--:|:--:|:--:|:--:|:--:|
198
+ |full|2.994|62.726|0.726|4.667|5.436|7.320|
199
+ |common|2.587|44.201|0.000|3.710|4.083|5.215|
200
+ |challenge|4.662|42.449|3.704|6.626|7.390|10.095|
201
+
202
+ </details>
203
+
204
+
205
+ ## BibTeX Citation
206
+ ```
207
+ @inproceedings{Prados-Torreblanca_2022_BMVC,
208
+ author = {Andrés Prados-Torreblanca and José M Buenaposada and Luis Baumela},
209
+ title = {Shape Preserving Facial Landmarks with Graph Attention Networks},
210
+ booktitle = {33rd British Machine Vision Conference 2022, {BMVC} 2022, London, UK, November 21-24, 2022},
211
+ publisher = {{BMVA} Press},
212
+ year = {2022},
213
+ url = {https://bmvc2022.mpi-inf.mpg.de/0155.pdf}
214
+ }
215
+ ```
216
+
217
+
SPIGA/colab_tutorials/image_demo.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/colab_tutorials/video_demo.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/colab_tutorials/video_tools/record.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from IPython.display import display, Javascript, HTML
2
+ from google.colab.output import eval_js
3
+ from base64 import b64decode, b64encode
4
+
5
+
6
+ def record_video(filename):
7
+ js = Javascript("""
8
+ async function recordVideo() {
9
+ const options = { mimeType: "video/webm; codecs=vp9" };
10
+ const div = document.createElement('div');
11
+ const capture = document.createElement('button');
12
+ const stopCapture = document.createElement("button");
13
+
14
+ capture.textContent = "Start Recording";
15
+ capture.style.background = "orange";
16
+ capture.style.color = "white";
17
+
18
+ stopCapture.textContent = "Stop Recording";
19
+ stopCapture.style.background = "red";
20
+ stopCapture.style.color = "white";
21
+ div.appendChild(capture);
22
+
23
+ const video = document.createElement('video');
24
+ const recordingVid = document.createElement("video");
25
+ video.style.display = 'block';
26
+
27
+ const stream = await navigator.mediaDevices.getUserMedia({audio:true, video: true});
28
+
29
+ let recorder = new MediaRecorder(stream, options);
30
+ document.body.appendChild(div);
31
+ div.appendChild(video);
32
+
33
+ video.srcObject = stream;
34
+ video.muted = true;
35
+
36
+ await video.play();
37
+
38
+ google.colab.output.setIframeHeight(document.documentElement.scrollHeight, true);
39
+
40
+ await new Promise((resolve) => {
41
+ capture.onclick = resolve;
42
+ });
43
+ recorder.start();
44
+ capture.replaceWith(stopCapture);
45
+
46
+ await new Promise((resolve) => stopCapture.onclick = resolve);
47
+ recorder.stop();
48
+ let recData = await new Promise((resolve) => recorder.ondataavailable = resolve);
49
+ let arrBuff = await recData.data.arrayBuffer();
50
+
51
+ // stop the stream and remove the video element
52
+ stream.getVideoTracks()[0].stop();
53
+ div.remove();
54
+
55
+ let binaryString = "";
56
+ let bytes = new Uint8Array(arrBuff);
57
+ bytes.forEach((byte) => {
58
+ binaryString += String.fromCharCode(byte);
59
+ })
60
+ return btoa(binaryString);
61
+ }
62
+ """)
63
+ try:
64
+ display(js)
65
+ data = eval_js('recordVideo({})')
66
+ binary = b64decode(data)
67
+ with open(filename, "wb") as video_file:
68
+ video_file.write(binary)
69
+ print(f"Finished recording video at:{filename}")
70
+ except Exception as err:
71
+ print(str(err))
72
+
73
+
74
+ def show_video(video_path, video_width=600):
75
+ video_file = open(video_path, "r+b").read()
76
+
77
+ video_url = f"data:video/mp4;base64,{b64encode(video_file).decode()}"
78
+ return HTML(f"""<video width={video_width} controls><source src="{video_url}"></video>""")
SPIGA/colab_tutorials/video_tools/utils.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import PIL
3
+ import io
4
+ import cv2
5
+ from base64 import b64decode, b64encode
6
+
7
+
8
+ def js_to_image(js_reply):
9
+ """
10
+ Convert the JavaScript object into an OpenCV image.
11
+
12
+ @param js_reply: JavaScript object containing image from webcam
13
+ @return img: OpenCV BGR image
14
+ """
15
+ # decode base64 image
16
+ image_bytes = b64decode(js_reply.split(',')[1])
17
+ # convert bytes to numpy array
18
+ jpg_as_np = np.frombuffer(image_bytes, dtype=np.uint8)
19
+ # decode numpy array into OpenCV BGR image
20
+ img = cv2.imdecode(jpg_as_np, flags=1)
21
+
22
+ return img
23
+
24
+
25
+ def bbox_to_bytes(bbox_array):
26
+ """
27
+ Convert OpenCV Rectangle bounding box image into base64 byte string to be overlayed on video stream.
28
+
29
+ @param bbox_array: Numpy array (pixels) containing rectangle to overlay on video stream.
30
+ @return bbox_bytes: Base64 image byte string
31
+ """
32
+ # convert array into PIL image
33
+ bbox_PIL = PIL.Image.fromarray(bbox_array, 'RGBA')
34
+ iobuf = io.BytesIO()
35
+ # format bbox into png for return
36
+ bbox_PIL.save(iobuf, format='png')
37
+ # format return string
38
+ bbox_bytes = 'data:image/png;base64,{}'.format((str(b64encode(iobuf.getvalue()), 'utf-8')))
39
+ return bbox_bytes
40
+
41
+
42
+ def image_to_bytes(image):
43
+ """
44
+ Convert OpenCV image into base64 byte string to be overlayed on video stream.
45
+
46
+ @param image: Input image.
47
+ @return img_bytes: Base64 image byte string.
48
+ """
49
+ ret, buffer = cv2.imencode('.jpg', image)
50
+ jpg_as_text = b64encode(buffer).decode('utf-8')
51
+ img_bytes = f'data:image/jpeg;base64,{jpg_as_text}'
52
+ return img_bytes
SPIGA/pyproject.toml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=64.0.0",
4
+ "wheel",
5
+ ]
6
+ build-backend = "setuptools.build_meta"
7
+
SPIGA/requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ matplotlib>=3.2.1
2
+ numpy>=1.18.2
3
+ opencv-python-headless
4
+ Pillow>=7.0.0
5
+ torch>=1.4.0
6
+ torchvision>=0.5.0
7
+ torchaudio
8
+ scipy
9
+ scikit-learn
SPIGA/setup.cfg ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration of the Python project
2
+
3
+ # Configure setup.py
4
+ [metadata]
5
+ name = spiga
6
+ version = 0.0.6
7
+ author = Andres Prados Torreblanca
8
+ author_email = andresprator@gmail.com
9
+ description = SPIGA: Shape Preserving Facial Landmarks with Graph Attention Networks
10
+ long_description = file: README.md
11
+ long_description_content_type= text/markdown
12
+ license = BSD-3-Clause
13
+ license_files = LICENSE
14
+ url = https://github.com/andresprados/SPIGA
15
+ project_urls =
16
+ Homepage = https://bmvc2022.mpi-inf.mpg.de/155/
17
+ SPIGA Paper = https://bmvc2022.mpi-inf.mpg.de/0155.pdf
18
+ Bug Tracker = https://github.com/andresprados/SPIGA/issues
19
+ keywords =
20
+ Computer Vision
21
+ Face Alignment
22
+ Head Pose Estimation
23
+ Pytorch
24
+ CNN
25
+ GNN
26
+ BMVC2022
27
+ WFLW
28
+ 300W
29
+ Merlrav
30
+ COFW
31
+
32
+ classifiers =
33
+ Development Status :: 4 - Beta
34
+ Intended Audience :: Developers
35
+ Intended Audience :: Science/Research
36
+ Intended Audience :: Education
37
+ Operating System :: OS Independent
38
+ Environment :: GPU
39
+ Environment :: Console
40
+ Programming Language :: Python :: 3
41
+ Programming Language :: Python :: 3.7
42
+ Programming Language :: Python :: 3.8
43
+ Programming Language :: Python :: 3.9
44
+ Programming Language :: Python :: 3.10
45
+ Topic :: Scientific/Engineering :: Artificial Intelligence
46
+ Topic :: Scientific/Engineering :: Image Processing
47
+ Topic :: Software Development :: Libraries
48
+ Topic :: Software Development :: Libraries :: Python Modules
49
+
50
+
51
+ [options]
52
+ packages = find:
53
+ include_package_data = True
54
+ python_requires = >= 3.6
55
+ install_requires =
56
+ matplotlib>=3.2.1
57
+ numpy>=1.18.2
58
+ opencv-python>=4.2.0.32
59
+ Pillow>=7.0.0
60
+ torch>=1.4.0
61
+ torchvision>=0.5.0
62
+ torchaudio
63
+ scipy
64
+ scikit-learn
65
+
66
+ [options.extras_require]
67
+ demo =
68
+ retinaface-py>=0.0.2
69
+ sort-tracker-py>= 1.0.2
70
+
71
+ [options.packages.find]
72
+ exclude =
73
+ spiga.eval.results*
74
+ colab_tutorials*
SPIGA/spiga/__init__.py ADDED
File without changes
SPIGA/spiga/data/__init__.py ADDED
File without changes
SPIGA/spiga/data/annotations/300wprivate/db_info.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "norm":
3
+ {
4
+ "lnd_bbox": 7,
5
+ "corners": 8,
6
+ "pupils": 8,
7
+ "bbox": 7,
8
+ "height": 4
9
+ },
10
+
11
+ "ldm_ids": [101, 102, 103, 104, 105, 106, 107, 108, 24, 110, 111, 112,
12
+ 113, 114, 115, 116, 117, 1, 119, 2, 121, 3, 4, 124, 5, 126,
13
+ 6, 128, 129, 130, 17, 16, 133, 134, 135, 18, 7, 138, 139, 8,
14
+ 141, 142, 11, 144, 145, 12, 147, 148, 20, 150, 151, 22, 153,
15
+ 154, 21, 156, 157, 23, 159, 160, 161, 162, 163, 164, 165, 166,
16
+ 167, 168],
17
+
18
+ "ldm_flip_order": [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
19
+ 1, 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 27,
20
+ 28, 29, 30, 35, 34, 33, 32, 31, 45, 44, 43, 42, 47,
21
+ 46, 39, 38, 37, 36, 41, 40, 54, 53, 52, 51, 50, 49,
22
+ 48, 59, 58, 57, 56, 55, 64, 63, 62, 61, 60, 67, 66,
23
+ 65],
24
+ "test_subsets":
25
+ {
26
+ "indoor": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299],
27
+ "outdoor": [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599]
28
+ },
29
+
30
+ "ldm_edges_matrix": [ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
31
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
32
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
33
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
34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 1, 0, 0, 0, 0, 0],
78
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
79
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
80
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
81
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
82
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
83
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
84
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
85
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
86
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
87
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
88
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
89
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
90
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
91
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
92
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
93
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
94
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
95
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
96
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
97
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]
98
+ }
SPIGA/spiga/data/annotations/300wprivate/test.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/300wprivate/train.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/300wpublic/db_info.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "norm":
3
+ {
4
+ "corners": 8,
5
+ "pupils": 8,
6
+ "height": 4
7
+ },
8
+
9
+ "ldm_ids": [101, 102, 103, 104, 105, 106, 107, 108, 24, 110, 111, 112,
10
+ 113, 114, 115, 116, 117, 1, 119, 2, 121, 3, 4, 124, 5, 126,
11
+ 6, 128, 129, 130, 17, 16, 133, 134, 135, 18, 7, 138, 139, 8,
12
+ 141, 142, 11, 144, 145, 12, 147, 148, 20, 150, 151, 22, 153,
13
+ 154, 21, 156, 157, 23, 159, 160, 161, 162, 163, 164, 165, 166,
14
+ 167, 168],
15
+
16
+ "ldm_flip_order": [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
17
+ 1, 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 27,
18
+ 28, 29, 30, 35, 34, 33, 32, 31, 45, 44, 43, 42, 47,
19
+ 46, 39, 38, 37, 36, 41, 40, 54, 53, 52, 51, 50, 49,
20
+ 48, 59, 58, 57, 56, 55, 64, 63, 62, 61, 60, 67, 66,
21
+ 65],
22
+ "test_subsets":
23
+ {
24
+ "helen": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329],
25
+ "lfpw": [330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553],
26
+ "common": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553],
27
+ "ibug": [554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688]
28
+ },
29
+
30
+ "ldm_edges_matrix": [ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
31
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
32
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
33
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
34
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
35
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
36
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
37
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
38
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
39
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 1, 0, 0, 0, 0],
84
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
85
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
86
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
87
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
88
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
89
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
90
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
91
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
92
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
93
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
94
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
95
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
96
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
97
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]
98
+ }
SPIGA/spiga/data/annotations/300wpublic/test.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/300wpublic/train.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/cofw68/db_info.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "norm":
3
+ {
4
+ "lnd_bbox": 7,
5
+ "corners": 8,
6
+ "pupils": 8
7
+ },
8
+
9
+ "ldm_ids": [101, 102, 103, 104, 105, 106, 107, 108, 24, 110, 111, 112,
10
+ 113, 114, 115, 116, 117, 1, 119, 2, 121, 3, 4, 124, 5, 126,
11
+ 6, 128, 129, 130, 17, 16, 133, 134, 135, 18, 7, 138, 139, 8,
12
+ 141, 142, 11, 144, 145, 12, 147, 148, 20, 150, 151, 22, 153,
13
+ 154, 21, 156, 157, 23, 159, 160, 161, 162, 163, 164, 165, 166,
14
+ 167, 168],
15
+
16
+ "ldm_flip_order": [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
17
+ 1, 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 27,
18
+ 28, 29, 30, 35, 34, 33, 32, 31, 45, 44, 43, 42, 47,
19
+ 46, 39, 38, 37, 36, 41, 40, 54, 53, 52, 51, 50, 49,
20
+ 48, 59, 58, 57, 56, 55, 64, 63, 62, 61, 60, 67, 66,
21
+ 65],
22
+ "test_subsets":{},
23
+
24
+ "ldm_edges_matrix": [ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
25
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
26
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
27
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
28
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
29
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
30
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
31
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
32
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
33
+ [1, 0,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 0, 0, 0],
77
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
78
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
79
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
80
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
81
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
82
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
83
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
84
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
85
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
86
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
87
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
88
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
89
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
90
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
91
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]
92
+ }
SPIGA/spiga/data/annotations/cofw68/test.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/merlrav/db_info.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "norm":
3
+ {
4
+ "lnd_bbox": 7
5
+ },
6
+
7
+ "ldm_ids": [101, 102, 103, 104, 105, 106, 107, 108, 24, 110, 111, 112,
8
+ 113, 114, 115, 116, 117, 1, 119, 2, 121, 3, 4, 124, 5, 126,
9
+ 6, 128, 129, 130, 17, 16, 133, 134, 135, 18, 7, 138, 139, 8,
10
+ 141, 142, 11, 144, 145, 12, 147, 148, 20, 150, 151, 22, 153,
11
+ 154, 21, 156, 157, 23, 159, 160, 161, 162, 163, 164, 165, 166,
12
+ 167, 168],
13
+
14
+ "ldm_flip_order": [16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
15
+ 1, 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 27,
16
+ 28, 29, 30, 35, 34, 33, 32, 31, 45, 44, 43, 42, 47,
17
+ 46, 39, 38, 37, 36, 41, 40, 54, 53, 52, 51, 50, 49,
18
+ 48, 59, 58, 57, 56, 55, 64, 63, 62, 61, 60, 67, 66,
19
+ 65],
20
+ "test_subsets":
21
+ {
22
+ "frontal": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194],
23
+ "half_profile": [2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864],
24
+ "half_profile_left": [2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010],
25
+ "half_profile_right": [3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864],
26
+ "profile": [2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558],
27
+ "profile_left": [2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715],
28
+ "profile_right": [3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558]
29
+ },
30
+
31
+ "ldm_edges_matrix": [ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
32
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
33
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
34
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
35
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
36
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
37
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
38
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
39
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
40
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
41
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
42
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
43
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
44
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
45
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
46
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
91
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
92
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
93
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
94
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
95
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
96
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
97
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
98
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]]
99
+ }
SPIGA/spiga/data/annotations/merlrav/test.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd1e358a29f95f869fa5fd09cb37c335a2220b5b478565459221921540aeb236
3
+ size 11312227
SPIGA/spiga/data/annotations/merlrav/train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e8bfb36c27776d8386dfbee682af65332b1dad03faaedb9533b6b39acb230e9
3
+ size 43323888
SPIGA/spiga/data/annotations/wflw/db_info.json ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "norm":
3
+ {
4
+ "corners": 10,
5
+ "pupils": 8
6
+ },
7
+
8
+ "ldm_ids": [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
9
+ 112, 113, 114, 115, 24, 117, 118, 119, 120, 121, 122, 123,
10
+ 124, 125, 126, 127, 128, 129, 130, 131, 132, 1, 134, 2, 136,
11
+ 3, 138, 139, 140, 141, 4, 143, 5, 145, 6, 147, 148, 149, 150,
12
+ 151, 152, 153, 17, 16, 156, 157, 158, 18, 7, 161, 9, 163, 8,
13
+ 165, 10, 167, 11, 169, 13, 171, 12, 173, 14, 175, 20, 177, 178,
14
+ 22, 180, 181, 21, 183, 184, 23, 186, 187, 188, 189, 190, 191,
15
+ 192, 193, 194, 195, 196, 197],
16
+
17
+ "ldm_flip_order": [32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20,
18
+ 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
19
+ 5, 4, 3, 2, 1, 0,
20
+ 46, 45, 44, 43, 42, 50, 49, 48, 47,
21
+ 37, 36, 35, 34, 33, 41, 40, 39, 38,
22
+ 51, 52, 53, 54,
23
+ 59, 58, 57, 56, 55,
24
+ 72, 71, 70, 69, 68, 75, 74, 73,
25
+ 64, 63, 62, 61, 60, 67, 66, 65,
26
+ 82, 81, 80, 79, 78, 77, 76,
27
+ 87, 86, 85, 84, 83,
28
+ 92, 91, 90, 89, 88,
29
+ 95, 94, 93,
30
+ 97, 96],
31
+
32
+ "test_subsets":
33
+ {
34
+ "pose": [305, 310, 312, 328, 338, 392, 395, 403, 407, 415, 438, 478, 494, 498, 511, 529, 535, 564,
35
+ 572, 577, 582, 609, 619, 650, 655, 662, 669, 671, 673, 680, 704, 733, 765, 768, 804, 826, 837, 838, 839, 844, 845,
36
+ 878, 893, 935, 942, 966, 969, 972, 1007, 1009, 1015, 1018, 1023, 1100, 1121, 1125, 1148, 1172, 1180, 1186, 1221,
37
+ 1311, 1335, 1378, 1379, 1403, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421,
38
+ 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440,
39
+ 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459,
40
+ 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478,
41
+ 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497,
42
+ 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516,
43
+ 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535,
44
+ 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554,
45
+ 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573,
46
+ 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592,
47
+ 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611,
48
+ 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630,
49
+ 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1668, 1711, 1719, 1723, 1822, 1907, 1912, 1933,
50
+ 1962, 1964, 1974, 2010, 2043, 2089, 2094, 2108, 2170, 2181, 2187, 2220, 2317, 2335, 2389, 2391, 2459, 2489],
51
+ "expression": [310, 329, 357, 380, 396, 400, 408, 410, 417, 450, 452, 461, 469, 472, 501, 502, 505, 506, 516, 533,
52
+ 541, 568, 585, 588, 597, 600, 624, 649, 652, 655, 701, 724, 751, 789, 817, 874, 884, 918, 1010, 1032, 1066, 1091,
53
+ 1095, 1220, 1272, 1298, 1303, 1347, 1356, 1398, 1428, 1445, 1462, 1464, 1470, 1482, 1507, 1512, 1520, 1536, 1541,
54
+ 1543, 1545, 1548, 1565, 1587, 1598, 1638, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653,
55
+ 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672,
56
+ 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691,
57
+ 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710,
58
+ 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729,
59
+ 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748,
60
+ 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767,
61
+ 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786,
62
+ 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805,
63
+ 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824,
64
+ 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843,
65
+ 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862,
66
+ 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1910, 1930, 1965, 2013, 2024, 2069, 2263, 2272,
67
+ 2276, 2315, 2360, 2375, 2406, 2412],
68
+ "illumination": [306, 309, 312, 314, 321, 325, 327, 330, 335, 336, 338, 351, 353, 360, 361, 364, 368, 370, 372, 373,
69
+ 374, 375, 381, 384, 388, 394, 404, 405, 410, 411, 415, 417, 418, 434, 435, 438, 448, 450, 454, 458, 460, 468, 469,
70
+ 473, 476, 479, 481, 485, 487, 490, 492, 497, 503, 504, 505, 508, 512, 513, 514, 516, 517, 519, 525, 532, 536, 541,
71
+ 544, 549, 553, 555, 558, 561, 562, 568, 573, 580, 582, 588, 592, 593, 596, 607, 611, 615, 619, 622, 624, 626, 627,
72
+ 628, 629, 631, 632, 635, 636, 643, 648, 661, 666, 671, 673, 676, 680, 686, 693, 695, 697, 701, 702, 706, 710, 715,
73
+ 719, 721, 723, 725, 726, 731, 732, 734, 738, 745, 750, 765, 770, 774, 781, 784, 787, 790, 796, 804, 805, 807, 810,
74
+ 821, 832, 834, 838, 841, 842, 843, 844, 849, 853, 856, 866, 874, 887, 899, 900, 901, 902, 906, 909, 910, 911, 919,
75
+ 921, 924, 929, 931, 939, 941, 942, 957, 959, 962, 964, 965, 968, 971, 972, 974, 983, 984, 987, 990, 996, 998,
76
+ 1001, 1003, 1004, 1021, 1022, 1036, 1048, 1053, 1056, 1057, 1058, 1064, 1068, 1072, 1079, 1094, 1095, 1096, 1102,
77
+ 1104, 1105, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126,
78
+ 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145,
79
+ 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164,
80
+ 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183,
81
+ 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202,
82
+ 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221,
83
+ 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240,
84
+ 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259,
85
+ 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278,
86
+ 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297,
87
+ 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316,
88
+ 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335,
89
+ 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354,
90
+ 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373,
91
+ 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392,
92
+ 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1418, 1441, 1448,
93
+ 1450, 1454, 1469, 1484, 1495, 1497, 1510, 1521, 1523, 1533, 1535, 1555, 1573, 1574, 1577, 1585, 1604, 1608, 1609,
94
+ 1613, 1616, 1619, 1621, 1622, 1635, 1637, 1649, 1661, 1664, 1668, 1671, 1691, 1698, 1721, 1731, 1738, 1740, 1741,
95
+ 1745, 1760, 1767, 1768, 1783, 1787, 1788, 1793, 1796, 1798, 1801, 1813, 1826, 1835, 1836, 1849, 1850, 1851, 1852,
96
+ 1853, 1865, 1869, 1872, 1877, 1886, 1904, 1907, 1908, 1910, 1914, 1921, 1923, 1942, 1947, 1953, 1954, 1955, 1956,
97
+ 1958, 1966, 1968, 1969, 1970, 1980, 1989, 1992, 2000, 2018, 2019, 2029, 2036, 2038, 2039, 2040, 2064, 2070, 2078,
98
+ 2080, 2081, 2084, 2088, 2090, 2098, 2106, 2112, 2123, 2128, 2135, 2145, 2151, 2163, 2171, 2172, 2176, 2180, 2183,
99
+ 2184, 2186, 2192, 2196, 2201, 2204, 2208, 2209, 2213, 2215, 2218, 2223, 2226, 2236, 2240, 2242, 2245, 2246, 2253,
100
+ 2264, 2270, 2273, 2280, 2281, 2285, 2287, 2288, 2289, 2290, 2301, 2313, 2314, 2321, 2323, 2331, 2334, 2336, 2337,
101
+ 2343, 2354, 2355, 2357, 2358, 2361, 2367, 2368, 2371, 2374, 2375, 2377, 2381, 2384, 2385, 2386, 2394, 2395, 2397,
102
+ 2407, 2409, 2413, 2414, 2425, 2429, 2434, 2435, 2439, 2444, 2445, 2448, 2449, 2451, 2454, 2466, 2467, 2480, 2481,
103
+ 2484, 2487, 2489, 2491, 2497],
104
+ "makeup": [313, 425, 464, 468, 501, 551, 614, 621, 707, 769, 776, 846, 870, 878, 900, 910, 925, 952, 960, 961, 965,
105
+ 981, 1237, 1242, 1380, 1395, 1503, 1574, 1633, 1668, 1708, 1764, 1791, 1837, 1860, 1874, 1875, 1876, 1877, 1878,
106
+ 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897,
107
+ 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916,
108
+ 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935,
109
+ 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954,
110
+ 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973,
111
+ 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992,
112
+ 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
113
+ 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030,
114
+ 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2265, 2290, 2293, 2381, 2486, 2490],
115
+ "occlusion": [300, 301, 310, 328, 329, 332, 333, 335, 336, 338, 339, 342, 343, 356, 362, 367, 370, 374, 377, 384,
116
+ 401, 406, 408, 417, 421, 423, 426, 427, 434, 435, 440, 453, 457, 461, 465, 466, 472, 475, 476, 479, 489, 497, 500,
117
+ 504, 506, 514, 515, 518, 520, 524, 525, 536, 543, 546, 558, 559, 563, 564, 567, 568, 574, 577, 584, 589, 590, 592,
118
+ 594, 602, 605, 609, 610, 614, 618, 627, 638, 640, 643, 645, 646, 652, 658, 661, 663, 666, 672, 674, 677, 682, 685,
119
+ 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722,
120
+ 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745,
121
+ 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,
122
+ 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
123
+ 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814,
124
+ 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837,
125
+ 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860,
126
+ 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883,
127
+ 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906,
128
+ 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929,
129
+ 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
130
+ 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975,
131
+ 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998,
132
+ 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
133
+ 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036,
134
+ 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
135
+ 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074,
136
+ 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093,
137
+ 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1112, 1121,
138
+ 1127, 1129, 1135, 1136, 1143, 1146, 1147, 1148, 1151, 1160, 1161, 1166, 1170, 1177, 1180, 1190, 1191, 1195, 1201,
139
+ 1218, 1223, 1231, 1233, 1239, 1240, 1241, 1245, 1248, 1260, 1275, 1277, 1278, 1280, 1283, 1292, 1298, 1299, 1313,
140
+ 1320, 1328, 1333, 1338, 1339, 1342, 1347, 1355, 1363, 1368, 1373, 1377, 1382, 1383, 1384, 1389, 1390, 1391, 1399,
141
+ 1401, 1404, 1405, 1412, 1415, 1422, 1426, 1427, 1431, 1438, 1450, 1479, 1485, 1489, 1493, 1497, 1499, 1506, 1516,
142
+ 1524, 1526, 1531, 1533, 1534, 1547, 1555, 1560, 1561, 1592, 1595, 1603, 1616, 1622, 1625, 1632, 1647, 1650, 1651,
143
+ 1655, 1657, 1658, 1661, 1665, 1667, 1672, 1683, 1684, 1694, 1702, 1708, 1711, 1713, 1722, 1723, 1728, 1734, 1748,
144
+ 1750, 1752, 1753, 1757, 1764, 1775, 1793, 1794, 1801, 1809, 1813, 1820, 1832, 1838, 1841, 1856, 1864, 1866, 1869,
145
+ 1878, 1882, 1895, 1898, 1921, 1930, 1931, 1936, 1941, 1946, 1947, 1953, 1975, 1979, 1982, 1983, 1985, 1989, 1999,
146
+ 2013, 2021, 2026, 2042, 2044, 2047, 2048, 2059, 2069, 2077, 2083, 2085, 2086, 2087, 2094, 2110, 2112, 2122, 2128,
147
+ 2131, 2134, 2136, 2139, 2144, 2151, 2155, 2163, 2175, 2190, 2197, 2199, 2208, 2209, 2211, 2213, 2238, 2246, 2279,
148
+ 2301, 2305, 2316, 2321, 2324, 2328, 2329, 2331, 2335, 2339, 2340, 2348, 2351, 2354, 2364, 2367, 2370, 2371, 2372,
149
+ 2376, 2379, 2381, 2391, 2402, 2409, 2410, 2411, 2412, 2413, 2430, 2433, 2435, 2449, 2450, 2466, 2471, 2473, 2476,
150
+ 2478, 2484, 2485, 2487, 2491, 2494],
151
+ "blur": [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
152
+ 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
153
+ 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
154
+ 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389,
155
+ 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412,
156
+ 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435,
157
+ 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458,
158
+ 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481,
159
+ 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504,
160
+ 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527,
161
+ 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550,
162
+ 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573,
163
+ 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596,
164
+ 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619,
165
+ 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642,
166
+ 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665,
167
+ 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688,
168
+ 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 702, 705, 714, 725, 731, 738, 740, 742, 745, 746, 748, 752,
169
+ 753, 754, 756, 760, 765, 766, 773, 780, 784, 785, 787, 796, 798, 799, 800, 804, 808, 809, 812, 813, 816, 817, 823,
170
+ 824, 827, 832, 834, 838, 865, 872, 874, 879, 882, 889, 891, 899, 901, 908, 911, 918, 924, 929, 931, 932, 938, 941,
171
+ 951, 953, 954, 959, 960, 965, 968, 969, 971, 977, 985, 989, 991, 995, 999, 1001, 1004, 1018, 1021, 1026, 1029,
172
+ 1031, 1033, 1040, 1050, 1056, 1060, 1061, 1069, 1074, 1076, 1084, 1085, 1099, 1103, 1109, 1115, 1117, 1118, 1120,
173
+ 1124, 1127, 1133, 1142, 1146, 1148, 1149, 1151, 1171, 1177, 1178, 1181, 1184, 1185, 1187, 1191, 1193, 1194, 1201,
174
+ 1202, 1206, 1217, 1224, 1226, 1227, 1231, 1232, 1236, 1237, 1246, 1250, 1254, 1255, 1258, 1260, 1262, 1263, 1266,
175
+ 1269, 1270, 1278, 1280, 1283, 1286, 1288, 1293, 1300, 1301, 1315, 1317, 1320, 1324, 1325, 1333, 1363, 1365, 1370,
176
+ 1373, 1380, 1382, 1386, 1392, 1396, 1400, 1402, 1403, 1413, 1421, 1422, 1424, 1434, 1442, 1450, 1451, 1459, 1464,
177
+ 1468, 1475, 1481, 1483, 1495, 1506, 1510, 1518, 1519, 1522, 1546, 1554, 1559, 1570, 1573, 1577, 1578, 1589, 1593,
178
+ 1601, 1603, 1608, 1609, 1612, 1613, 1614, 1616, 1618, 1619, 1633, 1642, 1644, 1647, 1649, 1652, 1653, 1658, 1660,
179
+ 1663, 1664, 1670, 1672, 1673, 1689, 1691, 1695, 1705, 1710, 1712, 1714, 1716, 1718, 1720, 1727, 1731, 1735, 1737,
180
+ 1739, 1742, 1750, 1761, 1765, 1768, 1770, 1776, 1779, 1782, 1785, 1788, 1796, 1811, 1813, 1815, 1826, 1828, 1831,
181
+ 1838, 1853, 1854, 1860, 1864, 1875, 1878, 1883, 1885, 1887, 1891, 1915, 1919, 1921, 1923, 1926, 1936, 1940, 1941,
182
+ 1942, 1951, 1954, 1957, 1975, 1978, 1981, 1997, 1998, 2005, 2015, 2021, 2028, 2031, 2036, 2040, 2042, 2046, 2047,
183
+ 2054, 2060, 2066, 2069, 2076, 2077, 2078, 2083, 2085, 2090, 2093, 2099, 2106, 2112, 2117, 2132, 2135, 2136, 2148,
184
+ 2151, 2158, 2162, 2163, 2167, 2169, 2172, 2173, 2184, 2186, 2194, 2201, 2203, 2225, 2229, 2235, 2237, 2242, 2259,
185
+ 2260, 2269, 2270, 2279, 2281, 2284, 2290, 2298, 2301, 2305, 2309, 2311, 2312, 2313, 2317, 2318, 2325, 2328, 2333,
186
+ 2335, 2336, 2337, 2341, 2344, 2357, 2371, 2372, 2374, 2375, 2380, 2390, 2396, 2397, 2410, 2418, 2419, 2423, 2428,
187
+ 2444, 2457, 2458, 2464, 2472, 2473, 2476, 2488, 2489]
188
+ },
189
+ "ldm_edges_matrix": [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
190
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
191
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
192
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
193
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
194
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
195
+ [1, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0],
273
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
274
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
275
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
276
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
277
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
278
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
279
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
280
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
281
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
282
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
283
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
284
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
285
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
286
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
287
+ ]
288
+ }
SPIGA/spiga/data/annotations/wflw/test.json ADDED
The diff for this file is too large to render. See raw diff
 
SPIGA/spiga/data/annotations/wflw/train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95dcb0a2479e759da5e7051ad5c62eae90af3987614cfb0731802139f24e210a
3
+ size 28374603
SPIGA/spiga/data/loaders/__init__.py ADDED
File without changes
SPIGA/spiga/data/loaders/alignments.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import cv2
4
+ import numpy as np
5
+ from PIL import Image
6
+ from torch.utils.data import Dataset
7
+ from torchvision import transforms
8
+
9
+ from spiga.data.loaders.transforms import get_transformers
10
+
11
+
12
+ class AlignmentsDataset(Dataset):
13
+ '''Loads datasets of images with landmarks and bounding boxes.
14
+ '''
15
+
16
+ def __init__(self,
17
+ database,
18
+ json_file,
19
+ images_dir,
20
+ image_size=(128, 128),
21
+ transform=None,
22
+ indices=None,
23
+ debug=False):
24
+ """
25
+
26
+ :param database: class DatabaseStruct containing all the specifics of the database
27
+
28
+ :param json_file: path to the json file which contains the names of the images, landmarks, bounding boxes, etc
29
+
30
+ :param images_dir: path of the directory containing the images.
31
+
32
+ :param image_size: tuple like e.g. (128, 128)
33
+
34
+ :param transform: composition of transformations that will be applied to the samples.
35
+
36
+ :param debug_mode: bool if True, loads a very reduced_version of the dataset for debugging purposes.
37
+
38
+ :param indices: If it is a list of indices, allows to work with the subset of
39
+ items specified by the list. If it is None, the whole set is used.
40
+ """
41
+
42
+ self.database = database
43
+ self.images_dir = images_dir
44
+ self.transform = transform
45
+ self.image_size = image_size
46
+ self.indices = indices
47
+ self._imgs_dict = None
48
+ self.debug = debug
49
+
50
+ with open(json_file) as jsonfile:
51
+ self.data = json.load(jsonfile)
52
+
53
+ def __len__(self):
54
+ '''Returns the length of the dataset
55
+ '''
56
+ if self.indices is None:
57
+ return len(self.data)
58
+ else:
59
+ return len(self.indices)
60
+
61
+ def __getitem__(self, sample_idx):
62
+ '''Returns sample of the dataset of index idx'''
63
+
64
+ # To allow work with a subset
65
+ if self.indices is not None:
66
+ sample_idx = self.indices[sample_idx]
67
+
68
+ # Load sample image
69
+ img_name = os.path.join(self.images_dir, self.data[sample_idx]['imgpath'])
70
+ if not self._imgs_dict:
71
+ image_cv = cv2.imread(img_name)
72
+ else:
73
+ image_cv = self._imgs_dict[sample_idx]
74
+
75
+ # Some images are B&W. We make sure that any image has three channels.
76
+ if len(image_cv.shape) == 2:
77
+ image_cv = np.repeat(image_cv[:, :, np.newaxis], 3, axis=-1)
78
+
79
+ # Some images have alpha channel
80
+ image_cv = image_cv[:, :, :3]
81
+
82
+ image_cv = cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB)
83
+ image = Image.fromarray(image_cv)
84
+
85
+ # Load sample anns
86
+ ids = np.array(self.data[sample_idx]['ids'])
87
+ landmarks = np.array(self.data[sample_idx]['landmarks'])
88
+ bbox = np.array(self.data[sample_idx]['bbox'])
89
+ vis = np.array(self.data[sample_idx]['visible'])
90
+ headpose = self.data[sample_idx]['headpose']
91
+
92
+ # Generate bbox if need it
93
+ if bbox is None:
94
+ # Compute bbox using landmarks
95
+ aux = landmarks[vis == 1.0]
96
+ bbox = np.zeros(4)
97
+ bbox[0] = min(aux[:, 0])
98
+ bbox[1] = min(aux[:, 1])
99
+ bbox[2] = max(aux[:, 0]) - bbox[0]
100
+ bbox[3] = max(aux[:, 1]) - bbox[1]
101
+
102
+ # Clean and mask landmarks
103
+ mask_ldm = np.ones(self.database.num_landmarks)
104
+ if not self.database.ldm_ids == ids.tolist():
105
+ new_ldm = np.zeros((self.database.num_landmarks, 2))
106
+ new_vis = np.zeros(self.database.num_landmarks)
107
+ xyv = np.hstack((landmarks, vis[np.newaxis,:].T))
108
+ ids_dict = dict(zip(ids.astype(int).astype(str), xyv))
109
+
110
+ for pos, identifier in enumerate(self.database.ldm_ids):
111
+ if str(identifier) in ids_dict:
112
+ x, y, v = ids_dict[str(identifier)]
113
+ new_ldm[pos] = [x,y]
114
+ new_vis[pos] = v
115
+ else:
116
+ mask_ldm[pos] = 0
117
+ landmarks = new_ldm
118
+ vis = new_vis
119
+
120
+ sample = {'image': image,
121
+ 'sample_idx': sample_idx,
122
+ 'imgpath': img_name,
123
+ 'ids_ldm': np.array(self.database.ldm_ids),
124
+ 'bbox': bbox,
125
+ 'bbox_raw': bbox,
126
+ 'landmarks': landmarks,
127
+ 'visible': vis.astype(np.float64),
128
+ 'mask_ldm': mask_ldm,
129
+ 'imgpath_local': self.data[sample_idx]['imgpath'],
130
+ }
131
+
132
+ if self.debug:
133
+ sample['landmarks_ori'] = landmarks
134
+ sample['visible_ori'] = vis.astype(np.float64)
135
+ sample['mask_ldm_ori'] = mask_ldm
136
+ if headpose is not None:
137
+ sample['headpose_ori'] = np.array(headpose)
138
+
139
+ if self.transform:
140
+ sample = self.transform(sample)
141
+
142
+ return sample
143
+
144
+
145
+ def get_dataset(data_config, pretreat=None, debug=False):
146
+
147
+ augmentors = get_transformers(data_config)
148
+ if pretreat is not None:
149
+ augmentors.append(pretreat)
150
+
151
+ dataset = AlignmentsDataset(data_config.database,
152
+ data_config.anns_file,
153
+ data_config.image_dir,
154
+ image_size=data_config.image_size,
155
+ transform=transforms.Compose(augmentors),
156
+ indices=data_config.ids,
157
+ debug=debug)
158
+ return dataset
SPIGA/spiga/data/loaders/augmentors/__init__.py ADDED
File without changes
SPIGA/spiga/data/loaders/augmentors/boundary.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from scipy import interpolate
3
+ import cv2
4
+
5
+
6
+ class AddBoundary(object):
7
+ def __init__(self, num_landmarks=68, map_size=64, sigma=1, min_dpi=64):
8
+ self.num_landmarks = num_landmarks
9
+ self.sigma = sigma
10
+
11
+ if isinstance(map_size, (tuple, list)):
12
+ self.width = map_size[0]
13
+ self.height = map_size[1]
14
+ else:
15
+ self.width = map_size
16
+ self.height = map_size
17
+
18
+ if max(map_size) > min_dpi:
19
+ self.dpi = max(map_size)
20
+ else:
21
+ self.dpi = min_dpi
22
+
23
+ self.fig_size =[self.height/self.dpi, self.width/self.dpi]
24
+
25
+ def __call__(self, sample):
26
+ landmarks = sample['landmarks_float']
27
+ mask_lnd = sample['mask_ldm_float']
28
+ boundaries = self.get_dataset_boundaries(landmarks, mask_lnd)
29
+ functions = {}
30
+
31
+ for key, points in boundaries.items():
32
+ if len(points) != 0:
33
+ temp = points[0]
34
+ new_points = points[0:1, :]
35
+ for point in points[1:]:
36
+ if point[0] == temp[0] and point[1] == temp[1]:
37
+ continue
38
+ else:
39
+ new_points = np.concatenate((new_points, np.expand_dims(point, 0)), axis=0)
40
+ temp = point
41
+
42
+ points = new_points
43
+ if points.shape[0] == 1:
44
+ points = np.concatenate((points, points+0.001), axis=0)
45
+ k = min(4, points.shape[0])
46
+ functions[key] = interpolate.splprep([points[:, 0], points[:, 1]], k=k-1,s=0)
47
+
48
+ boundary_maps = np.zeros((len(boundaries), self.height, self.width))
49
+ for i_map, key in enumerate(functions.keys()):
50
+ boundary_map = np.zeros((self.height, self.width))
51
+ xnew = np.arange(0, 1, 1/self.dpi)
52
+ out = interpolate.splev(xnew, functions[key][0], der=0)
53
+
54
+ out = np.round(out).astype(int).transpose()
55
+ out = out[out[:, 0] < self.height]
56
+ out = out[out[:, 1] < self.width]
57
+ boundary_map[out[:,1], out[:,0]]= 255
58
+
59
+ # Smooth
60
+ sigma = self.sigma
61
+ temp = 255 - boundary_map.astype(np.uint8)
62
+ temp = cv2.distanceTransform(temp, cv2.DIST_L2, cv2.DIST_MASK_PRECISE)
63
+ temp = temp.astype(np.float32)
64
+ temp = np.where(temp < 3*sigma, np.exp(-(temp*temp)/(2*sigma*sigma)), 0 )
65
+ boundary_maps[i_map] = temp
66
+
67
+ sample['boundary'] = boundary_maps
68
+ return sample
69
+
70
+ def get_dataset_boundaries(self, landmarks, mask_lnd):
71
+ boundaries = {}
72
+ if self.num_landmarks == 68:
73
+ cheek = landmarks[0:17]
74
+ boundaries['cheek'] = cheek[mask_lnd[0:17] > 0]
75
+ left_eyebrow = landmarks[17:22]
76
+ boundaries['left_eyebrow'] = left_eyebrow[mask_lnd[17:22] > 0]
77
+ right_eyebrow = landmarks[22:27]
78
+ boundaries['right_eyebrow'] = right_eyebrow[mask_lnd[22:27] > 0]
79
+ nose = landmarks[27:31]
80
+ boundaries['nose'] = nose[mask_lnd[27:31] > 0]
81
+ nose_bot = landmarks[31:36]
82
+ boundaries['nose_bot'] = nose_bot[mask_lnd[31:36] > 0]
83
+ uper_left_eyelid = landmarks[36:40]
84
+ boundaries['upper_left_eyelid'] = uper_left_eyelid[mask_lnd[36:40] > 0]
85
+ lower_left_eyelid = np.array([landmarks[i] for i in [36, 41, 40, 39]])
86
+ lower_left_eyelid_mask = np.array([mask_lnd[i] for i in [36, 41, 40, 39]])
87
+ boundaries['lower_left_eyelid'] = lower_left_eyelid[lower_left_eyelid_mask > 0]
88
+ upper_right_eyelid = landmarks[42:46]
89
+ boundaries['upper_right_eyelid'] = upper_right_eyelid[mask_lnd[42:46] > 0]
90
+ lower_right_eyelid = np.array([landmarks[i] for i in [42, 47, 46, 45]])
91
+ lower_right_eyelid_mask = np.array([mask_lnd[i] for i in [42, 47, 46, 45]])
92
+ boundaries['lower_right_eyelid'] = lower_right_eyelid[lower_right_eyelid_mask > 0]
93
+ upper_outer_lip = landmarks[48:55]
94
+ boundaries['upper_outer_lip'] = upper_outer_lip[mask_lnd[48:55] > 0]
95
+ lower_outer_lip = np.array([landmarks[i] for i in [48, 59, 58, 57, 56, 55, 54]])
96
+ lower_outer_lip_mask = np.array([mask_lnd[i] for i in [48, 59, 58, 57, 56, 55, 54]])
97
+ boundaries['lower_outer_lip'] = lower_outer_lip[lower_outer_lip_mask > 0]
98
+ upper_inner_lip = np.array([landmarks[i] for i in [60, 61, 62, 63, 64]])
99
+ upper_inner_lip_mask = np.array([mask_lnd[i] for i in [60, 61, 62, 63, 64]])
100
+ boundaries['upper_inner_lip'] = upper_inner_lip[upper_inner_lip_mask > 0]
101
+ lower_inner_lip = np.array([landmarks[i] for i in [60, 67, 66, 65, 64]])
102
+ lower_inner_lip_mask = np.array([mask_lnd[i] for i in [60, 67, 66, 65, 64]])
103
+ boundaries['lower_inner_lip'] = lower_inner_lip[lower_inner_lip_mask > 0]
104
+
105
+ elif self.num_landmarks == 98:
106
+ boundaries['cheek'] = landmarks[0:33]
107
+ boundaries['upper_left_eyebrow'] = landmarks[33:38]
108
+ boundaries['lower_left_eyebrow'] = np.array([landmarks[i] for i in [33, 41, 40, 39, 38]])
109
+ boundaries['upper_right_eyebrow'] = landmarks[42:47]
110
+ boundaries['lower_right_eyebrow'] = landmarks[46:51]
111
+ boundaries['nose'] = landmarks[51:55]
112
+ boundaries['nose_bot'] = landmarks[55:60]
113
+ boundaries['upper_left_eyelid'] = landmarks[60:65]
114
+ boundaries['lower_left_eyelid'] = np.array([landmarks[i] for i in [60, 67, 66, 65, 64]])
115
+ boundaries['upper_right_eyelid'] = landmarks[68:73]
116
+ boundaries['lower_right_eyelid'] = np.array([landmarks[i] for i in [68, 75, 74, 73, 72]])
117
+ boundaries['upper_outer_lip'] = landmarks[76:83]
118
+ boundaries['lower_outer_lip'] = np.array([landmarks[i] for i in [76, 87, 86, 85, 84, 83, 82]])
119
+ boundaries['upper_inner_lip'] = np.array([landmarks[i] for i in [88, 89, 90, 91, 92]])
120
+ boundaries['lower_inner_lip'] = np.array([landmarks[i] for i in [88, 95, 94, 93, 92]])
121
+
122
+ return boundaries
SPIGA/spiga/data/loaders/augmentors/heatmaps.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+
4
+ class Heatmaps:
5
+
6
+ def __init__(self, num_maps, map_size, sigma, stride=1, norm=True):
7
+ self.num_maps = num_maps
8
+ self.sigma = sigma
9
+ self.double_sigma_pw2 = 2*sigma*sigma
10
+ self.doublepi_sigma_pw2 = self.double_sigma_pw2 * np.pi
11
+ self.stride = stride
12
+ self.norm = norm
13
+
14
+ if isinstance(map_size, (tuple, list)):
15
+ self.width = map_size[0]
16
+ self.height = map_size[1]
17
+ else:
18
+ self.width = map_size
19
+ self.height = map_size
20
+
21
+ grid_x = np.arange(self.width) * stride + stride / 2 - 0.5
22
+ self.grid_x = np.repeat(grid_x.reshape(1, self.width), self.num_maps, axis=0)
23
+ grid_y = np.arange(self.height) * stride + stride / 2 - 0.5
24
+ self.grid_y = np.repeat(grid_y.reshape(1, self.height), self.num_maps, axis=0)
25
+
26
+ def __call__(self, sample):
27
+ landmarks = sample['landmarks']
28
+ landmarks = landmarks[-self.num_maps:]
29
+
30
+ # Heatmap generation
31
+ exp_x = np.exp(-(self.grid_x - landmarks[:, 0].reshape(-1, 1)) ** 2 / self.double_sigma_pw2)
32
+ exp_y = np.exp(-(self.grid_y - landmarks[:, 1].reshape(-1, 1)) ** 2 / self.double_sigma_pw2)
33
+ heatmaps = np.matmul(exp_y.reshape(self.num_maps, self.height, 1), exp_x.reshape(self.num_maps, 1, self.width))
34
+
35
+ if self.norm:
36
+ heatmaps = heatmaps/self.doublepi_sigma_pw2
37
+
38
+ sample['heatmap2D'] = heatmaps
39
+ return sample
SPIGA/spiga/data/loaders/augmentors/landmarks.py ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import cv2
3
+ import numpy as np
4
+ from PIL import Image
5
+ from torchvision import transforms
6
+
7
+ # My libs
8
+ import spiga.data.loaders.augmentors.utils as dlu
9
+
10
+
11
+ class HorizontalFlipAug:
12
+ def __init__(self, ldm_flip_order, prob=0.5):
13
+ self.prob = prob
14
+ self.ldm_flip_order = ldm_flip_order
15
+
16
+ def __call__(self, sample):
17
+ img = sample['image']
18
+ landmarks = sample['landmarks']
19
+ mask = sample['mask_ldm']
20
+ vis = sample['visible']
21
+ bbox = sample['bbox']
22
+
23
+ if random.random() < self.prob:
24
+ new_img = transforms.functional.hflip(img)
25
+
26
+ lm_new_order = self.ldm_flip_order
27
+ new_landmarks = landmarks[lm_new_order]
28
+ new_landmarks = (new_landmarks - (img.size[0], 0)) * (-1, 1)
29
+ new_mask = mask[lm_new_order]
30
+ new_vis = vis[lm_new_order]
31
+
32
+ x, y, w, h = bbox
33
+ new_x = img.size[0] - x - w
34
+ new_bbox = np.array((new_x, y, w, h))
35
+
36
+ sample['image'] = new_img
37
+ sample['landmarks'] = new_landmarks
38
+ sample['mask_ldm'] = new_mask
39
+ sample['visible'] = new_vis
40
+ sample['bbox'] = new_bbox
41
+
42
+ return sample
43
+
44
+
45
+ class GeometryBaseAug:
46
+
47
+ def __call__(self, sample):
48
+ raise NotImplementedError('Inheritance __call__ not defined')
49
+
50
+ def map_affine_transformation(self, sample, affine_transf, new_size=None):
51
+ sample['image'] = self._image_affine_trans(sample['image'], affine_transf, new_size)
52
+ sample['bbox'] = self._bbox_affine_trans(sample['bbox'], affine_transf)
53
+ if 'landmarks' in sample.keys():
54
+ sample['landmarks'] = self._landmarks_affine_trans(sample['landmarks'], affine_transf)
55
+ return sample
56
+
57
+ def clean_outbbox_landmarks(self, shape, landmarks, mask):
58
+ filter_x1 = landmarks[:, 0] >= shape[0]
59
+ filter_x2 = landmarks[:, 0] < (shape[0] + shape[2])
60
+ filter_x = np.logical_and(filter_x1,filter_x2)
61
+
62
+ filter_y1 = landmarks[:, 1] >= shape[1]
63
+ filter_y2 = landmarks[:, 1] < (shape[1] + shape[3])
64
+ filter_y = np.logical_and(filter_y1, filter_y2)
65
+
66
+ filter_bbox = np.logical_and(filter_x, filter_y)
67
+ new_mask = mask*filter_bbox
68
+ new_landmarks = (landmarks.T * new_mask).T
69
+ new_landmarks = new_landmarks.astype(int).astype(float)
70
+ return new_mask, new_landmarks
71
+
72
+ def _image_affine_trans(self, image, affine_transf, new_size=None):
73
+
74
+ if not new_size:
75
+ new_size = image.size
76
+
77
+ inv_affine_transf = dlu.get_inverse_transf(affine_transf)
78
+ new_image = image.transform(new_size, Image.AFFINE, inv_affine_transf.flatten())
79
+ return new_image
80
+
81
+ def _bbox_affine_trans(self, bbox, affine_transf):
82
+
83
+ x, y, w, h = bbox
84
+ images_bb = []
85
+ for point in ([x, y, 1], [x + w, y, 1],
86
+ [x, y + h, 1], [x + w, y + h, 1]):
87
+ images_bb.append(affine_transf.dot(point))
88
+ images_bb = np.array(images_bb)
89
+
90
+ new_corner0 = np.min(images_bb, axis=0)
91
+ new_corner1 = np.max(images_bb, axis=0)
92
+
93
+ new_x, new_y = new_corner0
94
+ new_w, new_h = new_corner1 - new_corner0
95
+ new_bbox = np.array((new_x, new_y, new_w, new_h))
96
+ return new_bbox
97
+
98
+ def _landmarks_affine_trans(self, landmarks, affine_transf):
99
+
100
+ homog_landmarks = dlu.affine2homogeneous(landmarks)
101
+ new_landmarks = affine_transf.dot(homog_landmarks.T).T
102
+ return new_landmarks
103
+
104
+
105
+ class RSTAug(GeometryBaseAug):
106
+
107
+ def __init__(self, angle_range=45., scale_min=-0.15, scale_max=0.15, trl_ratio=0.05):
108
+ self.scale_max = scale_max
109
+ self.scale_min = scale_min
110
+ self.angle_range = angle_range
111
+ self.trl_ratio = trl_ratio
112
+
113
+ def __call__(self, sample):
114
+ x, y, w, h = sample['bbox']
115
+
116
+ x0, y0 = x + w/2, y + h/2 # center of the face, which will be the center of the rotation
117
+
118
+ # Bbox translation
119
+ rnd_Tx = np.random.uniform(-self.trl_ratio, self.trl_ratio) * w
120
+ rnd_Ty = np.random.uniform(-self.trl_ratio, self.trl_ratio) * h
121
+ sample['bbox'][0] += rnd_Tx
122
+ sample['bbox'][1] += rnd_Ty
123
+
124
+ scale = 1 + np.random.uniform(self.scale_min, self.scale_max)
125
+ angle = np.random.uniform(-self.angle_range, self.angle_range)
126
+
127
+ similarity = dlu.get_similarity_matrix(angle, scale, center=(x0, y0))
128
+ new_sample = self.map_affine_transformation(sample, similarity)
129
+ return new_sample
130
+
131
+
132
+ class TargetCropAug(GeometryBaseAug):
133
+ def __init__(self, img_new_size=128, map_new_size=128, target_dist=1.3):
134
+
135
+ self.target_dist = target_dist
136
+ self.new_size_x, self.new_size_y = self._convert_shapes(img_new_size)
137
+ self.map_size_x, self.map_size_y = self._convert_shapes(map_new_size)
138
+ self.img2map_scale = False
139
+
140
+ # Mismatch between img shape and featuremap shape
141
+ if self.map_size_x != self.new_size_x or self.map_size_y != self.new_size_y:
142
+ self.img2map_scale = True
143
+ self.map_scale_x = self.map_size_x / self.new_size_x
144
+ self.map_scale_y = self.map_size_y / self.new_size_y
145
+ self.map_scale_xx = self.map_scale_x * self.map_scale_x
146
+ self.map_scale_xy = self.map_scale_x * self.map_scale_y
147
+ self.map_scale_yy = self.map_scale_y * self.map_scale_y
148
+
149
+ def _convert_shapes(self, new_size):
150
+ if isinstance(new_size, (tuple, list)):
151
+ new_size_x = new_size[0]
152
+ new_size_y = new_size[1]
153
+ else:
154
+ new_size_x = new_size
155
+ new_size_y = new_size
156
+ return new_size_x, new_size_y
157
+
158
+ def __call__(self, sample):
159
+ x, y, w, h = sample['bbox']
160
+ # we enlarge the area taken around the bounding box
161
+ # it is neccesary to change the botton left point of the bounding box
162
+ # according to the previous enlargement. Note this will NOT be the new
163
+ # bounding box!
164
+ # We return square images, which is neccesary since
165
+ # all the images must have the same size in order to form batches
166
+ side = max(w, h) * self.target_dist
167
+ x -= (side - w) / 2
168
+ y -= (side - h) / 2
169
+
170
+ # center of the enlarged bounding box
171
+ x0, y0 = x + side/2, y + side/2
172
+ # homothety factor, chosen so the new horizontal dimension will
173
+ # coincide with new_size
174
+ mu_x = self.new_size_x / side
175
+ mu_y = self.new_size_y / side
176
+
177
+ # new_w, new_h = new_size, int(h * mu)
178
+ new_w = self.new_size_x
179
+ new_h = self.new_size_y
180
+ new_x0, new_y0 = new_w / 2, new_h / 2
181
+
182
+ # dilatation + translation
183
+ affine_transf = np.array([[mu_x, 0, new_x0 - mu_x * x0],
184
+ [0, mu_y, new_y0 - mu_y * y0]])
185
+
186
+ sample = self.map_affine_transformation(sample, affine_transf,(new_w, new_h))
187
+ if 'landmarks' in sample.keys():
188
+ img_shape = np.array([0, 0, self.new_size_x, self.new_size_y])
189
+ sample['landmarks_float'] = sample['landmarks']
190
+ sample['mask_ldm_float'] = sample['mask_ldm']
191
+ sample['landmarks'] = np.round(sample['landmarks'])
192
+ sample['mask_ldm'], sample['landmarks'] = self.clean_outbbox_landmarks(img_shape, sample['landmarks'],
193
+ sample['mask_ldm'])
194
+
195
+ if self.img2map_scale:
196
+ sample = self._rescale_map(sample)
197
+ return sample
198
+
199
+ def _rescale_map(self, sample):
200
+
201
+ # Rescale
202
+ lnd_float = sample['landmarks_float']
203
+ lnd_float[:, 0] = self.map_scale_x * lnd_float[:, 0]
204
+ lnd_float[:, 1] = self.map_scale_y * lnd_float[:, 1]
205
+
206
+ # Filter landmarks
207
+ lnd = np.round(lnd_float)
208
+ filter_x = lnd[:, 0] >= self.map_size_x
209
+ filter_y = lnd[:, 1] >= self.map_size_y
210
+ lnd[filter_x] = self.map_size_x - 1
211
+ lnd[filter_y] = self.map_size_y - 1
212
+ new_lnd = (lnd.T * sample['mask_ldm']).T
213
+ new_lnd = new_lnd.astype(int).astype(float)
214
+
215
+ sample['landmarks_float'] = lnd_float
216
+ sample['landmarks'] = new_lnd
217
+ sample['img2map_scale'] = [self.map_scale_x, self.map_scale_y]
218
+ return sample
219
+
220
+
221
+
222
+ class OcclusionAug:
223
+ def __init__(self, min_length=0.1, max_length=0.4, num_maps=1):
224
+ self.min_length = min_length
225
+ self.max_length = max_length
226
+ self.num_maps = num_maps
227
+
228
+ def __call__(self, sample):
229
+ x, y, w, h = sample['bbox']
230
+ image = sample['image']
231
+ landmarks = sample['landmarks']
232
+ vis = sample['visible']
233
+
234
+ min_ratio = self.min_length
235
+ max_ratio = self.max_length
236
+ rnd_width = np.random.randint(int(w * min_ratio), int(w * max_ratio))
237
+ rnd_height = np.random.randint(int(h * min_ratio), int(h * max_ratio))
238
+
239
+ # (xi, yi) and (xf, yf) are, respectively, the lower left points of the
240
+ # occlusion rectangle and the upper right point.
241
+ xi = int(x + np.random.randint(0, w - rnd_width))
242
+ xf = int(xi + rnd_width)
243
+ yi = int(y + np.random.randint(0, h - rnd_height))
244
+ yf = int(yi + rnd_height)
245
+
246
+ pixels = np.array(image)
247
+ pixels[yi:yf, xi:xf, :] = np.random.uniform(0, 255, size=3)
248
+ image = Image.fromarray(pixels)
249
+ sample['image'] = image
250
+
251
+ # Update visibilities
252
+ filter_x1 = landmarks[:, 0] >= xi
253
+ filter_x2 = landmarks[:, 0] < xf
254
+ filter_x = np.logical_and(filter_x1, filter_x2)
255
+
256
+ filter_y1 = landmarks[:, 1] >= yi
257
+ filter_y2 = landmarks[:, 1] < yf
258
+ filter_y = np.logical_and(filter_y1, filter_y2)
259
+
260
+ filter_novis = np.logical_and(filter_x, filter_y)
261
+ filter_vis = np.logical_not(filter_novis)
262
+ sample['visible'] = vis * filter_vis
263
+ return sample
264
+
265
+
266
+ class LightingAug:
267
+ def __init__(self, hsv_range_min=(-0.5, -0.5, -0.5), hsv_range_max=(0.5, 0.5, 0.5)):
268
+ self.hsv_range_min = hsv_range_min
269
+ self.hsv_range_max = hsv_range_max
270
+
271
+ def __call__(self, sample):
272
+ # Convert to HSV colorspace from RGB colorspace
273
+ image = np.array(sample['image'])
274
+ hsv = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
275
+
276
+ # Generate new random values
277
+ H = 1 + np.random.uniform(self.hsv_range_min[0], self.hsv_range_max[0])
278
+ S = 1 + np.random.uniform(self.hsv_range_min[1], self.hsv_range_max[1])
279
+ V = 1 + np.random.uniform(self.hsv_range_min[2], self.hsv_range_max[2])
280
+ hsv[:, :, 0] = np.clip(H*hsv[:, :, 0], 0, 179)
281
+ hsv[:, :, 1] = np.clip(S*hsv[:, :, 1], 0, 255)
282
+ hsv[:, :, 2] = np.clip(V*hsv[:, :, 2], 0, 255)
283
+ # Convert back to BGR colorspace
284
+ image = cv2.cvtColor(hsv, cv2.COLOR_HSV2RGB)
285
+ sample['image'] = Image.fromarray(image)
286
+
287
+ return sample
288
+
289
+
290
+ class BlurAug:
291
+ def __init__(self, blur_prob=0.5, blur_kernel_range=(0, 2)):
292
+ self.blur_prob = blur_prob
293
+ self.kernel_range = blur_kernel_range
294
+
295
+ def __call__(self, sample):
296
+ # Smooth image
297
+ image = np.array(sample['image'])
298
+ if np.random.uniform(0.0, 1.0) < self.blur_prob:
299
+ kernel = np.random.random_integers(self.kernel_range[0], self.kernel_range[1]) * 2 + 1
300
+ image = cv2.GaussianBlur(image, (kernel, kernel), 0, 0)
301
+ sample['image'] = Image.fromarray(image)
302
+
303
+ return sample
304
+
305
+
306
+
307
+
SPIGA/spiga/data/loaders/augmentors/modern_posit.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pkg_resources
3
+ import numpy as np
4
+ import cv2
5
+
6
+ # My libs
7
+ from spiga.data.loaders.augmentors.utils import rotation_matrix_to_euler
8
+
9
+ # Model file nomenclature
10
+ model_file_dft = pkg_resources.resource_filename('spiga', 'data/models3D') + '/mean_face_3D_{num_ldm}.txt'
11
+
12
+
13
+ class PositPose:
14
+
15
+ def __init__(self, ldm_ids, focal_ratio=1, selected_ids=None, max_iter=100,
16
+ fix_bbox=True, model_file=model_file_dft):
17
+
18
+ # Load 3D face model
19
+ model3d_world, model3d_ids = self._load_world_shape(ldm_ids, model_file)
20
+
21
+ # Generate id mask to pick only the robust landmarks for posit
22
+ if selected_ids is None:
23
+ model3d_mask = np.ones(len(ldm_ids))
24
+ else:
25
+ model3d_mask = np.zeros(len(ldm_ids))
26
+ for index, posit_id in enumerate(model3d_ids):
27
+ if posit_id in selected_ids:
28
+ model3d_mask[index] = 1
29
+
30
+ self.ldm_ids = ldm_ids # Ids from the database
31
+ self.model3d_world = model3d_world # Model data
32
+ self.model3d_ids = model3d_ids # Model ids
33
+ self.model3d_mask = model3d_mask # Model mask ids
34
+ self.max_iter = max_iter # Refinement iterations
35
+ self.focal_ratio = focal_ratio # Camera matrix focal length ratio
36
+ self.fix_bbox = fix_bbox # Camera matrix centered on image (False to centered on bbox)
37
+
38
+ def __call__(self, sample):
39
+
40
+ landmarks = sample['landmarks']
41
+ mask = sample['mask_ldm']
42
+
43
+ # Camera matrix
44
+ img_shape = np.array(sample['image'].shape)[0:2]
45
+ if 'img2map_scale' in sample.keys():
46
+ img_shape = img_shape * sample['img2map_scale']
47
+
48
+ if self.fix_bbox:
49
+ img_bbox = [0, 0, img_shape[1], img_shape[0]] # Shapes given are inverted (y,x)
50
+ cam_matrix = self._camera_matrix(img_bbox)
51
+ else:
52
+ bbox = sample['bbox'] # Scale error when ftshape and img_shape mismatch
53
+ cam_matrix = self._camera_matrix(bbox)
54
+
55
+ # Save intrinsic matrix and 3D model landmarks
56
+ sample['cam_matrix'] = cam_matrix
57
+ sample['model3d'] = self.model3d_world
58
+
59
+ world_pts, image_pts = self._set_correspondences(landmarks, mask)
60
+
61
+ if image_pts.shape[0] < 4:
62
+ print('POSIT does not work without landmarks')
63
+ rot_matrix, trl_matrix = np.eye(3, dtype=float), np.array([0, 0, 0])
64
+ else:
65
+ rot_matrix, trl_matrix = self._modern_posit(world_pts, image_pts, cam_matrix)
66
+
67
+ euler = rotation_matrix_to_euler(rot_matrix)
68
+ sample['pose'] = np.array([euler[0], euler[1], euler[2], trl_matrix[0], trl_matrix[1], trl_matrix[2]])
69
+ sample['model3d_proj'] = self._project_points(rot_matrix, trl_matrix, cam_matrix, norm=img_shape)
70
+ return sample
71
+
72
+ def _load_world_shape(self, ldm_ids, model_file):
73
+ return load_world_shape(ldm_ids, model_file=model_file)
74
+
75
+ def _camera_matrix(self, bbox):
76
+ focal_length_x = bbox[2] * self.focal_ratio
77
+ focal_length_y = bbox[3] * self.focal_ratio
78
+ face_center = (bbox[0] + (bbox[2] * 0.5)), (bbox[1] + (bbox[3] * 0.5))
79
+
80
+ cam_matrix = np.array([[focal_length_x, 0, face_center[0]],
81
+ [0, focal_length_y, face_center[1]],
82
+ [0, 0, 1]])
83
+ return cam_matrix
84
+
85
+ def _set_correspondences(self, landmarks, mask):
86
+ # Correspondences using labelled and robust landmarks
87
+ img_mask = np.logical_and(mask, self.model3d_mask)
88
+ img_mask = img_mask.astype(bool)
89
+
90
+ image_pts = landmarks[img_mask]
91
+ world_pts = self.model3d_world[img_mask]
92
+ return world_pts, image_pts
93
+
94
+ def _modern_posit(self, world_pts, image_pts, cam_matrix):
95
+ return modern_posit(world_pts, image_pts, cam_matrix, self.max_iter)
96
+
97
+ def _project_points(self, rot, trl, cam_matrix, norm=None):
98
+ # Perspective projection model
99
+ trl = np.expand_dims(trl, 1)
100
+ extrinsics = np.concatenate((rot, trl), 1)
101
+ proj_matrix = np.matmul(cam_matrix, extrinsics)
102
+
103
+ # Homogeneous landmarks
104
+ pts = self.model3d_world
105
+ ones = np.ones(pts.shape[0])
106
+ ones = np.expand_dims(ones, 1)
107
+ pts_hom = np.concatenate((pts, ones), 1)
108
+
109
+ # Project landmarks
110
+ pts_proj = np.matmul(proj_matrix, pts_hom.T).T
111
+ pts_proj = pts_proj / np.expand_dims(pts_proj[:, 2], 1) # Lambda = 1
112
+
113
+ if norm is not None:
114
+ pts_proj[:, 0] /= norm[0]
115
+ pts_proj[:, 1] /= norm[1]
116
+ return pts_proj[:, :-1]
117
+
118
+
119
+ def load_world_shape(db_landmarks, model_file=model_file_dft):
120
+
121
+ # Load 3D mean face coordinates
122
+ num_ldm = len(db_landmarks)
123
+ filename = model_file.format(num_ldm=num_ldm)
124
+ if not os.path.exists(filename):
125
+ raise ValueError('No 3D model find for %i landmarks' % num_ldm)
126
+
127
+ posit_landmarks = np.genfromtxt(filename, delimiter='|', dtype=int, usecols=0).tolist()
128
+ mean_face_3D = np.genfromtxt(filename, delimiter='|', dtype=(float, float, float), usecols=(1, 2, 3)).tolist()
129
+ world_all = len(mean_face_3D)*[None]
130
+ index_all = len(mean_face_3D)*[None]
131
+
132
+ for cont, elem in enumerate(mean_face_3D):
133
+ pt3d = [elem[2], -elem[0], -elem[1]]
134
+ lnd_idx = db_landmarks.index(posit_landmarks[cont])
135
+ world_all[lnd_idx] = pt3d
136
+ index_all[lnd_idx] = posit_landmarks[cont]
137
+
138
+ return np.array(world_all), np.array(index_all)
139
+
140
+
141
+ def modern_posit(world_pts, image_pts, cam_matrix, max_iters):
142
+ # Homogeneous world points
143
+ num_landmarks = image_pts.shape[0]
144
+ one = np.ones((num_landmarks, 1))
145
+ A = np.concatenate((world_pts, one), axis=1)
146
+ B = np.linalg.pinv(A)
147
+
148
+ # Normalize image points
149
+ focal_length = cam_matrix[0,0]
150
+ img_center = (cam_matrix[0,2], cam_matrix[1,2])
151
+ centered_pts = np.zeros((num_landmarks,2))
152
+ centered_pts[:,0] = (image_pts[:,0]-img_center[0])/focal_length
153
+ centered_pts[:,1] = (image_pts[:,1]-img_center[1])/focal_length
154
+ Ui = centered_pts[:,0]
155
+ Vi = centered_pts[:,1]
156
+
157
+ # POSIT loop
158
+ Tx, Ty, Tz = 0.0, 0.0, 0.0
159
+ r1, r2, r3 = [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]
160
+ for iter in range(0, max_iters):
161
+ I = np.dot(B,Ui)
162
+ J = np.dot(B,Vi)
163
+
164
+ # Estimate translation vector and rotation matrix
165
+ normI = 1.0 / np.sqrt(I[0] * I[0] + I[1] * I[1] + I[2] * I[2])
166
+ normJ = 1.0 / np.sqrt(J[0] * J[0] + J[1] * J[1] + J[2] * J[2])
167
+ Tz = np.sqrt(normI * normJ) # geometric average instead of arithmetic average of classicPosit
168
+ r1N = I*Tz
169
+ r2N = J*Tz
170
+ r1 = r1N[0:3]
171
+ r2 = r2N[0:3]
172
+ r1 = np.clip(r1, -1, 1)
173
+ r2 = np.clip(r2, -1, 1)
174
+ r3 = np.cross(r1,r2)
175
+ r3T = np.concatenate((r3, [Tz]), axis=0)
176
+ Tx = r1N[3]
177
+ Ty = r2N[3]
178
+
179
+ # Compute epsilon, update Ui and Vi and check convergence
180
+ eps = np.dot(A, r3T)/Tz
181
+ oldUi = Ui
182
+ oldVi = Vi
183
+ Ui = np.multiply(eps, centered_pts[:,0])
184
+ Vi = np.multiply(eps, centered_pts[:,1])
185
+ deltaUi = Ui - oldUi
186
+ deltaVi = Vi - oldVi
187
+ delta = focal_length * focal_length * (np.dot(np.transpose(deltaUi), deltaUi) + np.dot(np.transpose(deltaVi), deltaVi))
188
+ if iter > 0 and delta < 0.01: # converged
189
+ break
190
+
191
+ rot_matrix = np.array([np.transpose(r1), np.transpose(r2), np.transpose(r3)])
192
+ trl_matrix = np.array([Tx, Ty, Tz])
193
+ # Convert to the nearest orthogonal rotation matrix
194
+ w, u, vt = cv2.SVDecomp(rot_matrix) # R = U*D*Vt
195
+ rot_matrix = np.matmul(np.matmul(u, np.eye(3, dtype=float)), vt)
196
+ return rot_matrix, trl_matrix
197
+
SPIGA/spiga/data/loaders/augmentors/utils.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+
4
+ def affine2homogeneous(points):
5
+ '''Returns the points completed with a new last coordinate
6
+ equal to 1
7
+ Arguments
8
+ ---------
9
+ points: np.array of shape (num_points, dim)
10
+ Returns
11
+ -------
12
+ hpoints: np.array of shape (num_points, dim + 1),
13
+ of the points completed with ones'''
14
+
15
+ num_points = points.shape[0]
16
+ hpoints = np.hstack(
17
+ (points, np.repeat(1, num_points).reshape(num_points, 1)))
18
+ return hpoints
19
+
20
+
21
+ def get_similarity_matrix(deg_angle, scale, center):
22
+ '''Similarity matrix.
23
+ Arguments:
24
+ ---------
25
+ deg_angle: rotation angle in degrees
26
+ scale: factor scale
27
+ center: coordinates of the rotation center
28
+
29
+ Returns:
30
+ -------
31
+ matrix: (2, 3) numpy array representing the
32
+ similarity matrix.
33
+ '''
34
+ x0, y0 = center
35
+ angle = np.radians(deg_angle)
36
+
37
+ matrix = np.zeros((2, 3))
38
+ matrix[0:2, 0:2] = [[np.cos(angle), -np.sin(angle)],
39
+ [np.sin(angle), np.cos(angle)]]
40
+ matrix[0: 2, 0: 2] *= scale
41
+
42
+ matrix[:, 2] = [(1 - scale * np.cos(angle)) * x0 +
43
+ scale * np.sin(angle) * y0,
44
+ -scale * np.sin(angle) * x0 +
45
+ (1 - scale * np.cos(angle)) * y0]
46
+ return matrix
47
+
48
+
49
+ def get_inverse_similarity_matrix(deg_angle, scale, center):
50
+ '''Returns the inverse of the affine similarity
51
+ Arguments
52
+ ---------
53
+ deg_angle: angle in degrees of the rotation
54
+ center: iterable of two components (x0, y0),
55
+ center of the rotation
56
+ scale: float, scale factor
57
+ Returns
58
+ -------
59
+ matrix: np.array of shape (2, 3) with the coordinates of
60
+ the inverse of the similarity'''
61
+
62
+ x0, y0 = center
63
+ angle = np.radians(deg_angle)
64
+ inv_scale = 1 / scale
65
+ matrix = np.zeros((2, 3))
66
+ matrix[0:2, 0:2] = [[np.cos(angle), np.sin(angle)],
67
+ [-np.sin(angle), np.cos(angle)]]
68
+ matrix[0:2, 0:2] *= inv_scale
69
+
70
+ matrix[:, 2] = [(1 - inv_scale * np.cos(angle)) * x0 -
71
+ inv_scale * np.sin(angle) * y0,
72
+ inv_scale * np.sin(angle) * x0 +
73
+ (1 - inv_scale * np.cos(angle)) * y0]
74
+
75
+ return matrix
76
+
77
+
78
+ def get_inverse_transf(affine_transf):
79
+ A = affine_transf[0:2, 0:2]
80
+ b = affine_transf[:, 2]
81
+
82
+ inv_A = np.linalg.inv(A) # we assume A invertible!
83
+
84
+ inv_affine = np.zeros((2, 3))
85
+ inv_affine[0:2, 0:2] = inv_A
86
+ inv_affine[:, 2] = -inv_A.dot(b)
87
+
88
+ return inv_affine
89
+
90
+
91
+ def image2vect(image):
92
+ '''
93
+ Input:
94
+ image[batch_size, num_channels, im_size_x, im_size_y]
95
+ Output:
96
+ vect[batch_size, num_channels, im_size_x*im_size_y]
97
+ '''
98
+ vect = image.reshape(*image.shape[0:-2], -1)
99
+ return vect
100
+
101
+
102
+ def rotation_matrix_to_euler(rot_matrix):
103
+ # http://euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm
104
+ a00, a01, a02 = rot_matrix[0, 0], rot_matrix[0, 1], rot_matrix[0, 2]
105
+ a10, a11, a12 = rot_matrix[1, 0], rot_matrix[1, 1], rot_matrix[1, 2]
106
+ a20, a21, a22 = rot_matrix[2, 0], rot_matrix[2, 1], rot_matrix[2, 2]
107
+ if abs(1.0 - a10) <= np.finfo(float).eps: # singularity at north pole / special case a10 == 1
108
+ yaw = np.arctan2(a02, a22)
109
+ pitch = np.pi/2.0
110
+ roll = 0
111
+ elif abs(-1.0 - a10) <= np.finfo(float).eps: # singularity at south pole / special case a10 == -1
112
+ yaw = np.arctan2(a02, a22)
113
+ pitch = -np.pi/2.0
114
+ roll = 0
115
+ else: # standard case
116
+ yaw = np.arctan2(-a20, a00)
117
+ pitch = np.arcsin(a10)
118
+ roll = np.arctan2(-a12, a11)
119
+ # Convert to degrees
120
+ euler = np.array([yaw, pitch, roll])*(180.0/np.pi)
121
+ # Change coordinates system
122
+ euler = np.array([(-euler[0])+90, -euler[1], (-euler[2])-90])
123
+ if euler[0] > 180: euler[0] -= 360
124
+ elif euler[0] < -180: euler[0] += 360
125
+ if euler[1] > 180: euler[1] -= 360
126
+ elif euler[1] < -180: euler[1] += 360
127
+ if euler[2] > 180: euler[2] -= 360
128
+ elif euler[2] < -180: euler[2] += 360
129
+ return euler
130
+
131
+
132
+ def euler_to_rotation_matrix(headpose):
133
+ # http://euclideanspace.com/maths/geometry/rotations/conversions/eulerToMatrix/index.htm
134
+ # Change coordinates system
135
+ euler = np.array([-(headpose[0]-90), -headpose[1], -(headpose[2]+90)])
136
+ # Convert to radians
137
+ rad = euler*(np.pi/180.0)
138
+ cy = np.cos(rad[0])
139
+ sy = np.sin(rad[0])
140
+ cp = np.cos(rad[1])
141
+ sp = np.sin(rad[1])
142
+ cr = np.cos(rad[2])
143
+ sr = np.sin(rad[2])
144
+ Ry = np.array([[cy, 0.0, sy], [0.0, 1.0, 0.0], [-sy, 0.0, cy]]) # yaw
145
+ Rp = np.array([[cp, -sp, 0.0], [sp, cp, 0.0], [0.0, 0.0, 1.0]]) # pitch
146
+ Rr = np.array([[1.0, 0.0, 0.0], [0.0, cr, -sr], [0.0, sr, cr]]) # roll
147
+ return np.matmul(np.matmul(Ry, Rp), Rr)
SPIGA/spiga/data/loaders/dataloader.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from torch.utils.data import DataLoader
2
+ from torch.utils.data.distributed import DistributedSampler
3
+
4
+ import spiga.data.loaders.alignments as zoo_alignments
5
+
6
+ zoos = [zoo_alignments]
7
+
8
+
9
+ def get_dataset(data_config, pretreat=None, debug=False):
10
+
11
+ for zoo in zoos:
12
+ dataset = zoo.get_dataset(data_config, pretreat=pretreat, debug=debug)
13
+ if dataset is not None:
14
+ return dataset
15
+ raise NotImplementedError('Dataset not available')
16
+
17
+
18
+ def get_dataloader(batch_size, data_config, pretreat=None, sampler_cfg=None, debug=False):
19
+
20
+ dataset = get_dataset(data_config, pretreat=pretreat, debug=debug)
21
+
22
+ if (len(dataset) % batch_size) == 1 and data_config.shuffle == True:
23
+ drop_last_batch = True
24
+ else:
25
+ drop_last_batch = False
26
+
27
+ shuffle = data_config.shuffle
28
+ sampler = None
29
+ if sampler_cfg is not None:
30
+ sampler = DistributedSampler(dataset, num_replicas=sampler_cfg.world_size, rank=sampler_cfg.rank)
31
+ shuffle = False
32
+
33
+ dataloader = DataLoader(dataset,
34
+ batch_size=batch_size,
35
+ shuffle=shuffle,
36
+ num_workers=data_config.num_workers,
37
+ pin_memory=True,
38
+ drop_last=drop_last_batch,
39
+ sampler=sampler)
40
+
41
+ return dataloader, dataset
SPIGA/spiga/data/loaders/dl_config.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import pkg_resources
4
+ from collections import OrderedDict
5
+
6
+ # Default data paths
7
+ db_img_path = pkg_resources.resource_filename('spiga', 'data/databases')
8
+ db_anns_path = pkg_resources.resource_filename('spiga', 'data/annotations') + "/{database}/{file_name}.json"
9
+
10
+ class AlignConfig:
11
+
12
+ def __init__(self, database_name, mode='train'):
13
+ # Dataset
14
+ self.database_name = database_name
15
+ self.working_mode = mode
16
+ self.database = None # Set at self._update_database()
17
+ self.anns_file = None # Set at self._update_database()
18
+ self.image_dir = None # Set at self._update_database()
19
+ self._update_database()
20
+ self.image_size = (256, 256)
21
+ self.ftmap_size = (256, 256)
22
+
23
+ # Dataloaders
24
+ self.ids = None # List of a subset if need it
25
+ self.shuffle = True # Shuffle samples
26
+ self.num_workers = 4 # Threads
27
+
28
+ # Posit
29
+ self.generate_pose = True # Generate pose parameters from landmarks
30
+ self.focal_ratio = 1.5 # Camera matrix focal length ratio
31
+ self.posit_max_iter = 100 # Refinement iterations
32
+
33
+ # Subset of robust ids in the 3D model to use in posit.
34
+ # 'None' to use all the available model landmarks.
35
+ self.posit_ids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
36
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
37
+
38
+ # Data augmentation
39
+ # Control augmentations with the following list, crop to self.img_size is mandatory, check target_dist param.
40
+ if mode == 'train':
41
+ self.aug_names = ['flip', 'rotate_scale', 'occlusion', 'lighting', 'blur']
42
+ else:
43
+ self.aug_names = []
44
+ self.shuffle = False
45
+
46
+ # Flip
47
+ self.hflip_prob = 0.5
48
+ # Rotation
49
+ self.angle_range = 45.
50
+ # Scale
51
+ self.scale_max = 0.15
52
+ self.scale_min = -0.15
53
+ # Translation
54
+ self.trl_ratio = 0.05 # Translation augmentation
55
+ # Crop target rescale
56
+ self.target_dist = 1.6 # Target distance zoom in/out around face. Default: 1.
57
+ # Occlusion
58
+ self.occluded_max_len = 0.4
59
+ self.occluded_min_len = 0.1
60
+ self.occluded_covar_ratio = 2.25**0.5
61
+ # Lighting
62
+ self.hsv_range_min = [-0.5, -0.5, -0.5]
63
+ self.hsv_range_max = [0.5, 0.5, 0.5]
64
+ # Blur
65
+ self.blur_prob = 0.5
66
+ self.blur_kernel_range = [0, 2]
67
+
68
+ # Heatmaps 2D
69
+ self.sigma2D = 1.5
70
+ self.heatmap2D_norm = False
71
+
72
+ # Boundaries
73
+ self.sigmaBD = 1
74
+
75
+ def update(self, params_dict):
76
+ state_dict = self.state_dict()
77
+ for k, v in params_dict.items():
78
+ if k in state_dict or hasattr(self, k):
79
+ setattr(self, k, v)
80
+ else:
81
+ Warning('Unknown option: {}: {}'.format(k, v))
82
+ self._update_database()
83
+
84
+ def state_dict(self, tojson=False):
85
+ state_dict = OrderedDict()
86
+ for k in self.__dict__.keys():
87
+ if not k.startswith('_'):
88
+ if tojson and k in ['database']:
89
+ continue
90
+ state_dict[k] = getattr(self, k)
91
+ return state_dict
92
+
93
+ def _update_database(self):
94
+ self.database = DatabaseStruct(self.database_name)
95
+ self.anns_file = db_anns_path.format(database=self.database_name, file_name=self.working_mode)
96
+ self.image_dir = self._get_imgdb_path()
97
+
98
+ def _get_imgdb_path(self):
99
+ img_dir = None
100
+ if self.database_name in ['300wpublic', '300wprivate']:
101
+ img_dir = db_img_path + '/300w/'
102
+ elif self.database_name in ['aflw19', 'merlrav']:
103
+ img_dir = db_img_path + '/aflw/data/'
104
+ elif self.database_name in ['cofw', 'cofw68']:
105
+ img_dir = db_img_path + '/cofw/'
106
+ elif self.database_name in ['wflw']:
107
+ img_dir = db_img_path + '/wflw/'
108
+ return img_dir
109
+
110
+ def __str__(self):
111
+ state_dict = self.state_dict()
112
+ text = 'Dataloader {\n'
113
+ for k, v in state_dict.items():
114
+ if isinstance(v, DatabaseStruct):
115
+ text += '\t{}: {}'.format(k, str(v).expandtabs(12))
116
+ else:
117
+ text += '\t{}: {}\n'.format(k, v)
118
+ text += '\t}\n'
119
+ return text
120
+
121
+
122
+ class DatabaseStruct:
123
+
124
+ def __init__(self, database_name):
125
+
126
+ self.name = database_name
127
+ self.ldm_ids, self.ldm_flip_order, self.ldm_edges_matrix = self._get_database_specifics()
128
+ self.num_landmarks = len(self.ldm_ids)
129
+ self.num_edges = len(self.ldm_edges_matrix[0])-1
130
+ self.fields = ['imgpath', 'bbox', 'headpose', 'ids', 'landmarks', 'visible']
131
+
132
+ def _get_database_specifics(self):
133
+ '''Returns specifics ids and horizontal flip reorder'''
134
+
135
+ database_name = self.name
136
+ db_info_file = db_anns_path.format(database=database_name, file_name='db_info')
137
+ ldm_edges_matrix = None
138
+
139
+ if os.path.exists(db_info_file):
140
+ with open(db_info_file) as jsonfile:
141
+ db_info = json.load(jsonfile)
142
+
143
+ ldm_ids = db_info['ldm_ids']
144
+ ldm_flip_order = db_info['ldm_flip_order']
145
+ if 'ldm_edges_matrix' in db_info.keys():
146
+ ldm_edges_matrix = db_info['ldm_edges_matrix']
147
+
148
+ else:
149
+ raise ValueError('Database ' + database_name + 'specifics not defined. Missing db_info.json')
150
+
151
+ return ldm_ids, ldm_flip_order, ldm_edges_matrix
152
+
153
+ def state_dict(self):
154
+ state_dict = OrderedDict()
155
+ for k in self.__dict__.keys():
156
+ if not k.startswith('_'):
157
+ state_dict[k] = getattr(self, k)
158
+
159
+ return state_dict
160
+
161
+ def __str__(self):
162
+ state_dict = self.state_dict()
163
+ text = 'Database {\n'
164
+ for k, v in state_dict.items():
165
+ text += '\t{}: {}\n'.format(k, v)
166
+ text += '\t}\n'
167
+ return text
168
+
169
+
170
+
SPIGA/spiga/data/loaders/transforms.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import torch
4
+
5
+ from spiga.data.loaders.augmentors.modern_posit import PositPose
6
+ from spiga.data.loaders.augmentors.heatmaps import Heatmaps
7
+ from spiga.data.loaders.augmentors.boundary import AddBoundary
8
+ from spiga.data.loaders.augmentors.landmarks import HorizontalFlipAug, RSTAug, OcclusionAug, \
9
+ LightingAug, BlurAug, TargetCropAug
10
+
11
+
12
+ def get_transformers(data_config):
13
+
14
+ # Data augmentation
15
+ aug_names = data_config.aug_names
16
+ augmentors = []
17
+
18
+ if 'flip' in aug_names:
19
+ augmentors.append(HorizontalFlipAug(data_config.database.ldm_flip_order, data_config.hflip_prob))
20
+ if 'rotate_scale' in aug_names:
21
+ augmentors.append(RSTAug(data_config.angle_range, data_config.scale_min,
22
+ data_config.scale_max, data_config.trl_ratio))
23
+ if 'occlusion' in aug_names:
24
+ augmentors.append(OcclusionAug(data_config.occluded_min_len,
25
+ data_config.occluded_max_len,
26
+ data_config.database.num_landmarks))
27
+ if 'lighting' in aug_names:
28
+ augmentors.append(LightingAug(data_config.hsv_range_min, data_config.hsv_range_max))
29
+ if 'blur' in aug_names:
30
+ augmentors.append(BlurAug(data_config.blur_prob, data_config.blur_kernel_range))
31
+
32
+ # Crop mandatory
33
+ augmentors.append(TargetCropAug(data_config.image_size, data_config.ftmap_size, data_config.target_dist))
34
+ # Opencv style
35
+ augmentors.append(ToOpencv())
36
+
37
+ # Gaussian heatmaps
38
+ if 'heatmaps2D' in aug_names:
39
+ augmentors.append(Heatmaps(data_config.database.num_landmarks, data_config.ftmap_size,
40
+ data_config.sigma2D, norm=data_config.heatmap2D_norm))
41
+
42
+ if 'boundaries' in aug_names:
43
+ augmentors.append(AddBoundary(num_landmarks=data_config.database.num_landmarks,
44
+ map_size=data_config.ftmap_size,
45
+ sigma=data_config.sigmaBD))
46
+ # Pose generator
47
+ if data_config.generate_pose:
48
+ augmentors.append(PositPose(data_config.database.ldm_ids,
49
+ focal_ratio=data_config.focal_ratio,
50
+ selected_ids=data_config.posit_ids,
51
+ max_iter=data_config.posit_max_iter))
52
+
53
+ return augmentors
54
+
55
+
56
+ class ToOpencv:
57
+ def __call__(self, sample):
58
+ # Convert in a numpy array and change to GBR
59
+ image = np.array(sample['image'])
60
+ image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
61
+ sample['image'] = image
62
+ return sample
63
+
64
+
65
+ class TargetCrop(TargetCropAug):
66
+ def __init__(self, crop_size=256, target_dist=1.6):
67
+ super(TargetCrop, self).__init__(crop_size, crop_size, target_dist)
68
+
69
+
70
+ class AddModel3D(PositPose):
71
+ def __init__(self, ldm_ids, ftmap_size=(256, 256), focal_ratio=1.5, totensor=False):
72
+ super(AddModel3D, self).__init__(ldm_ids, focal_ratio=focal_ratio)
73
+ img_bbox = [0, 0, ftmap_size[1], ftmap_size[0]] # Shapes given are inverted (y,x)
74
+ self.cam_matrix = self._camera_matrix(img_bbox)
75
+
76
+ if totensor:
77
+ self.cam_matrix = torch.tensor(self.cam_matrix, dtype=torch.float)
78
+ self.model3d_world = torch.tensor(self.model3d_world, dtype=torch.float)
79
+
80
+ def __call__(self, sample={}):
81
+ # Save intrinsic matrix and 3D model landmarks
82
+ sample['cam_matrix'] = self.cam_matrix
83
+ sample['model3d'] = self.model3d_world
84
+ return sample
SPIGA/spiga/data/models3D/__init__.py ADDED
File without changes
SPIGA/spiga/data/models3D/mean_face_3D_68.txt ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 101|-0.71046061493|0.39334543762|-0.853184236267
2
+ 102|-0.685409656726|0.169750713576|-0.878623094747
3
+ 103|-0.607672440834|-0.0597969416711|-0.922355056609
4
+ 104|-0.545664962607|-0.262499453743|-0.920836599126
5
+ 105|-0.446214526601|-0.439045175771|-0.863139209
6
+ 106|-0.334435950087|-0.566049889292|-0.728913281016
7
+ 107|-0.236168305748|-0.653698223145|-0.585459059996
8
+ 108|-0.128307367184|-0.712045321067|-0.488221730877
9
+ 24|-0.00354849146401|-0.73799619898|-0.461364289002
10
+ 110|0.131199109787|-0.733135962679|-0.466262199442
11
+ 111|0.257373771199|-0.666487934012|-0.560781626341
12
+ 112|0.359823738861|-0.569594984479|-0.666664889106
13
+ 113|0.455878939364|-0.475272786995|-0.762199581604
14
+ 114|0.583151236654|-0.255441185628|-0.895445263128
15
+ 115|0.635035270608|-0.076593055883|-0.925024981148
16
+ 116|0.688562921266|0.127095701882|-0.90624669312
17
+ 117|0.711883056933|0.332170073984|-0.901990426153
18
+ 7|-0.406302776083|0.360389456414|-0.383328256737
19
+ 138|-0.34477414508|0.384294131116|-0.310253684249
20
+ 139|-0.261521910706|0.396020592391|-0.286645173372
21
+ 8|-0.160787895282|0.371046071664|-0.330243237009
22
+ 141|-0.245621576158|0.334421719594|-0.323105980143
23
+ 142|-0.328092143154|0.331973054751|-0.339942994735
24
+ 11|0.163880511996|0.34074733643|-0.314140711047
25
+ 144|0.250844605212|0.392490504074|-0.279030578851
26
+ 145|0.340770354713|0.378980645804|-0.285841921386
27
+ 12|0.432352000574|0.348665008376|-0.377158168878
28
+ 147|0.333467711264|0.328033806608|-0.318530865652
29
+ 148|0.246621391603|0.335053488011|-0.313137199532
30
+ 1|-0.552168877878|0.483792334207|-0.466456539274
31
+ 119|-0.459810924979|0.561780416181|-0.308160933539
32
+ 2|-0.360178576451|0.566290707558|-0.216753374881
33
+ 121|-0.249770054109|0.530336745189|-0.148694799479
34
+ 3|-0.101941089981|0.482471777751|-0.124216132105
35
+ 128|0.00843526194116|0.416310824525|-0.139142361862
36
+ 129|0.00731217835113|0.267155736618|-0.106471830332
37
+ 130|0.00190174006432|0.142359799355|-0.0544539305898
38
+ 17|0.0|0.0|0.0
39
+ 16|-0.118903311783|-0.0792784542251|-0.23553779698
40
+ 133|-0.0504300242939|-0.104665185108|-0.171210015652
41
+ 134|0.00312657092554|-0.111845126622|-0.154139340027
42
+ 135|0.0687543983424|-0.0995458563329|-0.173275169304
43
+ 18|0.148988810614|-0.0737848514841|-0.23851346235
44
+ 4|0.0979764884322|0.465935806416|-0.131673602172
45
+ 124|0.214281256931|0.497130488239|-0.135680573937
46
+ 5|0.373011222167|0.520379035113|-0.223000042464
47
+ 126|0.501607216527|0.500371303274|-0.31925158046
48
+ 6|0.57362522379|0.457842172776|-0.465084060802
49
+ 20|-0.2229832011|-0.277627584817|-0.354306324758
50
+ 150|-0.157062857603|-0.248737641674|-0.270218764688
51
+ 151|-0.0816354856174|-0.23618498428|-0.225237980338
52
+ 22|-0.00391577759471|-0.24499812323|-0.2126098208
53
+ 153|0.0629421066443|-0.230774971512|-0.208501270489
54
+ 154|0.135507933036|-0.240646328001|-0.235471195707
55
+ 21|0.240381217797|-0.283709533358|-0.332281891845
56
+ 156|0.143706630542|-0.329461104518|-0.283978333058
57
+ 157|0.084139951946|-0.355354733249|-0.256464077311
58
+ 23|0.00813704018925|-0.360357397837|-0.250423014186
59
+ 159|-0.0778260690655|-0.349041413147|-0.26966136614
60
+ 160|-0.157111645515|-0.311971743234|-0.322383820174
61
+ 161|-0.182660017757|-0.278377925956|-0.341170846656
62
+ 162|-0.075943475389|-0.283519721316|-0.270854173882
63
+ 163|-0.0026701322545|-0.286917503123|-0.254428375696
64
+ 164|0.0685062003389|-0.285630836758|-0.257845545665
65
+ 165|0.194170296105|-0.279641061937|-0.314605542849
66
+ 166|0.0689862474833|-0.288076969827|-0.258696545259
67
+ 167|-0.00273913414372|-0.28915723747|-0.25622946708
68
+ 168|-0.0766989697362|-0.286311968999|-0.273027820051
SPIGA/spiga/data/models3D/mean_face_3D_98.txt ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 100|-0.710460614932|0.393345437621|-0.853184236268
2
+ 101|-0.697935135807|0.281548075586|-0.865903665506
3
+ 102|-0.685409656727|0.169750713576|-0.878623094748
4
+ 103|-0.646541048786|0.0549768859803|-0.90048907572
5
+ 104|-0.607672440835|-0.0597969416712|-0.92235505661
6
+ 105|-0.576668701754|-0.16114819775|-0.921595827864
7
+ 106|-0.545664962608|-0.262499453743|-0.920836599128
8
+ 107|-0.495939744597|-0.350772314723|-0.891987904048
9
+ 108|-0.446214526602|-0.439045175772|-0.863139209001
10
+ 109|-0.390325238349|-0.502547532515|-0.796026245014
11
+ 110|-0.334435950088|-0.566049889293|-0.728913281017
12
+ 111|-0.285302127936|-0.60987405623|-0.657186170535
13
+ 112|-0.236168305748|-0.653698223146|-0.585459059997
14
+ 113|-0.182237836481|-0.682871772143|-0.536840395466
15
+ 114|-0.128307367184|-0.712045321068|-0.488221730878
16
+ 115|-0.065927929287|-0.725020759991|-0.474793009911
17
+ 24|-0.00354849146405|-0.737996198981|-0.461364289002
18
+ 117|0.0638253091608|-0.735566080866|-0.463813244263
19
+ 118|0.131199109787|-0.73313596268|-0.466262199443
20
+ 119|0.194286440465|-0.699811948342|-0.513521912927
21
+ 120|0.257373771199|-0.666487934013|-0.560781626342
22
+ 121|0.308598755049|-0.61804145929|-0.613723257723
23
+ 122|0.359823738861|-0.569594984479|-0.666664889106
24
+ 123|0.407851339087|-0.522433885778|-0.714432235344
25
+ 124|0.455878939366|-0.475272786996|-0.762199581605
26
+ 125|0.519515088045|-0.365356986341|-0.828822422342
27
+ 126|0.583151236655|-0.255441185628|-0.89544526313
28
+ 127|0.609093253652|-0.166017120718|-0.910235122162
29
+ 128|0.635035270609|-0.0765930558831|-0.92502498115
30
+ 129|0.661799095895|0.0252513229862|-0.915635837119
31
+ 130|0.688562921268|0.127095701883|-0.906246693121
32
+ 131|0.700222989101|0.229632887961|-0.904118559673
33
+ 132|0.711883056935|0.332170073985|-0.901990426154
34
+ 1|-0.552168877879|0.483792334207|-0.466456539275
35
+ 134|-0.45981092498|0.561780416182|-0.30816093354
36
+ 2|-0.360178576451|0.566290707559|-0.216753374882
37
+ 136|-0.249770054109|0.53033674519|-0.148694799479
38
+ 3|-0.101941089981|0.482471777751|-0.124216132105
39
+ 138|-0.100790757462|0.429593539303|-0.13295377507
40
+ 139|-0.24861972159|0.477458506742|-0.157432442443
41
+ 140|-0.359028243932|0.513412469111|-0.225491017847
42
+ 141|-0.458660592461|0.508902177734|-0.316898576504
43
+ 4|0.0979764884324|0.465935806417|-0.131673602172
44
+ 143|0.214281256932|0.49713048824|-0.135680573937
45
+ 5|0.373011222167|0.520379035114|-0.223000042464
46
+ 145|0.501607216528|0.500371303275|-0.31925158046
47
+ 6|0.573625223791|0.457842172777|-0.465084060803
48
+ 147|0.500456884008|0.447493064827|-0.310513937496
49
+ 148|0.374161554686|0.467500796666|-0.231737685429
50
+ 149|0.215431589451|0.444252249792|-0.144418216902
51
+ 150|0.0991268209517|0.413057567969|-0.140411245136
52
+ 151|0.00843526194114|0.416310824526|-0.139142361862
53
+ 152|0.00731217835118|0.267155736618|-0.106471830333
54
+ 153|0.00190174006432|0.142359799356|-0.0544539305899
55
+ 17|0.0|0.0|0.0
56
+ 16|-0.118903311783|-0.0792784542252|-0.23553779698
57
+ 156|-0.0504300242939|-0.104665185108|-0.171210015652
58
+ 157|0.00312657092558|-0.111845126622|-0.154139340027
59
+ 158|0.0687543983424|-0.0995458563331|-0.173275169304
60
+ 18|0.148988810614|-0.0737848514843|-0.23851346235
61
+ 7|-0.406302776084|0.360389456414|-0.383328256738
62
+ 161|-0.34477414508|0.384294131116|-0.310253684249
63
+ 9|-0.303148027928|0.398970401478|-0.298449428843
64
+ 163|-0.261521910707|0.396020592392|-0.286645173373
65
+ 8|-0.160787895283|0.371046071665|-0.33024323701
66
+ 165|-0.245621576158|0.334421719595|-0.323105980144
67
+ 10|-0.286856859665|0.324384347457|-0.33152448747
68
+ 167|-0.328092143155|0.331973054752|-0.339942994736
69
+ 11|0.163880511996|0.340747336431|-0.314140711048
70
+ 169|0.250844605212|0.392490504075|-0.279030578852
71
+ 13|0.295807479997|0.39454861469|-0.282436250152
72
+ 171|0.340770354713|0.378980645804|-0.285841921386
73
+ 12|0.432352000574|0.348665008377|-0.377158168879
74
+ 173|0.333467711265|0.328033806608|-0.318530865652
75
+ 14|0.290044551442|0.322730607606|-0.315834032602
76
+ 175|0.246621391603|0.335053488012|-0.313137199533
77
+ 20|-0.2229832011|-0.277627584818|-0.354306324759
78
+ 177|-0.157062857603|-0.248737641675|-0.270218764688
79
+ 178|-0.0816354856176|-0.23618498428|-0.225237980339
80
+ 22|-0.00391577759461|-0.24499812323|-0.212609820801
81
+ 180|0.0629421066443|-0.230774971513|-0.20850127049
82
+ 181|0.135507933036|-0.240646328002|-0.235471195707
83
+ 21|0.240381217797|-0.283709533359|-0.332281891846
84
+ 183|0.143706630542|-0.329461104519|-0.283978333058
85
+ 184|0.0841399519463|-0.35535473325|-0.256464077312
86
+ 23|0.00813704018926|-0.360357397838|-0.250423014186
87
+ 186|-0.0778260690653|-0.349041413147|-0.269661366141
88
+ 187|-0.157111645515|-0.311971743235|-0.322383820174
89
+ 188|-0.182660017758|-0.278377925956|-0.341170846657
90
+ 189|-0.0759434753887|-0.283519721316|-0.270854173882
91
+ 190|-0.00267013225455|-0.286917503124|-0.254428375697
92
+ 191|0.068506200339|-0.285630836758|-0.257845545665
93
+ 192|0.194170296105|-0.279641061938|-0.31460554285
94
+ 193|0.0689862474834|-0.288076969827|-0.25869654526
95
+ 194|-0.00273913414368|-0.28915723747|-0.25622946708
96
+ 195|-0.0766989697367|-0.286311968999|-0.273027820052
97
+ 196|-0.291183407723|0.363024170951|-0.328919887677
98
+ 197|0.294656095888|0.353995131537|-0.31463990759
SPIGA/spiga/data/models3D/visualization.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import numpy as np
3
+ import matplotlib.pyplot as plt
4
+
5
+
6
+ def main():
7
+ # Input arguments control
8
+ pars = argparse.ArgumentParser(description='3D model visualization')
9
+ pars.add_argument('file', type=str, help='File txt path')
10
+ args = pars.parse_args()
11
+ visualize_3Dmodel(args.file)
12
+
13
+
14
+ def visualize_3Dmodel(input_file):
15
+
16
+ with open(input_file) as f:
17
+ lines = f.readlines()
18
+
19
+ model = []
20
+ for line in lines:
21
+ line = line[:-1] # Remove \n
22
+ line_split = line.split('|')
23
+ values = np.array(line_split, dtype=float)
24
+ model.append(values)
25
+
26
+ model = np.array(model)
27
+ model_xyz = model[:, 1:]
28
+
29
+ # Show model
30
+ fig = plt.figure()
31
+ ax = fig.add_subplot(111, projection='3d')
32
+ ax.scatter(model_xyz[:, 0], model_xyz[:, 1], model_xyz[:, 2]+0.8)
33
+ plt.show()
34
+
35
+
36
+ if __name__ == '__main__':
37
+ main()
SPIGA/spiga/data/readme.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPIGA: Dataloaders
2
+ Currently, the repository provides a pytorch based image dataloader implementation for the task of:
3
+ * **Facial Landmarks estimation**.
4
+ * **Headpose estimation**.
5
+ * **Facial landmarks visibilities**.
6
+
7
+ The dataloader can be used for training or testing the networks and it includes general and
8
+ specifics data augmentation for each task, as it can be image partial occlusions
9
+ or headpose generation from facial landmarks.
10
+
11
+ In addition, the framework provides a wide benchmark software in order to evaluate the
12
+ different task along the following databases:
13
+ * **WFLW**.
14
+ * **MERLRAV (AFLW 68)**
15
+ * **COFW68**.
16
+ * **300W Public, Private**.
17
+ <details>
18
+ <summary> Coming soon... </summary>
19
+
20
+ * AFLW, AFLW19, AFLW2000 (test only).
21
+ * Menpo and 3D Menpo.
22
+ * COFW.
23
+ * 300WLP
24
+ * 300W Masked
25
+
26
+ </details>
27
+
28
+ ***Note:*** All the callable files provide a detailed parser that describes the behaviour of
29
+ the program and their inputs. Please, check the operational modes by using the extension ```--help```.
30
+
31
+ ## Training/Testing
32
+ The dataloader structure can be found in ```./data/loaders/aligments.py``` and it can be
33
+ manually controlled by instantiating the class ```AlignmentsDataset()``` or by using
34
+ the ```data_config``` structure available in ```./data/loaders/dl_config.py```.
35
+
36
+ Each image sample will follow the next configuration:
37
+ ```
38
+ sample = {'image': Data augmented crop image,
39
+ 'sample_idx': Image ID,
40
+ 'imgpath': Absolute path to raw image,
41
+ 'imgpath_local': Relative path to raw image,
42
+ 'ids_ldm': Landmarks ids,
43
+ 'bbox': Face bbox [x,y,w,h] (ref crop),
44
+ 'bbox_raw': Face bbox [x,y,w,h] (ref image),
45
+ 'landmarks': Augmented landmarks [[x1,y1], [x2,y2], ...] (ref crop)
46
+ 'visible': Visibilities [0,1, ...] (1 == Visible)
47
+ 'mask_ldm': Available landmarks anns [True, False, ...] <- len(ids_ldm)
48
+ 'headpose': Augmented POSIT headpose [yaw, pithc, roll]
49
+ }
50
+
51
+ Extra features while debugging:
52
+ sample = { ...
53
+ 'landmarks_ori' = Ground truth landmarks before augmentation (ref image)
54
+ 'visible_ori' = Ground truth visibilities before augmentation
55
+ 'mask_ldm_ori' = Ground truth mask before augmentation
56
+ 'headpose_ori' = Ground truth headpose before augmentation (if available)
57
+ }
58
+ ```
59
+
60
+ ## Visualizers
61
+ The dataloader framework provides complementary visualizers to further understand the databases,
62
+ datasets and their difficulties:
63
+
64
+ * ```./data/visualize/inspect_dataset.py```
65
+ Focus on the database annotations and the data augmentations, which allows us to
66
+ understand the training, validation and test datasets.
67
+
68
+ * ```./data/visualize/inspect_heatmaps.py```
69
+ Extended visualizer version focus on understanding the heatmaps and boundaries features used for training.
70
+
71
+ * ```./data/model3D/visualization.py```
72
+ Visualize the rigid facial 3D models used by SPIGA to project the initial coordinates of the GAT regressor.
SPIGA/spiga/data/visualize/__init__.py ADDED
File without changes
SPIGA/spiga/data/visualize/inspect_dataset.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import random
3
+ import numpy as np
4
+
5
+ import spiga.data.loaders.dl_config as dl_cfg
6
+ import spiga.data.loaders.dataloader as dl
7
+ import spiga.data.visualize.plotting as plot
8
+
9
+
10
+ def inspect_parser():
11
+ import argparse
12
+ pars = argparse.ArgumentParser(description='Data augmentation and dataset visualization. '
13
+ 'Press Q to quit,'
14
+ 'N to visualize the next image'
15
+ ' and any other key to visualize the next default data.')
16
+ pars.add_argument('database', type=str,
17
+ choices=['wflw', '300wpublic', '300wprivate', 'cofw68', 'merlrav'], help='Database name')
18
+ pars.add_argument('-a', '--anns', type=str, default='train', help='Annotation type: test, train or valid')
19
+ pars.add_argument('-np', '--nopose', action='store_false', default=True, help='Avoid pose generation')
20
+ pars.add_argument('-c', '--clean', action='store_true', help='Process without data augmentation for train')
21
+ pars.add_argument('--shape', nargs='+', type=int, default=[256, 256], help='Image cropped shape (W,H)')
22
+ pars.add_argument('--img', nargs='+', type=int, default=None, help='Select specific image ids')
23
+ return pars.parse_args()
24
+
25
+
26
+ class DatasetInspector:
27
+
28
+ def __init__(self, database, anns_type, data_aug=True, pose=True, image_shape=(256,256)):
29
+
30
+ data_config = dl_cfg.AlignConfig(database, anns_type)
31
+ data_config.image_size = image_shape
32
+ data_config.ftmap_size = image_shape
33
+ data_config.generate_pose = pose
34
+
35
+ if not data_aug:
36
+ data_config.aug_names = []
37
+
38
+ self.data_config = data_config
39
+ dataloader, dataset = dl.get_dataloader(1, data_config, debug=True)
40
+ self.dataset = dataset
41
+ self.dataloader = dataloader
42
+ self.colors_dft = {'lnd': (plot.GREEN, plot.RED), 'pose': (plot.BLUE, plot.GREEN, plot.RED)}
43
+
44
+ def show_dataset(self, ids_list=None):
45
+
46
+ if ids_list is None:
47
+ ids = self.get_idx(shuffle=self.data_config.shuffle)
48
+ else:
49
+ ids = ids_list
50
+
51
+ for img_id in ids:
52
+ data_dict = self.dataset[img_id]
53
+ crop_imgs, full_img = self.plot_features(data_dict)
54
+
55
+ # Plot crop
56
+ if 'merge' in crop_imgs.keys():
57
+ crop = crop_imgs['merge']
58
+ else:
59
+ crop = crop_imgs['lnd']
60
+ cv2.imshow('crop', crop)
61
+
62
+ # Plot full
63
+ cv2.imshow('image', full_img['lnd'])
64
+
65
+ key = cv2.waitKey()
66
+ if key == ord('q'):
67
+ break
68
+
69
+ def plot_features(self, data_dict, colors=None):
70
+
71
+ # Init variables
72
+ crop_imgs = {}
73
+ full_imgs = {}
74
+ if colors is None:
75
+ colors = self.colors_dft
76
+
77
+ # Cropped image
78
+ image = data_dict['image']
79
+ landmarks = data_dict['landmarks']
80
+ visible = data_dict['visible']
81
+ if np.any(np.isnan(visible)):
82
+ visible = None
83
+ mask = data_dict['mask_ldm']
84
+
85
+ # Full image
86
+ if 'image_ori' in data_dict.keys():
87
+ image_ori = data_dict['image_ori']
88
+ else:
89
+ image_ori = cv2.imread(data_dict['imgpath'])
90
+ landmarks_ori = data_dict['landmarks_ori']
91
+ visible_ori = data_dict['visible_ori']
92
+ if np.any(np.isnan(visible_ori)):
93
+ visible_ori = None
94
+ mask_ori = data_dict['mask_ldm_ori']
95
+
96
+ # Plot landmarks
97
+ crop_imgs['lnd'] = self._plot_lnd(image, landmarks, visible, mask, colors=colors['lnd'])
98
+ full_imgs['lnd'] = self._plot_lnd(image_ori, landmarks_ori, visible_ori, mask_ori, colors=colors['lnd'])
99
+
100
+ if self.data_config.generate_pose:
101
+ rot, trl, cam_matrix = self._extract_pose(data_dict)
102
+
103
+ # Plot pose
104
+ crop_imgs['pose'] = plot.draw_pose(image, rot, trl, cam_matrix, euler=True, colors=colors['pose'])
105
+
106
+ # Plot merge features
107
+ crop_imgs['merge'] = plot.draw_pose(crop_imgs['lnd'], rot, trl, cam_matrix, euler=True, colors=colors['pose'])
108
+
109
+ return crop_imgs, full_imgs
110
+
111
+ def get_idx(self, shuffle=False):
112
+ ids = list(range(len(self.dataset)))
113
+ if shuffle:
114
+ random.shuffle(ids)
115
+ return ids
116
+
117
+ def reload_dataset(self, data_config=None):
118
+ if data_config is None:
119
+ data_config = self.data_config
120
+ dataloader, dataset = dl.get_dataloader(1, data_config, debug=True)
121
+ self.dataset = dataset
122
+ self.dataloader = dataloader
123
+
124
+ def _extract_pose(self, data_dict):
125
+ # Rotation and translation matrix
126
+ pose = data_dict['pose']
127
+ rot = pose[:3]
128
+ trl = pose[3:]
129
+
130
+ # Camera matrix
131
+ cam_matrix = data_dict['cam_matrix']
132
+
133
+ # Check for ground truth anns
134
+ if 'headpose_ori' in data_dict.keys():
135
+ if len(self.data_config.aug_names) == 0:
136
+ print('Image headpose generated by ground truth data')
137
+ pose_ori = data_dict['headpose_ori']
138
+ rot = pose_ori
139
+
140
+ return rot, trl, cam_matrix
141
+
142
+ def _plot_lnd(self, image, landmarks, visible, mask, max_shape_thr=720, colors=None):
143
+
144
+ if colors is None:
145
+ colors = self.colors_dft['lnd']
146
+
147
+ # Full image plots
148
+ W, H, C = image.shape
149
+
150
+ # Original image resize if need it
151
+ if W > max_shape_thr or H > max_shape_thr:
152
+ max_shape = max(W, H)
153
+ scale_factor = max_shape_thr / max_shape
154
+ resize_shape = (int(H * scale_factor), int(W * scale_factor))
155
+ image_out = plot.draw_landmarks(image, landmarks, visible=visible, mask=mask,
156
+ thick_scale=1 / scale_factor, colors=colors)
157
+ image_out = cv2.resize(image_out, resize_shape)
158
+ else:
159
+ image_out = plot.draw_landmarks(image, landmarks, visible=visible, mask=mask, colors=colors)
160
+
161
+ return image_out
162
+
163
+
164
+ if __name__ == '__main__':
165
+ args = inspect_parser()
166
+ data_aug = True
167
+ database = args.database
168
+ anns_type = args.anns
169
+ pose = args.nopose
170
+ select_img = args.img
171
+ if args.clean:
172
+ data_aug = False
173
+
174
+ if len(args.shape) != 2:
175
+ raise ValueError('--shape requires two values: width and height. Ej: --shape 256 256')
176
+ else:
177
+ img_shape = tuple(args.shape)
178
+
179
+ visualizer = DatasetInspector(database, anns_type, data_aug=data_aug, pose=pose, image_shape=img_shape)
180
+ visualizer.show_dataset(ids_list=select_img)
181
+
SPIGA/spiga/data/visualize/inspect_heatmaps.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+
4
+ from spiga.data.visualize.inspect_dataset import DatasetInspector, inspect_parser
5
+
6
+
7
+ class HeatmapInspector(DatasetInspector):
8
+
9
+ def __init__(self, database, anns_type, data_aug=True, image_shape=(256,256)):
10
+
11
+ super().__init__(database, anns_type, data_aug=data_aug, pose=False, image_shape=image_shape)
12
+
13
+ self.data_config.aug_names.append('heatmaps2D')
14
+ self.data_config.heatmap2D_norm = False
15
+ self.data_config.aug_names.append('boundaries')
16
+ self.data_config.shuffle = False
17
+ self.reload_dataset()
18
+
19
+ def show_dataset(self, ids_list=None):
20
+
21
+ if ids_list is None:
22
+ ids = self.get_idx(shuffle=self.data_config.shuffle)
23
+ else:
24
+ ids = ids_list
25
+
26
+ for img_id in ids:
27
+ data_dict = self.dataset[img_id]
28
+
29
+ crop_imgs, _ = self.plot_features(data_dict)
30
+
31
+ # Plot landmark crop
32
+ cv2.imshow('crop', crop_imgs['lnd'])
33
+
34
+ # Plot landmarks 2D (group)
35
+ crop_allheats = self._plot_heatmaps2D(data_dict)
36
+
37
+ # Plot boundaries shape
38
+ cv2.imshow('boundary', np.max(data_dict['boundary'], axis=0))
39
+
40
+ for lnd_idx in range(self.data_config.database.num_landmarks):
41
+ # Heatmaps 2D
42
+ crop_heats = self._plot_heatmaps2D(data_dict, lnd_idx)
43
+ maps = cv2.hconcat([crop_allheats['heatmaps2D'], crop_heats['heatmaps2D']])
44
+ cv2.imshow('heatmaps', maps)
45
+
46
+ key = cv2.waitKey()
47
+ if key == ord('q'):
48
+ break
49
+ if key == ord('n'):
50
+ break
51
+
52
+ if key == ord('q'):
53
+ break
54
+
55
+ def _plot_heatmaps2D(self, data_dict, heatmap_id=None):
56
+
57
+ # Variables
58
+ heatmaps = {}
59
+ image = data_dict['image']
60
+
61
+ if heatmap_id is None:
62
+ heatmaps2D = data_dict['heatmap2D']
63
+ heatmaps2D = np.max(heatmaps2D, axis=0)
64
+ else:
65
+ heatmaps2D = data_dict['heatmap2D'][heatmap_id]
66
+
67
+ # Plot maps
68
+ heatmaps['heatmaps2D'] = self._merge_imgmap(image, heatmaps2D)
69
+ return heatmaps
70
+
71
+ def _merge_imgmap(self, image, maps):
72
+ crop_maps = cv2.applyColorMap(np.uint8(255 * maps), cv2.COLORMAP_JET)
73
+ return cv2.addWeighted(image, 0.7, crop_maps, 0.3, 0)
74
+
75
+
76
+ if __name__ == '__main__':
77
+
78
+ args = inspect_parser()
79
+ data_aug = True
80
+ database = args.database
81
+ anns_type = args.anns
82
+ select_img = args.img
83
+ if args.clean:
84
+ data_aug = False
85
+
86
+ if len(args.shape) != 2:
87
+ raise ValueError('--shape requires two values: width and height. Ej: --shape 256 256')
88
+ else:
89
+ img_shape = tuple(args.shape)
90
+
91
+ visualizer = HeatmapInspector(database, anns_type, data_aug, image_shape=img_shape)
92
+ visualizer.show_dataset(ids_list=select_img)
SPIGA/spiga/data/visualize/plotting.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+ import cv2
4
+
5
+ import spiga.data.loaders.augmentors.utils as dlu
6
+
7
+ BLUE = (255, 0, 0)
8
+ GREEN = (0, 255, 0)
9
+ RED = (0, 0, 255)
10
+ PURPLE = (128, 0, 128)
11
+
12
+
13
+ def draw_landmarks(image, landmarks, visible=None, mask=None, thick_scale=1, colors=(GREEN, RED)):
14
+ # Fix variable
15
+ thick = int(2 * thick_scale + 0.5)
16
+ # Initialize variables if need it
17
+ if visible is None:
18
+ visible = np.ones(len(landmarks))
19
+ if mask is None:
20
+ mask = np.ones(len(landmarks))
21
+
22
+ mask = np.array(mask, dtype=bool)
23
+ visible = np.array(visible, dtype=bool)
24
+
25
+ # Clean and split landmarks
26
+ landmarks = landmarks[mask]
27
+ visible = visible[mask]
28
+ ldm_vis = landmarks[visible]
29
+ not_visible = np.logical_not(visible)
30
+ ldm_notvis = landmarks[not_visible]
31
+
32
+ # Plot landmarks
33
+ if image.shape[0] == 3:
34
+ image = image.transpose(1, 2, 0)
35
+
36
+ canvas = image.copy()
37
+ canvas = _write_circles(canvas, ldm_vis, color=colors[0], thick=thick)
38
+ canvas = _write_circles(canvas, ldm_notvis, color=colors[1], thick=thick)
39
+
40
+ return canvas
41
+
42
+
43
+ def _write_circles(canvas, landmarks, color=RED, thick=2):
44
+ for xy in landmarks:
45
+ xy = np.array(xy+0.5, dtype=int)
46
+ canvas = cv2.circle(canvas, (xy[0], xy[1]), thick, color, -1)
47
+ return canvas
48
+
49
+
50
+ def plot_landmarks_pil(image, landmarks, visible=None, mask=None):
51
+
52
+ # Initialize variables if need it
53
+ if visible is None:
54
+ visible = np.ones(len(landmarks))
55
+ if mask is None:
56
+ mask = np.ones(len(landmarks))
57
+
58
+ mask = np.array(mask, dtype=bool)
59
+ visible = np.array(visible, dtype=bool)
60
+ not_visible = np.logical_not(visible)
61
+
62
+ # Clean and split landmarks
63
+ landmarks = landmarks[mask]
64
+ ldm_vis = landmarks[visible]
65
+ ldm_notvis = landmarks[not_visible]
66
+
67
+ # Plot landmarks
68
+ if image.shape[0] == 3:
69
+ image = image.transpose(1, 2, 0)
70
+
71
+ plt.imshow(image / 255)
72
+ plt.scatter(ldm_vis[:, 0], ldm_vis[:, 1], s=10, marker='.', c='g')
73
+ plt.scatter(ldm_notvis[:, 0], ldm_notvis[:, 1], s=10, marker='.', c='r')
74
+ plt.show()
75
+
76
+
77
+ def draw_pose(img, rot, trl, K, euler=False, size=0.5, colors=(BLUE, GREEN, RED)):
78
+ if euler:
79
+ rot = dlu.euler_to_rotation_matrix(rot)
80
+
81
+ canvas = img.copy()
82
+ rotV, _ = cv2.Rodrigues(rot)
83
+ points = np.float32([[size, 0, 0], [0, -size, 0], [0, 0, -size], [0, 0, 0]]).reshape(-1, 3)
84
+ axisPoints, _ = cv2.projectPoints(points, rotV, trl, K, (0, 0, 0, 0))
85
+ axisPoints = axisPoints.astype(int)
86
+ canvas = cv2.line(canvas, tuple(axisPoints[3].ravel()), tuple(axisPoints[2].ravel()), colors[0], 3)
87
+ canvas = cv2.line(canvas, tuple(axisPoints[3].ravel()), tuple(axisPoints[1].ravel()), colors[1], 3)
88
+ canvas = cv2.line(canvas, tuple(axisPoints[3].ravel()), tuple(axisPoints[0].ravel()), colors[2], 3)
89
+
90
+ return canvas
91
+
92
+
93
+ def enhance_heatmap(heatmap):
94
+ map_aux = heatmap - heatmap.min()
95
+ map_aux = map_aux / map_aux.max()
96
+ map_img = cv2.applyColorMap((map_aux * 255).astype(np.uint8), cv2.COLORMAP_BONE)
97
+ return map_img
SPIGA/spiga/demo/__init__.py ADDED
File without changes
SPIGA/spiga/demo/analyze/__init__.py ADDED
File without changes