Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.video
Commits
2d2ebde7
Commit
2d2ebde7
authored
Jan 25, 2018
by
Amir MOHAMMADI
Browse files
use ordered dict
parent
49750045
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/video/annotator/Wrapper.py
View file @
2d2ebde7
from
collections
import
OrderedDict
from
bob.bio.face.annotator
import
Base
from
bob.ip.facedetect
import
bounding_box_from_annotation
from
bob.bio.base
import
load_resource
...
...
@@ -35,7 +36,7 @@ def normalize_annotations(annotations, validator, max_age=-1):
age
=
0
for
k
,
annot
in
annotations
.
items
():
if
validator
(
annot
):
if
annot
and
validator
(
annot
):
current
=
annot
age
=
0
elif
max_age
<
0
or
age
<
max_age
:
...
...
@@ -61,7 +62,7 @@ def min_face_size_validator(annotations, min_face_size=32):
bool
True, if the face is large enough.
"""
bbx
=
bounding_box_from_annotation
(
**
annotations
)
bbx
=
bounding_box_from_annotation
(
source
=
'direct'
,
**
annotations
)
if
bbx
.
size
<
32
:
return
False
return
True
...
...
@@ -103,10 +104,10 @@ class Wrapper(Base):
def
annotate
(
self
,
frames
,
**
kwargs
):
if
isinstance
(
frames
,
utils
.
FrameContainer
):
frames
=
frames
.
as_array
()
annotations
=
{}
annotations
=
OrderedDict
()
for
i
,
frame
in
enumerate
(
frames
):
annotations
[
str
(
i
)]
=
self
.
annotator
(
frame
,
**
kwargs
)
if
self
.
normalize
:
annotations
=
d
ict
(
normalize_annotations
(
annotations
=
OrderedD
ict
(
normalize_annotations
(
annotations
,
self
.
validator
,
self
.
max_age
))
return
annotations
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment