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
Merge requests
!56
Removed unused class VideoDataLoader, closes
#20
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Removed unused class VideoDataLoader, closes
#20
fix_issue_20
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Olegs NIKISINS
requested to merge
fix_issue_20
into
master
7 years ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
Closes
#20 (closed)
0
0
Merge request reports
Viewing commit
50bd1562
Show latest version
2 files
+
0
−
117
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
50bd1562
Removed unused class VideoDataLoader, closes
#20
· 50bd1562
Olegs NIKISINS
authored
7 years ago
bob/pad/face/extractor/VideoDataLoader.py deleted
100644 → 0
+
0
−
115
Options
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 1 13:55:02 2017
@author: Olegs Nikisins
"""
#==============================================================================
# Import what is needed here:
import
os
import
bob.bio.video
#==============================================================================
# Main body of the class
class
VideoDataLoader
(
object
):
"""
This class is designed to load video data given name of the file.
The class is called by corresponding extractors in the experiments using
emty(!) preprocessor. In this scenario the video data is loaded directly
from the database, avoiding duplicate storage of non-processed data in the
experimental directory.
NOTE:
To use this class in PAD experiments the command line argument
``--preprocessed-directory`` must point to the original database directory.
For example:
--preprocessed-directory <DIRECTORY_CONTAINING_REPLAY_ATTACK_DATABASE>
At this point the class is just a collection of methods.
"""
#==========================================================================
def
get_complete_filename
(
self
,
filename
):
"""
Get a complete filename given a filename without an extension.
**Parameters:**
``filename`` : :py:class:`str`
A name of the file containing the path, but no extension.
**Returns:**
``filename_complete`` : :py:class:`str`
A complete filename, incliding extension.
"""
path
,
filename_no_ext
=
os
.
path
.
split
(
filename
)
filenames
=
[]
extensions
=
[]
for
f
in
os
.
listdir
(
path
):
filenames
.
append
(
os
.
path
.
splitext
(
f
)[
0
])
extensions
.
append
(
os
.
path
.
splitext
(
f
)[
1
])
idx
=
filenames
.
index
(
filename_no_ext
)
# index of the file
file_extension
=
extensions
[
idx
]
# get extension of the file
filename_complete
=
os
.
path
.
join
(
path
,
filename_no_ext
+
file_extension
)
return
filename_complete
#==========================================================================
def
load_video_data
(
self
,
filename_complete
):
"""
Load video data given a complete filename.
**Parameters:**
``filename_complete`` : :py:class:`str`
A complete filename, incliding extension.
**Returns:**
``video_data`` : FrameContainer
A FrameContainer containing the loaded video data.
"""
frame_selector
=
bob
.
bio
.
video
.
FrameSelector
(
selection_style
=
'
all
'
)
# select all frames from the video file
video_data
=
frame_selector
(
filename_complete
)
# video data
return
video_data
#==========================================================================
def
__call__
(
self
,
filename
):
"""
Load video data given a filename without an extension.
**Parameters:**
``filename`` : :py:class:`str`
A name of the file containing the path, but no extension.
**Returns:**
``video_data`` : FrameContainer
A FrameContainer containing the loaded video data.
"""
filename_complete
=
self
.
get_complete_filename
(
filename
)
video_data
=
self
.
load_video_data
(
filename_complete
)
return
video_data
Loading