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
359cde0c
There was a problem fetching the pipeline summary.
Commit
359cde0c
authored
7 years ago
by
Olegs NIKISINS
Browse files
Options
Downloads
Patches
Plain Diff
Fixed no face detected issue in VideoFaceCrop
parent
436d474b
No related branches found
No related tags found
1 merge request
!21
Added a face detection functionality in the face cropping preprocessor
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/pad/face/preprocessor/VideoFaceCrop.py
+9
-1
9 additions, 1 deletion
bob/pad/face/preprocessor/VideoFaceCrop.py
bob/pad/face/utils/face_detection_utils.py
+6
-8
6 additions, 8 deletions
bob/pad/face/utils/face_detection_utils.py
with
15 additions
and
9 deletions
bob/pad/face/preprocessor/VideoFaceCrop.py
+
9
−
1
View file @
359cde0c
...
...
@@ -276,7 +276,15 @@ class VideoFaceCrop(Preprocessor, object):
if
self
.
detect_faces_flag
:
annotations
=
detect_faces_in_video
(
frames
)
annotations_detected
=
detect_faces_in_video
(
frames
)
if
not
annotations_detected
:
annotations
=
annotations
# if now annotations detected use DB annotations
else
:
annotations
=
annotations_detected
# if face was detected overwrite DB annotations
if
len
(
frames
)
!=
len
(
annotations
):
# if some annotations are missing
...
...
This diff is collapsed.
Click to expand it.
bob/pad/face/utils/face_detection_utils.py
+
6
−
8
View file @
359cde0c
...
...
@@ -25,19 +25,14 @@ def detect_face_in_image(image):
``annotations`` : :py:class:`dict`
A dictionary containing annotations of the face bounding box.
Dictionary must be as follows ``{
'
topleft
'
: (row, col),
'
bottomright
'
: (row, col)}``.
If no annotations found an empty dictionary is returned.
"""
data
=
bob
.
ip
.
dlib
.
FaceDetector
().
detect_single_face
(
image
)
annotations
=
{}
if
data
is
None
:
annotations
[
'
topleft
'
]
=
(
0
,
0
)
annotations
[
'
bottomright
'
]
=
(
0
,
0
)
else
:
if
data
is
not
None
:
bounding_box
=
data
[
0
]
...
...
@@ -65,6 +60,7 @@ def detect_faces_in_video(frame_container):
Dictionary structure: ``annotations = {
'
1
'
: frame1_dict,
'
2
'
: frame1_dict, ...}``.
Where ``frameN_dict = {
'
topleft
'
: (row, col),
'
bottomright
'
: (row, col)}``
is the dictionary defining the coordinates of the face bounding box in frame N.
If no annotations found an empty dictionary is returned.
"""
annotations
=
{}
...
...
@@ -75,7 +71,9 @@ def detect_faces_in_video(frame_container):
frame_annotations
=
detect_face_in_image
(
image
)
annotations
[
str
(
idx
)]
=
frame_annotations
if
frame_annotations
:
annotations
[
str
(
idx
)]
=
frame_annotations
return
annotations
...
...
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