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
50190761
Commit
50190761
authored
3 years ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
Use sparse CSVDataset for replay-mobile
parent
5c081127
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!128
Using sparse CSVDataset for replay-mobile
Pipeline
#52218
failed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/database/replaymobile.py
+12
-22
12 additions, 22 deletions
bob/bio/face/database/replaymobile.py
with
12 additions
and
22 deletions
bob/bio/face/database/replaymobile.py
+
12
−
22
View file @
50190761
...
@@ -75,7 +75,6 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
...
@@ -75,7 +75,6 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
dataset_original_directory
=
dataset_original_directory
,
dataset_original_directory
=
dataset_original_directory
,
)
)
self
.
reference_id_equal_subject_id
=
reference_id_equal_subject_id
self
.
reference_id_equal_subject_id
=
reference_id_equal_subject_id
self
.
references_list
=
[]
def
convert_row_to_sample
(
self
,
row
,
header
):
def
convert_row_to_sample
(
self
,
row
,
header
):
"""
Creates a sample given a row of the CSV protocol definition.
"""
"""
Creates a sample given a row of the CSV protocol definition.
"""
...
@@ -88,25 +87,10 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
...
@@ -88,25 +87,10 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
raise
ValueError
(
f
"
`subject_id` not available in
{
header
}
"
)
raise
ValueError
(
f
"
`subject_id` not available in
{
header
}
"
)
if
"
should_flip
"
not
in
fields
:
if
"
should_flip
"
not
in
fields
:
raise
ValueError
(
f
"
`should_flip` not available in
{
header
}
"
)
raise
ValueError
(
f
"
`should_flip` not available in
{
header
}
"
)
if
"
purpose
"
not
in
fields
:
raise
ValueError
(
f
"
`purpose` not available in
{
header
}
"
)
kwargs
=
{
k
:
fields
[
k
]
for
k
in
fields
.
keys
()
-
{
"
id
"
,
"
should_flip
"
}}
kwargs
=
{
k
:
fields
[
k
]
for
k
in
fields
.
keys
()
-
{
"
id
"
,
"
should_flip
"
}}
# Retrieve the references list
# One row creates one samples (=> one comparison because of `is_sparse`)
if
(
fields
[
"
purpose
"
].
lower
()
==
"
enroll
"
and
fields
[
"
reference_id
"
]
not
in
self
.
references_list
):
self
.
references_list
.
append
(
fields
[
"
reference_id
"
])
# Set the references list in the probes for vanilla-biometrics
if
fields
[
"
purpose
"
].
lower
()
!=
"
enroll
"
:
if
fields
[
"
attack_type
"
]:
# Attacks are only compare to their target (no `spoof_neg`)
kwargs
[
"
references
"
]
=
[
fields
[
"
reference_id
"
]]
else
:
kwargs
[
"
references
"
]
=
self
.
references_list
# One row leads to multiple samples (different frames)
return
DelayedSample
(
return
DelayedSample
(
functools
.
partial
(
functools
.
partial
(
load_frame_from_file_replaymobile
,
load_frame_from_file_replaymobile
,
...
@@ -246,7 +230,10 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -246,7 +230,10 @@ class ReplayMobileBioDatabase(CSVDataset):
):
):
if
protocol_definition_path
is
None
:
if
protocol_definition_path
is
None
:
# Downloading database description files if it is not specified
# Downloading database description files if it is not specified
proto_def_name
=
"
bio-face-replaymobile-img-3a584a97.tar.gz
"
proto_def_hash
=
"
d66b5daf
"
proto_def_name
=
(
f
"
database-protocols-replaymobile-img-
{
proto_def_hash
}
.tar.gz
"
)
proto_def_urls
=
[
proto_def_urls
=
[
f
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/
{
proto_def_name
}
"
,
f
"
https://www.idiap.ch/software/bob/data/bob/bob.bio.face/
{
proto_def_name
}
"
,
f
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/
{
proto_def_name
}
"
,
f
"
http://www.idiap.ch/software/bob/data/bob/bob.bio.face/
{
proto_def_name
}
"
,
...
@@ -255,7 +242,7 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -255,7 +242,7 @@ class ReplayMobileBioDatabase(CSVDataset):
filename
=
proto_def_name
,
filename
=
proto_def_name
,
urls
=
proto_def_urls
,
urls
=
proto_def_urls
,
cache_subdir
=
"
datasets
"
,
cache_subdir
=
"
datasets
"
,
file_hash
=
"
3a584a97
"
,
file_hash
=
proto_def_hash
,
)
)
if
data_path
is
None
:
if
data_path
is
None
:
...
@@ -268,7 +255,10 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -268,7 +255,10 @@ class ReplayMobileBioDatabase(CSVDataset):
)
)
if
annotations_path
is
None
:
if
annotations_path
is
None
:
annot_name
=
"
annotations-replaymobile-mtcnn-9cd6e452.tar.xz
"
annot_hash
=
"
9cd6e452
"
annot_name
=
(
f
"
annotations-replaymobile-mtcnn-
{
annot_hash
}
.tar.xz
"
)
annot_urls
=
[
annot_urls
=
[
f
"
https://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
annot_name
}
"
,
f
"
https://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
annot_name
}
"
,
f
"
http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
annot_name
}
"
,
f
"
http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
annot_name
}
"
,
...
@@ -277,7 +267,7 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -277,7 +267,7 @@ class ReplayMobileBioDatabase(CSVDataset):
filename
=
annot_name
,
filename
=
annot_name
,
urls
=
annot_urls
,
urls
=
annot_urls
,
cache_subdir
=
"
annotations
"
,
cache_subdir
=
"
annotations
"
,
file_hash
=
"
9cd6e452
"
,
file_hash
=
annot_hash
,
)
)
logger
.
info
(
logger
.
info
(
...
@@ -299,7 +289,7 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -299,7 +289,7 @@ class ReplayMobileBioDatabase(CSVDataset):
annotation_extension
=
annotations_extension
,
annotation_extension
=
annotations_extension
,
),
),
),
),
fetch_probes
=
Fals
e
,
is_sparse
=
Tru
e
,
**
kwargs
,
**
kwargs
,
)
)
self
.
annotation_type
=
"
eyes-center
"
self
.
annotation_type
=
"
eyes-center
"
...
...
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