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
c566bd39
Commit
c566bd39
authored
6 years ago
by
Olegs NIKISINS
Browse files
Options
Downloads
Patches
Plain Diff
Added a unit test for BW-NIR-D preprocessor instance
parent
ee53d54a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!84
Multi-channel data preprocessing
Pipeline
#26288
passed
6 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/pad/face/preprocessor/VideoFaceCropAlignBlockPatch.py
+2
-0
2 additions, 0 deletions
bob/pad/face/preprocessor/VideoFaceCropAlignBlockPatch.py
bob/pad/face/test/test.py
+38
-0
38 additions, 0 deletions
bob/pad/face/test/test.py
with
40 additions
and
0 deletions
bob/pad/face/preprocessor/VideoFaceCropAlignBlockPatch.py
+
2
−
0
View file @
c566bd39
...
@@ -240,6 +240,8 @@ class VideoFaceCropAlignBlockPatch(Preprocessor, object):
...
@@ -240,6 +240,8 @@ class VideoFaceCropAlignBlockPatch(Preprocessor, object):
facial region. ROI is annotated as follows:
facial region. ROI is annotated as follows:
``annotations[
'
face_roi
'
][0] = [x_top_left, y_top_left]``
``annotations[
'
face_roi
'
][0] = [x_top_left, y_top_left]``
``annotations[
'
face_roi
'
][1] = [x_bottom_right, y_bottom_right]``
``annotations[
'
face_roi
'
][1] = [x_bottom_right, y_bottom_right]``
If ``face_roi`` annotations are undefined, the patches will be
extracted from an entire cropped facial image.
**Returns:**
**Returns:**
...
...
This diff is collapsed.
Click to expand it.
bob/pad/face/test/test.py
+
38
−
0
View file @
c566bd39
...
@@ -52,6 +52,8 @@ from bob.pad.face.config.preprocessor.face_feature_crop_quality_check import fac
...
@@ -52,6 +52,8 @@ from bob.pad.face.config.preprocessor.face_feature_crop_quality_check import fac
from
bob.pad.face.utils.patch_utils
import
reshape_flat_patches
from
bob.pad.face.utils.patch_utils
import
reshape_flat_patches
from
bob.pad.face.config.preprocessor.video_face_crop_align_block_patch
import
video_face_crop_align_bw_ir_d_channels_3x128x128
as
mc_preprocessor
def
test_detect_face_landmarks_in_image_mtcnn
():
def
test_detect_face_landmarks_in_image_mtcnn
():
...
@@ -335,6 +337,42 @@ def test_preproc_with_quality_check():
...
@@ -335,6 +337,42 @@ def test_preproc_with_quality_check():
assert
data_preprocessed
is
None
assert
data_preprocessed
is
None
# =============================================================================
def
test_multi_channel_preprocessing
():
"""
Test video_face_crop_align_bw_ir_d_channels_3x128x128 preprocessor.
"""
# =========================================================================
# prepare the test data:
image
=
load
(
datafile
(
'
test_image.png
'
,
'
bob.pad.face.test
'
))
# annotations must be known for this preprocessor, so compute them:
annotations
=
detect_face_landmarks_in_image
(
image
,
method
=
"
mtcnn
"
)
video_color
,
annotations
=
convert_image_to_video_data
(
image
,
annotations
,
2
)
video_bw
,
_
=
convert_image_to_video_data
(
image
[
0
],
annotations
,
2
)
mc_video
=
{}
mc_video
[
"
color
"
]
=
video_color
mc_video
[
"
infrared
"
]
=
video_bw
mc_video
[
"
depth
"
]
=
video_bw
# =========================================================================
# test the preprocessor:
data_preprocessed
=
mc_preprocessor
(
mc_video
,
annotations
)
assert
len
(
data_preprocessed
)
==
2
assert
data_preprocessed
[
0
][
1
].
shape
==
(
3
,
128
,
128
)
# chanenls are preprocessed differently, thus this should apply:
assert
np
.
any
(
data_preprocessed
[
0
][
1
][
0
]
!=
data_preprocessed
[
0
][
1
][
1
])
assert
np
.
any
(
data_preprocessed
[
0
][
1
][
0
]
!=
data_preprocessed
[
0
][
1
][
2
])
# =============================================================================
# =============================================================================
def
test_reshape_flat_patches
():
def
test_reshape_flat_patches
():
"""
"""
...
...
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