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
9ee22572
Commit
9ee22572
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
started high-level implementation for CASIA-SURF DB
parent
08484e67
No related branches found
No related tags found
1 merge request
!77
CASIA-SURF database
Pipeline
#25932
canceled
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
+76
-0
76 additions, 0 deletions
bob/pad/face/database/casiasurf.py
with
76 additions
and
0 deletions
bob/pad/face/database/casiasurf.py
0 → 100644
+
76
−
0
View file @
9ee22572
#!/usr/bin/env python
# -*- coding: utf-8 -*-
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.base.database
import
PadDatabase
class
CasiaSurfPadFile
(
VideoPadFile
):
"""
A high level implementation of the File class for the CASIA-SURF database.
Note that this does not represent a file per se, but rather a sample
that may contain more than one file.
Attributes
----------
f : :py:class:`object`
An instance of the Sample class defined in the low level db interface
of the CASIA-SURF database, in the bob.db.casiasurf.models.py file.
"""
def
__init__
(
self
,
f
,
stream_type
):
"""
Init
Parameters
----------
f : :py:class:`object`
An instance of the Sample class defined in the low level db interface
of the CASIA-SURF database, in the bob.db.casiasurf.models.py file.
stream_type: str of list of str
The streams to be loaded.
"""
self
.
f
=
f
self
.
stream_type
=
stream_type
super
(
CasiaSurfPadFile
,
self
).
__init__
(
client_id
=
f
.
id
,
attack_type
=
attack_type
)
def
load
(
self
,
directory
=
None
,
extension
=
'
.jpg
'
,
frame_selector
=
FrameSelector
(
selection_style
=
'
all
'
)):
"""
Overridden version of the load method defined in ``VideoPadFile``.
Parameters
----------
directory : :py:class:`str`
String containing the path to the CASIA-SURF database
extension : :py:class:`str`
Extension of the image files
frame_selector : :py:class:`bob.bio.video.FrameSelector`
The frame selector to use.
Returns
-------
dict:
"
video
"
data (i.e. one frame) for multiple streams stored in the dictionary.
The structure of the dictionary: ``data={
"
stream1_name
"
: FrameContainer1,
"
stream2_name
"
: ...}``
Names of the streams are defined in ``self.stream_type``.
"""
# get the dict of numpy array
data
=
self
.
f
.
load
(
directory
,
extension
,
modality
=
self
.
modality
)
# convert that to dict of FrameContainer
data_to_return
=
{}
for
k
in
data
.
keys
():
frame_container
=
FrameContainer
()
for
idx
,
item
in
enumerate
(
data
[
k
]):
frame_container
.
add
(
idx
,
item
)
# add frame to FrameContainer
data_to_return
[
k
]
=
frame_container
return
data_to_return
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