Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.pad.face
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.pad.face
Commits
5aeab6ee
Commit
5aeab6ee
authored
Nov 23, 2017
by
Amir MOHAMMADI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept frame_selector in load methods
parent
056bb2bb
Pipeline
#14268
passed with stages
in 13 minutes and 1 second
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
81 deletions
+15
-81
bob/pad/face/database/aggregated_db.py
bob/pad/face/database/aggregated_db.py
+1
-1
bob/pad/face/database/mifs.py
bob/pad/face/database/mifs.py
+3
-5
bob/pad/face/database/msu_mfsd.py
bob/pad/face/database/msu_mfsd.py
+4
-35
bob/pad/face/database/replay.py
bob/pad/face/database/replay.py
+3
-6
bob/pad/face/database/replay_mobile.py
bob/pad/face/database/replay_mobile.py
+4
-34
No files found.
bob/pad/face/database/aggregated_db.py
View file @
5aeab6ee
...
...
@@ -15,7 +15,7 @@ from bob.pad.face.database import msu_mfsd as msu_mfsd_hldi
from
bob.bio.video.database.mobio
import
MobioBioFile
from
bob.bio.video
import
FrameSelector
from
bob.bio.video
import
FrameSelector
,
FrameContainer
import
numpy
as
np
...
...
bob/pad/face/database/mifs.py
View file @
5aeab6ee
...
...
@@ -5,7 +5,8 @@
#==============================================================================
import
bob.bio.video
# Used in MIFSPadFile class
# Used in ReplayMobilePadFile class
from
bob.bio.video
import
FrameSelector
,
FrameContainer
import
bob.io.base
import
numpy
as
np
...
...
@@ -26,7 +27,7 @@ class MIFSPadFile(PadFile):
file_id
)
#==========================================================================
def
load
(
self
,
directory
=
None
,
extension
=
None
):
def
load
(
self
,
directory
=
None
,
extension
=
None
,
frame_selector
=
FrameSelector
(
selection_style
=
'all'
)
):
"""
Overridden version of the load method defined in the ``PadFile``.
...
...
@@ -49,9 +50,6 @@ class MIFSPadFile(PadFile):
path
=
self
.
make_path
(
directory
=
directory
,
extension
=
extension
)
# path to the file
frame_selector
=
bob
.
bio
.
video
.
FrameSelector
(
selection_style
=
'all'
)
# this frame_selector will select all frames from the video file
data
=
bob
.
io
.
base
.
load
(
path
)
data
=
np
.
expand_dims
(
data
,
axis
=
0
)
# upgrade to 4D (video)
...
...
bob/pad/face/database/msu_mfsd.py
View file @
5aeab6ee
...
...
@@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
#==============================================================================
import
bob.bio.video
# Used in MsuMfsdPadFile class
# Used in ReplayMobilePadFile class
from
bob.bio.video
import
FrameSelector
,
FrameContainer
from
bob.pad.base.database
import
PadFile
# Used in MsuMfsdPadFile class
...
...
@@ -50,35 +51,7 @@ class MsuMfsdPadFile(PadFile):
file_id
=
f
.
id
)
#==========================================================================
def
convert_arr_to_frame_cont
(
self
,
data
):
"""
This function converts an input 4D array with frames into FrameContainer,
where each frame is an RGB image. The dimensionality of the input array
is [N_frames, 3, N_rows, N_cols].
**Parameters:**
``data`` : 4D :py:class:`numpy.ndarray`
An input 4D array with frames of the dimensionality:
[N_frames, 3, N_rows, N_cols].
**Returns:**
``frames`` : FrameContainer
Resulting FrameContainer containing RGB frames.
"""
frames
=
bob
.
bio
.
video
.
FrameContainer
(
)
# initialize the FrameContainer
for
idx
,
sample
in
enumerate
(
data
):
frames
.
add
(
idx
,
sample
)
return
frames
#==========================================================================
def
load
(
self
,
directory
=
None
,
extension
=
None
):
def
load
(
self
,
directory
=
None
,
extension
=
None
,
frame_selector
=
FrameSelector
(
selection_style
=
'all'
)):
"""
Overridden version of the load method defined in the ``PadFile``.
...
...
@@ -105,11 +78,7 @@ class MsuMfsdPadFile(PadFile):
video_data_array
=
self
.
f
.
load
(
directory
=
directory
,
extension
=
extension
)
video_data
=
self
.
convert_arr_to_frame_cont
(
video_data_array
)
# the result is now a FrameContainer
return
video_data
return
frame_selector
(
video_data_array
)
#==============================================================================
...
...
bob/pad/face/database/replay.py
View file @
5aeab6ee
...
...
@@ -3,7 +3,8 @@
#==============================================================================
import
bob.bio.video
# Used in ReplayPadFile class
# Used in ReplayMobilePadFile class
from
bob.bio.video
import
FrameSelector
,
FrameContainer
from
bob.pad.base.database
import
PadFile
# Used in ReplayPadFile class
...
...
@@ -48,7 +49,7 @@ class ReplayPadFile(PadFile):
file_id
=
f
.
id
)
#==========================================================================
def
load
(
self
,
directory
=
None
,
extension
=
'.mov'
):
def
load
(
self
,
directory
=
None
,
extension
=
'.mov'
,
frame_selector
=
FrameSelector
(
selection_style
=
'all'
)
):
"""
Overridden version of the load method defined in the ``PadFile``.
...
...
@@ -70,10 +71,6 @@ class ReplayPadFile(PadFile):
path
=
self
.
f
.
make_path
(
directory
=
directory
,
extension
=
extension
)
# path to the video file
frame_selector
=
bob
.
bio
.
video
.
FrameSelector
(
selection_style
=
'all'
)
# this frame_selector will select all frames from the video file
video_data
=
frame_selector
(
path
)
# video data
return
video_data
# video data
...
...
bob/pad/face/database/replay_mobile.py
View file @
5aeab6ee
...
...
@@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
#==============================================================================
import
bob.bio.video
# Used in ReplayMobilePadFile class
# Used in ReplayMobilePadFile class
from
bob.bio.video
import
FrameSelector
,
FrameContainer
from
bob.pad.base.database
import
PadFile
# Used in ReplayMobilePadFile class
...
...
@@ -46,35 +47,7 @@ class ReplayMobilePadFile(PadFile):
file_id
=
f
.
id
)
#==========================================================================
def
convert_arr_to_frame_cont
(
self
,
data
):
"""
This function converts an input 4D array with frames into FrameContainer,
where each frame is an RGB image. The dimensionality of the input array
is [N_frames, 3, N_rows, N_cols].
**Parameters:**
``data`` : 4D :py:class:`numpy.ndarray`
An input 4D array with frames of the dimensionality:
[N_frames, 3, N_rows, N_cols].
**Returns:**
``frames`` : FrameContainer
Resulting FrameContainer containing RGB frames.
"""
frames
=
bob
.
bio
.
video
.
FrameContainer
(
)
# initialize the FrameContainer
for
idx
,
sample
in
enumerate
(
data
):
frames
.
add
(
idx
,
sample
)
return
frames
#==========================================================================
def
load
(
self
,
directory
=
None
,
extension
=
'.mov'
):
def
load
(
self
,
directory
=
None
,
extension
=
'.mov'
,
frame_selector
=
FrameSelector
(
selection_style
=
'all'
)):
"""
Overridden version of the load method defined in the ``PadFile``.
...
...
@@ -96,10 +69,7 @@ class ReplayMobilePadFile(PadFile):
video_data_array
=
self
.
f
.
load
(
directory
=
directory
,
extension
=
extension
)
video_data
=
self
.
convert_arr_to_frame_cont
(
video_data_array
)
# the result is now a FrameContainer
return
video_data
return
frame_selector
(
video_data_array
)
#==============================================================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment