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
f0c4dc7e
Commit
f0c4dc7e
authored
3 years ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
Simplify replay-mobile config, add urls in dataset
parent
9b1b0303
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!106
Vulnerability framework - CSV datasets
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/face/config/database/replaymobile.py
+7
-29
7 additions, 29 deletions
bob/bio/face/config/database/replaymobile.py
bob/bio/face/database/replaymobile.py
+36
-19
36 additions, 19 deletions
bob/bio/face/database/replaymobile.py
with
43 additions
and
48 deletions
bob/bio/face/config/database/replaymobile.py
+
7
−
29
View file @
f0c4dc7e
...
@@ -4,49 +4,27 @@
...
@@ -4,49 +4,27 @@
"""
Replay-mobile CSV database interface configuration
"""
Replay-mobile CSV database interface configuration
The Replay-Mobile Database for face spoofing consists of 1030 video clips of
The Replay-Mobile Database for face spoofing consists of video clips of
photo and video attack attempts to 40 clients, under different lighting
photo and video attack attempts under different lighting conditions.
conditions.
The vulnerability analysis pipeline uses single frames extracted from the
The vulnerability analysis pipeline uses single frames extracted from the
videos to be accepted by most face recognition systems.
videos to be accepted by most face recognition systems.
Feed this file to ``bob bio pipelines`` as configuration:
Feed this file (defined as resource: ``replaymobile-img``) to ``bob bio pipelines`` as
configuration:
$ bob bio pipelines
-v -m -c
replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
vanilla-biometrics -v --write-metadata-scores
replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
-v -m -c
my_config/protocol.py replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
vanilla-biometrics -v --write-metadata-scores
my_config/protocol.py replaymobile-img inception-resnetv2-msceleb
"""
"""
from
bob.bio.face.database.replaymobile
import
ReplayMobileBioDatabase
from
bob.bio.face.database.replaymobile
import
ReplayMobileBioDatabase
from
bob.core
import
log
from
bob.extension
import
rc
logger
=
log
.
setup
(
__name__
)
default_protocol
=
"
grandtest
"
default_protocol
=
"
grandtest
"
if
'
protocol
'
not
in
locals
():
if
'
protocol
'
not
in
locals
():
logger
.
info
(
f
"
protocol not specified, using default:
'
{
default_protocol
}
'"
)
protocol
=
default_protocol
protocol
=
default_protocol
dataset_protocol_path
=
rc
.
get
(
"
bob.db.replaymobile.dataset_protocol_path
"
,
None
)
logger
.
info
(
f
"
Loading protocol from
'
{
dataset_protocol_path
}
'"
)
data_path
=
rc
.
get
(
"
bob.db.replaymobile.directory
"
,
None
)
logger
.
info
(
f
"
Raw data files will be fetched from
'
{
data_path
}
'"
)
data_extension
=
rc
.
get
(
"
bob.db.replaymobile.extension
"
,
"
.mov
"
)
logger
.
info
(
f
"
Raw data files have the
'
{
data_extension
}
'
extension
"
)
annotations_path
=
rc
.
get
(
"
bob.db.replaymobile.annotation_path
"
,
None
)
logger
.
info
(
f
"
Annotations files will be fetched from
'
{
annotations_path
}
'"
)
logger
.
debug
(
f
"
Instantiation of ReplayMobile bio database with protocol
'
{
protocol
}
'"
)
database
=
ReplayMobileBioDatabase
(
database
=
ReplayMobileBioDatabase
(
protocol_definition_path
=
dataset_protocol_path
,
protocol
=
protocol
,
protocol_name
=
protocol
,
data_path
=
data_path
,
data_extension
=
data_extension
,
annotations_path
=
annotations_path
,
)
)
This diff is collapsed.
Click to expand it.
bob/bio/face/database/replaymobile.py
+
36
−
19
View file @
f0c4dc7e
...
@@ -204,12 +204,13 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -204,12 +204,13 @@ class ReplayMobileBioDatabase(CSVDataset):
----------
----------
protocol_name: str
protocol_name: str
The protocol to use
The protocol to use
. Must be a sub-folder of ``protocol_definition_path``
protocol_definition_path: str or None
protocol_definition_path: str or None
Specifies a path to download the database definition to.
Specifies a path where to fetch the database definition from.
If None: Downloads and uses the ``bob_data_folder`` config.
(See :py:func:`bob.extension.download.get_file`)
(See :py:func:`bob.extension.download.get_file`)
If None: Downloads the file in the path from ``bob_data_folder`` config.
If None and the config does not exist: Downloads the file in ``~/bob_data``.
data_path: str or None
data_path: str or None
Overrides the config-defined data location.
Overrides the config-defined data location.
...
@@ -217,14 +218,14 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -217,14 +218,14 @@ class ReplayMobileBioDatabase(CSVDataset):
If None and the config does not exist, set as cwd.
If None and the config does not exist, set as cwd.
annotation_path: str or None
annotation_path: str or None
Overrides the config-defined
annotation files locat
ion
.
Specifies a path where the
annotation files
are
locat
ed
.
If None:
uses the ``bob.db.replaymobile.annotation_directory`` config.
If None:
Downloads the files to the path poited by the
If None and the config does not exist, set as
``bob.db.replaymobile.annotation_directory`` config.
``{data_path}/faceloc/rect
``.
If None and the config does not exist: Downloads the file in ``~/bob_data
``.
"""
"""
def
__init__
(
def
__init__
(
self
,
self
,
protocol
_name
=
"
grandtest
"
,
protocol
=
"
grandtest
"
,
protocol_definition_path
=
None
,
protocol_definition_path
=
None
,
data_path
=
None
,
data_path
=
None
,
data_extension
=
"
.mov
"
,
data_extension
=
"
.mov
"
,
...
@@ -234,31 +235,47 @@ class ReplayMobileBioDatabase(CSVDataset):
...
@@ -234,31 +235,47 @@ 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
name
=
"
bio-face-replaymobile-img-3a584a97.tar.gz
"
urls
=
[
urls
=
[
"
https://www.idiap.ch/software/bob/data
bases/latest/replay-mobile-csv.tar.gz
"
,
f
"
https://www.idiap.ch/software/bob/data
/bob/bob.bio.face/
{
name
}
"
,
"
http://www.idiap.ch/software/bob/data
bases/latest/replay-mobile-csv.tar.gz
"
,
f
"
http://www.idiap.ch/software/bob/data
/bob/bob.bio.face/
{
name
}
"
,
]
]
protocol_definition_path
=
get_file
(
"
replay-mobile-csv.tar.gz
"
,
urls
)
protocol_definition_path
=
get_file
(
filename
=
name
,
urls
=
urls
,
cache_subdir
=
"
datasets
"
,
file_hash
=
"
3a584a97
"
)
if
data_path
is
None
:
if
data_path
is
None
:
# Defaults to cwd if config not defined
data_path
=
rc
.
get
(
"
bob.db.replaymobile.directory
"
,
""
)
data_path
=
rc
.
get
(
"
bob.db.replaymobile.directory
"
,
""
)
if
data_path
==
""
:
logger
.
warning
(
"
Raw data path is not configured. Please set
"
"'
bob.db.replaymobile.directory
'
with the
'
bob config set
'
command.
"
"
Will now attempt with current directory.
"
)
if
annotations_path
is
None
:
if
annotations_path
is
None
:
name
=
"
annotations-replaymobile-mtcnn-9cd6e452.tar.xz
"
name
=
"
annotations-replaymobile-mtcnn-9cd6e452.tar.xz
"
[
f
"
https://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
,
f
"
http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
,
]
annotations_path
=
get_file
(
annotations_path
=
get_file
(
name
,
filename
=
name
,
[
f
"
http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
]
,
urls
=
urls
,
cache_subdir
=
"
annotations
"
,
cache_subdir
=
"
annotations
"
,
file_hash
=
"
9cd6e452
"
,
file_hash
=
"
9cd6e452
"
,
)
)
logger
.
info
(
f
"
Database:
Loading database
definition
from
'
{
protocol_definition_path
}
'
.
"
)
logger
.
info
(
f
"
Database:
Will read CSV protocol
definition
s in
'
{
protocol_definition_path
}
'
.
"
)
logger
.
info
(
f
"
Database:
Defining
data files
path as
'
{
data_path
}
'
.
"
)
logger
.
info
(
f
"
Database:
Will read raw
data files
in
'
{
data_path
}
'
.
"
)
logger
.
info
(
f
"
Database:
Defining
annotation files
path as
'
{
annotations_path
}
'
.
"
)
logger
.
info
(
f
"
Database:
Will read
annotation files
in
'
{
annotations_path
}
'
.
"
)
super
().
__init__
(
super
().
__init__
(
protocol_definition_path
,
name
=
"
replaymobile-img
"
,
protocol_name
,
protocol
=
protocol
,
dataset_protocol_path
=
protocol_definition_path
,
csv_to_sample_loader
=
make_pipeline
(
csv_to_sample_loader
=
make_pipeline
(
ReplayMobileCSVFrameSampleLoader
(
ReplayMobileCSVFrameSampleLoader
(
dataset_original_directory
=
data_path
,
dataset_original_directory
=
data_path
,
...
...
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