Skip to content

Commit 095da69

Browse files
Merge pull request #27 from tomas-gajarsky/feature/adaface
Feature/adaface
2 parents ab12c7f + 52d647e commit 095da69

12 files changed

+67
-18
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## 0.1.4
4+
5+
Released on November 18, 2022.
6+
7+
### Added
8+
* predictor for face verification and face recognition - AdaFace by Kim et al.
9+
310

411
## 0.1.3
512

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,22 @@ analyzer
110110

111111
#### Face Verification (verify)
112112

113-
| verify | source | license | version |
114-
| ------------- | ----------- | ------------------ | ------- |
115-
| MagFace+UNPG | Jung-Jun-Uk | Apache License 2.0 | 1 |
113+
| verify | source | license | version |
114+
| ---------------- | ----------- | ------------------ | ------- |
115+
| MagFace+UNPG | Jung-Jun-Uk | Apache License 2.0 | 1 |
116+
| AdaFaceR100W12M | mk-minchul | MIT License | 2 |
116117

117118
1. Jung-Jun-Uk
118119
* code: [UNPG](https://github.com/jung-jun-uk/unpg)
119120
* paper: [Jung et al. - Unified Negative Pair Generation toward Well-discriminative Feature Space for Face Recognition](https://arxiv.org/abs/2203.11593)
120-
* [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/unified-negative-pair-generation-toward-well/face-verification-on-ijb-b)](https://paperswithcode.com/sota/face-verification-on-ijb-b?p=unified-negative-pair-generation-toward-well)
121+
* [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/unified-negative-pair-generation-toward-well/face-verification-on-ijb-b)](https://paperswithcode.com/sota/face-verification-on-ijb-b?p=unified-negative-pair-generation-toward-well)(FAR=0.01)
122+
* Note: ```include_tensors``` needs to be True in order to include the model prediction in Prediction.logits
123+
2. mk-minchul
124+
* code: [AdaFace](https://github.com/mk-minchul/adaface)
125+
* paper: [Kim et al. - AdaFace: Quality Adaptive Margin for Face Recognition](https://arxiv.org/abs/2204.00964)
126+
* [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/adaface-quality-adaptive-margin-for-face/face-verification-on-ijb-b)](https://paperswithcode.com/sota/face-verification-on-ijb-b?p=adaface-quality-adaptive-margin-for-face) <
127+
* [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/adaface-quality-adaptive-margin-for-face/face-verification-on-ijb-c)](https://paperswithcode.com/sota/face-verification-on-ijb-c?p=adaface-quality-adaptive-margin-for-face) <
128+
* < badges represent models trained on smaller WebFace 4M dataset
121129
* Note: ```include_tensors``` needs to be True in order to include the model prediction in Prediction.logits
122130

123131

@@ -170,7 +178,7 @@ You can also download the models manually from a [public Google Drive folder](ht
170178

171179
### Execution time
172180

173-
Image test.jpg (4 faces) is analyzed (including drawing boxes and landmarks, but not saving) in about 440ms and test3.jpg (25 faces) in about 1416ms (batch_size=8) on NVIDIA Tesla T4 GPU once the default configuration (*conf/config.yaml*) of models is initialized and pre heated to the initial image size 1080x1080 by the first run. One can monitor the execution times in logs using the DEBUG level.
181+
Image test.jpg (4 faces) is analyzed (including drawing boxes and landmarks, but not saving) in about 465ms and test3.jpg (25 faces) in about 1480ms (batch_size=8) on NVIDIA Tesla T4 GPU once the default configuration (*conf/config.yaml*) of models is initialized and pre heated to the initial image size 1080x1080 by the first run. One can monitor the execution times in logs using the DEBUG level.
174182

175183
Detailed test.jpg execution times:
176184
```
@@ -180,7 +188,7 @@ analyzer
180188
├── unifier: 1 ms
181189
└── predictor
182190
├── embed: 8 ms
183-
├── verify: 18 ms
191+
├── verify: 58 ms
184192
├── fer: 28 ms
185193
├── deepfake: 117 ms
186194
└── align: 5 ms

conf/analyzer/predictor/embed/r50_vggface_1m.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ preprocessor:
2121
std: [0.228, 0.224, 0.225] # List[float]
2222
device:
2323
_target_: torch.device
24-
type: ${analyzer.predictor.fer.device.type}
24+
type: ${analyzer.predictor.embed.device.type}
2525
optimize_transform: ${analyzer.optimize_transforms}
2626
reverse_colors: False # bool
2727

@@ -30,6 +30,6 @@ postprocessor:
3030
transform: None
3131
device:
3232
_target_: torch.device
33-
type: ${analyzer.predictor.fer.device.type}
33+
type: ${analyzer.predictor.embed.device.type}
3434
optimize_transform: ${analyzer.optimize_transforms}
3535
labels: ["abstract"] # List
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
_target_: facetorch.analyzer.predictor.FacePredictor
2+
3+
downloader:
4+
_target_: facetorch.downloader.DownloaderGDrive
5+
file_id: 1WI-mP_0mGW31OHfriPUsuFS_usYh_W8p
6+
path_local: /opt/facetorch/models/torchscript/predictor/verify/2/model.pt # str
7+
8+
device:
9+
_target_: torch.device
10+
type: ${analyzer.device} # str
11+
12+
preprocessor:
13+
_target_: facetorch.analyzer.predictor.pre.PredictorPreProcessor
14+
transform:
15+
_target_: torchvision.transforms.Compose
16+
transforms:
17+
- _target_: torchvision.transforms.Resize
18+
size: [112, 112] # List[int]
19+
- _target_: torchvision.transforms.Normalize
20+
mean: [0.5, 0.5, 0.5] # List[float]
21+
std: [0.5, 0.5, 0.5] # List[float]
22+
device:
23+
_target_: torch.device
24+
type: ${analyzer.predictor.verify.device.type}
25+
optimize_transform: ${analyzer.optimize_transforms}
26+
reverse_colors: True # bool
27+
28+
postprocessor:
29+
_target_: facetorch.analyzer.predictor.post.PostEmbedder
30+
transform: None
31+
device:
32+
_target_: torch.device
33+
type: ${analyzer.predictor.verify.device.type}
34+
optimize_transform: ${analyzer.optimize_transforms}
35+
labels: ["abstract"] # List

conf/analyzer/predictor/verify/r100_magface_unpg.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ preprocessor:
2121
std: [0.229, 0.224, 0.225] # List[float]
2222
device:
2323
_target_: torch.device
24-
type: ${analyzer.predictor.fer.device.type}
24+
type: ${analyzer.predictor.verify.device.type}
2525
optimize_transform: ${analyzer.optimize_transforms}
2626
reverse_colors: False # bool
2727

@@ -30,6 +30,6 @@ postprocessor:
3030
transform: None
3131
device:
3232
_target_: torch.device
33-
type: ${analyzer.predictor.fer.device.type}
33+
type: ${analyzer.predictor.verify.device.type}
3434
optimize_transform: ${analyzer.optimize_transforms}
3535
labels: ["abstract"] # List

conf/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defaults:
44
- analyzer/detector: retinaface.yaml
55
- analyzer/unifier: img_380.yaml
66
- analyzer/predictor/embed: r50_vggface_1m.yaml
7-
- analyzer/predictor/verify: r100_magface_unpg.yaml
7+
- analyzer/predictor/verify: adaface_ir101_webface12m.yaml
88
- analyzer/predictor/fer: efficientnet_b2_8.yaml
99
- analyzer/predictor/deepfake: efficientnet_b7.yaml
1010
- analyzer/predictor/align: synergy_mobilenet_v2.yaml

conf/tests.config.1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defaults:
44
- analyzer/detector: retinaface.yaml
55
- analyzer/unifier: img_380.yaml
66
- analyzer/predictor/embed: r50_vggface_1m.yaml
7-
- analyzer/predictor/verify: r100_magface_unpg.yaml
7+
- analyzer/predictor/verify: adaface_ir101_webface12m.yaml
88
- analyzer/predictor/fer: efficientnet_b2_8.yaml
99
- analyzer/predictor/deepfake: efficientnet_b7.yaml
1010
- analyzer/predictor/align: synergy_mobilenet_v2.yaml

conf/tests.config.3.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defaults:
44
- analyzer/detector: retinaface.yaml
55
- analyzer/unifier: img_380.yaml
66
- analyzer/predictor/embed: r50_vggface_1m.yaml
7-
- analyzer/predictor/verify: r100_magface_unpg.yaml
7+
- analyzer/predictor/verify: adaface_ir101_webface12m.yaml
88
- analyzer/predictor/fer: efficientnet_b2_8.yaml
99
- analyzer/predictor/deepfake: efficientnet_b7.yaml
1010
- analyzer/predictor/align: synergy_mobilenet_v2.yaml

conf/tests.config.4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defaults:
44
- analyzer/detector: retinaface.yaml
55
- analyzer/unifier: img_380.yaml
66
- analyzer/predictor/embed: r50_vggface_1m.yaml
7-
- analyzer/predictor/verify: r100_magface_unpg.yaml
7+
- analyzer/predictor/verify: adaface_ir101_webface12m.yaml
88
- analyzer/predictor/fer: efficientnet_b2_8.yaml
99
- analyzer/predictor/deepfake: efficientnet_b7.yaml
1010
- analyzer/predictor/align: synergy_mobilenet_v2.yaml

tests/test_detector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def test_downloader_run(analyzer):
1313
os.remove(analyzer.detector.downloader.path_local)
1414
analyzer.detector.downloader.run()
1515
assert os.path.exists(analyzer.detector.downloader.path_local)
16-
os.remove(analyzer.detector.downloader.path_local)
1716

1817

1918
@pytest.mark.integration

0 commit comments

Comments
 (0)