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
006b0c9e
Commit
006b0c9e
authored
5 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
[maskattack] Add original directory and extension to file attributes
parent
3db8b6ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!104
Improve high level database interfaces
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/face/database/maskattack.py
+18
-14
18 additions, 14 deletions
bob/pad/face/database/maskattack.py
with
18 additions
and
14 deletions
bob/pad/face/database/maskattack.py
+
18
−
14
View file @
006b0c9e
...
...
@@ -5,7 +5,7 @@ import os
import
numpy
as
np
import
bob.io.video
from
bob.bio.video
import
FrameSelector
,
FrameContainer
from
bob.pad.face.database
import
VideoPadFile
from
bob.pad.face.database
import
VideoPadFile
from
bob.pad.base.database
import
PadDatabase
class
MaskAttackPadFile
(
VideoPadFile
):
...
...
@@ -17,18 +17,18 @@ class MaskAttackPadFile(VideoPadFile):
f : :py:class:`object`
An instance of the File class defined in the low level db interface
of the 3DMAD database, in the bob.db.maskattack.models.py file.
"""
def
__init__
(
self
,
f
):
"""
Init function
Parameters
----------
f : :py:class:`object`
An instance of the File class defined in the low level db interface
of the 3DMAD database, in the bob.db.maskattack.models.py file.
"""
self
.
f
=
f
if
f
.
is_real
():
...
...
@@ -48,10 +48,10 @@ class MaskAttackPadFile(VideoPadFile):
Parameters
----------
directory : :py:class:`str`
String containing the path to the 3DMAD database
String containing the path to the 3DMAD database
(generated sequences from original data).
extension : :py:class:`str`
Extension of the video files
Extension of the video files
frame_selector : :py:class:`bob.bio.video.FrameSelector`
The frame selector to use.
...
...
@@ -59,7 +59,7 @@ class MaskAttackPadFile(VideoPadFile):
-------
video_data : :py:class:`bob.bio.video.utils.FrameContainer`
video data stored in a FrameContainer
"""
vfilename
=
self
.
make_path
(
directory
,
extension
)
video
=
bob
.
io
.
video
.
reader
(
vfilename
)
...
...
@@ -69,7 +69,7 @@ class MaskAttackPadFile(VideoPadFile):
class
MaskAttackPadDatabase
(
PadDatabase
):
"""
High level implementation of the Database class for the 3DMAD database.
Attributes
----------
db : :py:class:`bob.db.maskattack.Database`
...
...
@@ -92,12 +92,12 @@ class MaskAttackPadDatabase(PadDatabase):
The directory where the original data of the database are stored.
original_extension : :py:class:`str`
The file name extension of the original data.
"""
from
bob.db.maskattack
import
Database
as
LowLevelDatabase
self
.
db
=
LowLevelDatabase
()
self
.
low_level_group_names
=
(
'
world
'
,
'
dev
'
,
'
test
'
)
self
.
low_level_group_names
=
(
'
world
'
,
'
dev
'
,
'
test
'
)
self
.
high_level_group_names
=
(
'
train
'
,
'
dev
'
,
'
eval
'
)
super
(
MaskAttackPadDatabase
,
self
).
__init__
(
...
...
@@ -147,13 +147,13 @@ class MaskAttackPadDatabase(PadDatabase):
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
'
world
'
in
groups
and
purposes
==
'
real
'
:
lowlevel_purposes
.
append
(
'
trainReal
'
)
lowlevel_purposes
.
append
(
'
trainReal
'
)
if
'
world
'
in
groups
and
purposes
==
'
attack
'
:
lowlevel_purposes
.
append
(
'
trainMask
'
)
lowlevel_purposes
.
append
(
'
trainMask
'
)
# for dev and eval
if
(
'
dev
'
in
groups
or
'
test
'
in
groups
)
and
purposes
==
'
real
'
:
...
...
@@ -163,10 +163,14 @@ class MaskAttackPadDatabase(PadDatabase):
files
=
self
.
db
.
objects
(
sets
=
groups
,
purposes
=
lowlevel_purposes
,
**
kwargs
)
files
=
[
MaskAttackPadFile
(
f
)
for
f
in
files
]
# set the attributes
for
f
in
files
:
f
.
original_directory
=
self
.
original_directory
f
.
original_extension
=
self
.
original_extension
return
files
def
annotations
(
self
,
file
):
"""
Return annotations for a given file object.
...
...
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