Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.face
Commits
e2797112
Commit
e2797112
authored
3 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Added new baseline
parent
b894b829
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!112
Feature extractors
Pipeline
#51345
passed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/bio/face/config/baseline/resnet50_msceleb_arcface_20210521.py
+15
-0
15 additions, 0 deletions
...face/config/baseline/resnet50_msceleb_arcface_20210521.py
bob/bio/face/embeddings/tensorflow.py
+99
-14
99 additions, 14 deletions
bob/bio/face/embeddings/tensorflow.py
setup.py
+2
-0
2 additions, 0 deletions
setup.py
with
116 additions
and
14 deletions
bob/bio/face/config/baseline/resnet50_msceleb_arcface_20210521.py
0 → 100644
+
15
−
0
View file @
e2797112
from
bob.bio.face.embeddings.tensorflow
import
resnet50_msceleb_arcface_20210521
from
bob.bio.face.utils
import
lookup_config_from_database
annotation_type
,
fixed_positions
,
memory_demanding
=
lookup_config_from_database
(
locals
().
get
(
"
database
"
)
)
def
load
(
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
None
):
return
resnet50_msceleb_arcface_20210521
(
annotation_type
,
fixed_positions
,
memory_demanding
)
pipeline
=
load
(
annotation_type
,
fixed_positions
,
memory_demanding
)
This diff is collapsed.
Click to expand it.
bob/bio/face/embeddings/tensorflow.py
+
99
−
14
View file @
e2797112
...
@@ -314,15 +314,15 @@ class Resnet50_MsCeleb_ArcFace_2021(TensorflowTransformer):
...
@@ -314,15 +314,15 @@ class Resnet50_MsCeleb_ArcFace_2021(TensorflowTransformer):
def
__init__
(
self
,
memory_demanding
=
False
):
def
__init__
(
self
,
memory_demanding
=
False
):
urls
=
[
urls
=
[
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50
_
msceleb
_
arcface_2021.tar.gz
"
,
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50
-
msceleb
-
arcface_2021
-48ec5cb8
.tar.gz
"
,
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50
_
msceleb
_
arcface_2021.tar.gz
"
,
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50
-
msceleb
-
arcface_2021
-48ec5cb8
.tar.gz
"
,
]
]
filename
=
get_file
(
filename
=
get_file
(
"
resnet50
_
msceleb
_
arcface_2021.tar.gz
"
,
"
resnet50
-
msceleb
-
arcface_2021
-48ec5cb8
.tar.gz
"
,
urls
,
urls
,
cache_subdir
=
"
data/tensorflow/resnet50
_
msceleb
_
arcface_2021
"
,
cache_subdir
=
"
data/tensorflow/resnet50
-
msceleb
-
arcface_2021
-48ec5cb8
"
,
file_hash
=
"
1
e4b9791669ef79cf8ed80a6fc830205
"
,
file_hash
=
"
1
7946f121af5ddd18c637c4620e54da6
"
,
extract
=
True
,
extract
=
True
,
)
)
checkpoint_path
=
os
.
path
.
dirname
(
filename
)
checkpoint_path
=
os
.
path
.
dirname
(
filename
)
...
@@ -333,13 +333,71 @@ class Resnet50_MsCeleb_ArcFace_2021(TensorflowTransformer):
...
@@ -333,13 +333,71 @@ class Resnet50_MsCeleb_ArcFace_2021(TensorflowTransformer):
memory_demanding
=
memory_demanding
,
memory_demanding
=
memory_demanding
,
)
)
def
inference
(
self
,
X
):
if
self
.
preprocessor
is
not
None
:
X
=
self
.
preprocessor
(
tf
.
cast
(
X
,
"
float32
"
))
prelogits
=
self
.
model
.
predict_on_batch
(
X
)[
0
]
class
Resnet50_MsCeleb_ArcFace_20210521
(
TensorflowTransformer
):
embeddings
=
tf
.
math
.
l2_normalize
(
prelogits
,
axis
=-
1
)
"""
return
embeddings
Resnet50 Backbone trained with the MSCeleb 1M database. The bottleneck layer (a.k.a embedding) has 512d.
The difference from this one to :any:`Resnet50_MsCeleb_ArcFace_2021` is the MSCeleb version used to train it.
This one uses 100% of the data pruned from annotators.
The configuration file used to trained is:
.. warning::
This configuration file might change in future releases
```yaml
batch-size: 128
face-size: 112
face-output_size: 112
n-classes: 83009
## Backbone
backbone:
'
resnet50
'
head:
'
arcface
'
s: 30
bottleneck: 512
m: 0.5
# Training parameters
solver:
"
sgd
"
lr: 0.1
dropout-rate: 0.5
epochs: 300
train-tf-record-path:
"
<PATH>
"
validation-tf-record-path:
"
<PATH>
"
```
"""
def
__init__
(
self
,
memory_demanding
=
False
):
urls
=
[
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50-msceleb-arcface_20210521-e9bc085c.tar.gz
"
,
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50-msceleb-arcface_20210521-e9bc085c.tar.gz
"
,
]
filename
=
get_file
(
"
resnet50-msceleb-arcface_20210521-e9bc085c.tar.gz
"
,
urls
,
cache_subdir
=
"
data/tensorflow/resnet50-msceleb-arcface_20210521-801991f0
"
,
file_hash
=
"
e33090eea4951ce80be4620a0dac680d
"
,
extract
=
True
,
)
checkpoint_path
=
os
.
path
.
dirname
(
filename
)
super
(
Resnet50_MsCeleb_ArcFace_20210521
,
self
).
__init__
(
checkpoint_path
,
preprocessor
=
lambda
X
:
X
/
255.0
,
memory_demanding
=
memory_demanding
,
)
class
Resnet50_VGG2_ArcFace_2021
(
TensorflowTransformer
):
class
Resnet50_VGG2_ArcFace_2021
(
TensorflowTransformer
):
...
@@ -549,7 +607,7 @@ def resnet50_msceleb_arcface_2021(
...
@@ -549,7 +607,7 @@ def resnet50_msceleb_arcface_2021(
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
):
):
"""
"""
Get the Resnet50 pipeline which will crop the face :math:`1
60
\t
imes 1
60
` and
Get the Resnet50 pipeline which will crop the face :math:`1
12
\t
imes 1
12
` and
use the :py:class:`Resnet50_MsCeleb_ArcFace_2021` to extract the features
use the :py:class:`Resnet50_MsCeleb_ArcFace_2021` to extract the features
Parameters
Parameters
...
@@ -572,11 +630,38 @@ def resnet50_msceleb_arcface_2021(
...
@@ -572,11 +630,38 @@ def resnet50_msceleb_arcface_2021(
)
)
def
resnet50_msceleb_arcface_20210521
(
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
):
"""
Get the Resnet50 pipeline which will crop the face :math:`112
\t
imes 112` and
use the :py:class:`Resnet50_MsCeleb_ArcFace_20210521` to extract the features
Parameters
----------
annotation_type: str
Type of the annotations (e.g. `eyes-center
'
)
fixed_positions: dict
Set it if in your face images are registered to a fixed position in the image
memory_demanding: bool
"""
return
resnet_template
(
embedding
=
Resnet50_MsCeleb_ArcFace_20210521
(
memory_demanding
=
memory_demanding
),
annotation_type
=
annotation_type
,
fixed_positions
=
fixed_positions
,
)
def
resnet50_vgg2_arcface_2021
(
def
resnet50_vgg2_arcface_2021
(
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
):
):
"""
"""
Get the Resnet50 pipeline which will crop the face :math:`1
60
\t
imes 1
60
` and
Get the Resnet50 pipeline which will crop the face :math:`1
12
\t
imes 1
12
` and
use the :py:class:`Resnet50_VGG2_ArcFace_2021` to extract the features
use the :py:class:`Resnet50_VGG2_ArcFace_2021` to extract the features
Parameters
Parameters
...
@@ -603,7 +688,7 @@ def mobilenetv2_msceleb_arcface_2021(
...
@@ -603,7 +688,7 @@ def mobilenetv2_msceleb_arcface_2021(
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
annotation_type
,
fixed_positions
=
None
,
memory_demanding
=
False
):
):
"""
"""
Get the MobileNet pipeline which will crop the face :math:`1
60
\t
imes 1
60
` and
Get the MobileNet pipeline which will crop the face :math:`1
12
\t
imes 1
12
` and
use the :py:class:`MobileNetv2_MsCeleb_ArcFace_2021` to extract the features
use the :py:class:`MobileNetv2_MsCeleb_ArcFace_2021` to extract the features
Parameters
Parameters
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
0
View file @
e2797112
...
@@ -134,6 +134,7 @@ setup(
...
@@ -134,6 +134,7 @@ setup(
"
lda = bob.bio.face.config.baseline.lda:pipeline
"
,
"
lda = bob.bio.face.config.baseline.lda:pipeline
"
,
"
dummy = bob.bio.face.config.baseline.dummy:pipeline
"
,
"
dummy = bob.bio.face.config.baseline.dummy:pipeline
"
,
"
resnet50-msceleb-arcface-2021 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_2021:pipeline
"
,
"
resnet50-msceleb-arcface-2021 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_2021:pipeline
"
,
"
resnet50-msceleb-arcface-20210521 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_20210521:pipeline
"
,
"
resnet50-vgg2-arcface-2021 = bob.bio.face.config.baseline.resnet50_vgg2_arcface_2021:pipeline
"
,
"
resnet50-vgg2-arcface-2021 = bob.bio.face.config.baseline.resnet50_vgg2_arcface_2021:pipeline
"
,
"
mobilenetv2-msceleb-arcface-2021 = bob.bio.face.config.baseline.mobilenetv2_msceleb_arcface_2021
"
,
"
mobilenetv2-msceleb-arcface-2021 = bob.bio.face.config.baseline.mobilenetv2_msceleb_arcface_2021
"
,
"
mxnet-tinyface = bob.bio.face.config.baseline.mxnet_tinyface:pipeline
"
,
"
mxnet-tinyface = bob.bio.face.config.baseline.mxnet_tinyface:pipeline
"
,
...
@@ -176,6 +177,7 @@ setup(
...
@@ -176,6 +177,7 @@ setup(
"
casia-africa = bob.bio.face.config.database.casia_africa
"
,
"
casia-africa = bob.bio.face.config.database.casia_africa
"
,
"
morph = bob.bio.face.config.database.morph
"
,
"
morph = bob.bio.face.config.database.morph
"
,
"
resnet50-msceleb-arcface-2021 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_2021
"
,
"
resnet50-msceleb-arcface-2021 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_2021
"
,
"
resnet50-msceleb-arcface-20210521 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_20210521:pipeline
"
,
"
resnet50-vgg2-arcface-2021 = bob.bio.face.config.baseline.resnet50_vgg2_arcface_2021
"
,
"
resnet50-vgg2-arcface-2021 = bob.bio.face.config.baseline.resnet50_vgg2_arcface_2021
"
,
"
mobilenetv2-msceleb-arcface-2021 = bob.bio.face.config.baseline.mobilenetv2_msceleb_arcface_2021
"
,
"
mobilenetv2-msceleb-arcface-2021 = bob.bio.face.config.baseline.mobilenetv2_msceleb_arcface_2021
"
,
"
iresnet34 = bob.bio.face.config.baseline.iresnet34
"
,
"
iresnet34 = bob.bio.face.config.baseline.iresnet34
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment