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
43121b44
Commit
43121b44
authored
4 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
New baseline
New baseline
parent
9c561fe2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!105
New baseline
Pipeline
#48381
passed
4 years ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/bio/face/config/baseline/resnet50_vgg2_arcface_2021.py
+34
-0
34 additions, 0 deletions
bob/bio/face/config/baseline/resnet50_vgg2_arcface_2021.py
bob/bio/face/embeddings/resnet50.py
+69
-0
69 additions, 0 deletions
bob/bio/face/embeddings/resnet50.py
setup.py
+2
-0
2 additions, 0 deletions
setup.py
with
105 additions
and
0 deletions
bob/bio/face/config/baseline/resnet50_vgg2_arcface_2021.py
0 → 100644
+
34
−
0
View file @
43121b44
from
bob.bio.face.embeddings.resnet50
import
Resnet50_VGG2_ArcFace_2021
from
bob.bio.face.config.baseline.helpers
import
embedding_transformer_112x112
from
bob.bio.base.pipelines.vanilla_biometrics
import
(
Distance
,
VanillaBiometricsPipeline
,
)
memory_demanding
=
False
if
"
database
"
in
locals
():
annotation_type
=
database
.
annotation_type
fixed_positions
=
database
.
fixed_positions
memory_demanding
=
(
database
.
memory_demanding
if
hasattr
(
database
,
"
memory_demanding
"
)
else
False
)
else
:
annotation_type
=
None
fixed_positions
=
None
def
load
(
annotation_type
,
fixed_positions
=
None
):
transformer
=
embedding_transformer_112x112
(
Resnet50_VGG2_ArcFace_2021
(
memory_demanding
=
memory_demanding
),
annotation_type
,
fixed_positions
,
)
algorithm
=
Distance
()
return
VanillaBiometricsPipeline
(
transformer
,
algorithm
)
pipeline
=
load
(
annotation_type
,
fixed_positions
)
transformer
=
pipeline
.
transformer
This diff is collapsed.
Click to expand it.
bob/bio/face/embeddings/resnet50.py
+
69
−
0
View file @
43121b44
...
@@ -77,3 +77,72 @@ class Resnet50_MsCeleb_ArcFace_2021(TransformTensorflow):
...
@@ -77,3 +77,72 @@ class Resnet50_MsCeleb_ArcFace_2021(TransformTensorflow):
embeddings
=
tf
.
math
.
l2_normalize
(
prelogits
,
axis
=-
1
)
embeddings
=
tf
.
math
.
l2_normalize
(
prelogits
,
axis
=-
1
)
return
embeddings
return
embeddings
class
Resnet50_VGG2_ArcFace_2021
(
TransformTensorflow
):
"""
Resnet50 Backbone trained with the VGG2 database.
The bottleneck layer (a.k.a embedding) has 512d.
The configuration file used to trained is:
```yaml
batch-size: 128
face-size: 112
face-output_size: 112
n-classes: 8631
## Backbone
backbone:
'
resnet50
'
head:
'
arcface
'
s: 64
bottleneck: 512
m: 0.5
# Training parameters
solver:
"
sgd
"
lr: 0.1
dropout-rate: 0.5
epochs: 1047
train-tf-record-path:
"
<PATH>
"
validation-tf-record-path:
"
<PATH>
"
```
"""
def
__init__
(
self
,
memory_demanding
=
False
):
internal_path
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
"
data
"
,
"
resnet50_vgg2_arcface_2021
"
),
)
checkpoint_path
=
(
internal_path
if
rc
[
"
bob.bio.face.models.resnet50_vgg2_arcface_2021
"
]
is
None
else
rc
[
"
bob.bio.face.models.resnet50_vgg2_arcface_2021
"
]
)
urls
=
[
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50_vgg2_arcface_2021.tar.gz
"
,
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/master/tf2/resnet50_vgg2_arcface_2021.tar.gz
"
,
]
download_model
(
checkpoint_path
,
urls
,
"
resnet50_vgg2_arcface_2021.tar.gz
"
)
super
(
Resnet50_VGG2_ArcFace_2021
,
self
).
__init__
(
checkpoint_path
,
preprocessor
=
lambda
X
:
X
/
255.0
,
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
)
embeddings
=
tf
.
math
.
l2_normalize
(
prelogits
,
axis
=-
1
)
return
embeddings
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
0
View file @
43121b44
...
@@ -147,6 +147,7 @@ setup(
...
@@ -147,6 +147,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-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
"
,
],
],
"
bob.bio.config
"
:
[
"
bob.bio.config
"
:
[
...
@@ -177,6 +178,7 @@ setup(
...
@@ -177,6 +178,7 @@ setup(
"
meds = bob.bio.face.config.database.meds
"
,
"
meds = bob.bio.face.config.database.meds
"
,
"
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-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
"
,
],
],
"
bob.bio.cli
"
:
[
"
bob.bio.cli
"
:
[
...
...
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