Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.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.bio.face
Commits
6cad6f98
Commit
6cad6f98
authored
3 years ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
Read the should_flip metadata from the csv file
parent
4ea5b95e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!106
Vulnerability framework - CSV datasets
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/database/replaymobile.py
+5
-3
5 additions, 3 deletions
bob/bio/face/database/replaymobile.py
with
5 additions
and
3 deletions
bob/bio/face/database/replaymobile.py
+
5
−
3
View file @
6cad6f98
...
@@ -17,7 +17,7 @@ import numpy
...
@@ -17,7 +17,7 @@ import numpy
logger
=
bob
.
core
.
log
.
setup
(
"
bob.bio.face
"
)
logger
=
bob
.
core
.
log
.
setup
(
"
bob.bio.face
"
)
def
load_frame_from_file_replaymobile
(
file_name
,
frame
,
capturing_device
):
def
load_frame_from_file_replaymobile
(
file_name
,
frame
,
should_flip
):
"""
Loads a single frame from a video file for replay-mobile.
"""
Loads a single frame from a video file for replay-mobile.
This function uses bob
'
s video reader utility that does not load the full
This function uses bob
'
s video reader utility that does not load the full
...
@@ -48,7 +48,7 @@ def load_frame_from_file_replaymobile(file_name, frame, capturing_device):
...
@@ -48,7 +48,7 @@ def load_frame_from_file_replaymobile(file_name, frame, capturing_device):
# Image captured by the 'mobile' device are flipped vertically.
# Image captured by the 'mobile' device are flipped vertically.
# (Images were captured horizontally and bob.io.video does not read the
# (Images were captured horizontally and bob.io.video does not read the
# metadata correctly, whether it was on the right or left side)
# metadata correctly, whether it was on the right or left side)
if
capturing_device
==
"
mobile
"
:
if
should_flip
:
image
=
numpy
.
flip
(
image
,
2
)
image
=
numpy
.
flip
(
image
,
2
)
# Convert to bob format (channel, height, width)
# Convert to bob format (channel, height, width)
image
=
numpy
.
transpose
(
image
,
(
0
,
2
,
1
))
image
=
numpy
.
transpose
(
image
,
(
0
,
2
,
1
))
...
@@ -135,13 +135,15 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
...
@@ -135,13 +135,15 @@ class ReplayMobileCSVFrameSampleLoader(CSVToSampleLoaderBiometrics):
else
:
else
:
if
"
subject_id
"
not
in
kwargs
:
if
"
subject_id
"
not
in
kwargs
:
raise
ValueError
(
f
"
`subject_id` not available in
{
header
}
"
)
raise
ValueError
(
f
"
`subject_id` not available in
{
header
}
"
)
if
"
should_flip
"
not
in
kwargs
:
raise
ValueError
(
f
"
`should_flip` not available in
{
header
}
"
)
# One row leads to multiple samples (different frames)
# One row leads to multiple samples (different frames)
all_samples
=
[
DelayedSample
(
all_samples
=
[
DelayedSample
(
functools
.
partial
(
functools
.
partial
(
load_frame_from_file_replaymobile
,
load_frame_from_file_replaymobile
,
file_name
=
os
.
path
.
join
(
self
.
dataset_original_directory
,
path
+
self
.
extension
),
file_name
=
os
.
path
.
join
(
self
.
dataset_original_directory
,
path
+
self
.
extension
),
frame
=
frame
,
frame
=
frame
,
capturing_device
=
kwargs
[
"
capturing_device
"
]
,
should_flip
=
kwargs
[
"
should_flip
"
]
==
"
TRUE
"
,
),
),
key
=
f
"
{
id
}
_
{
frame
}
"
,
key
=
f
"
{
id
}
_
{
frame
}
"
,
path
=
path
,
path
=
path
,
...
...
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