Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.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.pad.face
Commits
c4a54c20
Commit
c4a54c20
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
casiasurf high-level DB first attempt
parent
9ee22572
Loading
Loading
1 merge request
!77
CASIA-SURF database
Pipeline
#25934
passed
6 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/face/database/casiasurf.py
+97
-0
97 additions, 0 deletions
bob/pad/face/database/casiasurf.py
with
97 additions
and
0 deletions
bob/pad/face/database/casiasurf.py
+
97
−
0
View file @
c4a54c20
...
...
@@ -74,3 +74,100 @@ class CasiaSurfPadFile(VideoPadFile):
data_to_return
[
k
]
=
frame_container
return
data_to_return
class
CasiaSurfPadDatabase
(
PadDatabase
):
"""
High level implementation of the Database class for the 3DMAD database.
Note that at the moment, this database only contains a training and validation set.
The protocol specifies the modality(ies) to load.
Attributes
----------
db : :py:class:`bob.db.casiasurf.Database`
the low-level database interface
low_level_group_names : list of :py:obj:`str`
the group names in the low-level interface (world, dev, test)
high_level_group_names : list of :py:obj:`str`
the group names in the high-level interface (train, dev, eval)
"""
from
bob.db.casiasurf
import
Database
as
LowLevelDatabase
self
.
db
=
LowLevelDatabase
()
self
.
low_level_group_names
=
(
'
train
'
,
'
validation
'
,
'
test
'
)
self
.
high_level_group_names
=
(
'
train
'
,
'
dev
'
,
'
eval
'
)
super
(
CasiaSurfPadDatabase
,
self
).
__init__
(
name
=
'
casiasurf
'
,
protocol
=
protocol
,
original_directory
=
original_directory
,
original_extension
=
original_extension
,
**
kwargs
)
@property
def
original_directory
(
self
):
return
self
.
db
.
original_directory
@original_directory.setter
def
original_directory
(
self
,
value
):
self
.
db
.
original_directory
=
value
def
objects
(
self
,
groups
=
None
,
protocol
=
'
all
'
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
"""
Returns a list of CasiaSurfPadFile objects, which fulfill the given restrictions.
Parameters
----------
groups : list of :py:class:`str`
The groups of which the clients should be returned.
Usually, groups are one or more elements of (
'
train
'
,
'
dev
'
,
'
eval
'
)
protocol : :py:class:`str`
The protocol for which the samples should be retrieved.
purposes : :py:class:`str`
The purposes for which Sample objects should be retrieved.
Usually it is either
'
real
'
or
'
attack
'
, but could be
'
unknown
'
as well
model_ids
This parameter is not supported in PAD databases yet.
Returns
-------
samples : :py:class:`CasiaSurfPadFilePadFile`
A list of CasiaSurfPadFile objects.
"""
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
if
groups
is
not
None
:
# for training
lowlevel_purposes
=
[]
if
'
train
'
in
groups
and
purposes
==
'
real
'
:
lowlevel_purposes
.
append
(
'
real
'
)
if
'
train
'
in
groups
and
purposes
==
'
attack
'
:
lowlevel_purposes
.
append
(
'
attack
'
)
# for dev and eval
if
(
'
dev
'
in
groups
or
'
test
'
in
groups
)
and
purposes
==
'
real
'
:
lowlevel_purposes
.
append
(
'
unknown
'
)
if
(
'
dev
'
in
groups
or
'
test
'
in
groups
)
and
purposes
==
'
attack
'
:
lowlevel_purposes
.
append
(
'
unknown
'
)
samples
=
self
.
db
.
objects
(
sets
=
groups
,
purposes
=
lowlevel_purposes
,
**
kwargs
)
samples
=
[
CasiaSurfPadFile
(
s
)
for
s
in
samples
]
return
samples
def
annotations
(
self
,
file
):
"""
No annotations are provided with this DB
"""
return
None
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