Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.db.hci_tagging
Commits
f0e6feee
Commit
f0e6feee
authored
Oct 21, 2015
by
André Anjos
💬
Browse files
[driver] Re-generate all bounding-boxes for all videos as part of the metadata to keep
parent
40774806
Changes
3
Hide whitespace changes
Inline
Side-by-side
bob/db/hci_tagging/driver.py
View file @
f0e6feee
...
...
@@ -80,20 +80,15 @@ def create_meta(args):
continue
try
:
print
"Creating meta data for `%s'..."
%
obj
.
make_path
()
bb
=
obj
.
run_face_detector
(
args
.
directory
,
max_frames
=
1
)[
0
]
bb
=
obj
.
run_face_detector
(
args
.
directory
)
hr
=
obj
.
estimate_heartrate_in_bpm
(
args
.
directory
)
if
bb
and
hr
:
outdir
=
os
.
path
.
dirname
(
output
)
if
not
os
.
path
.
exists
(
outdir
):
os
.
makedirs
(
outdir
)
h5
=
bob
.
io
.
base
.
HDF5File
(
output
,
'w'
)
h5
.
create_group
(
'face_detector'
)
h5
.
cd
(
'face_detector'
)
h5
.
set
(
'topleft_x'
,
bb
.
topleft
.
x
)
h5
.
set
(
'topleft_y'
,
bb
.
topleft
.
y
)
h5
.
set
(
'width'
,
bb
.
size
.
x
)
h5
.
set
(
'height'
,
bb
.
size
.
y
)
h5
.
set_attribute
(
'quality'
,
bb
.
quality
)
h5
.
cd
(
'..'
)
bb_save
=
[(
bb
[
k
].
topleft
.
y
,
bb
[
k
].
topleft
.
x
,
bb
[
k
].
size
.
y
,
bb
[
k
].
size
.
x
)
for
k
in
sorted
(
bb
.
keys
())]
h5
.
set
(
'face_detector'
,
numpy
.
array
(
bb_save
))
h5
.
set_attribute
(
'quality'
,
numpy
.
array
([
bb
[
k
].
quality
for
k
in
sorted
(
bb
.
keys
())]),
'/face_detector'
)
h5
.
set
(
'heartrate'
,
hr
)
h5
.
set_attribute
(
'units'
,
'beats-per-minute'
,
'heartrate'
)
h5
.
close
()
...
...
bob/db/hci_tagging/models.py
View file @
f0e6feee
...
...
@@ -114,8 +114,8 @@ class File(object):
return
detections
def
load_face_detection
(
self
):
"""Loads the face detection from locally stored files if they exist, fails
def
load_face_detection
s
(
self
):
"""Loads the face detection
s
from locally stored files if they exist, fails
gracefully otherwise, returning `None`"""
data_dir
=
pkg_resources
.
resource_filename
(
__name__
,
'data'
)
...
...
@@ -123,12 +123,9 @@ class File(object):
if
os
.
path
.
exists
(
path
):
f
=
bob
.
io
.
base
.
HDF5File
(
path
)
f
.
cd
(
'face_detector'
)
return
BoundingBox
(
Point
(
f
.
get
(
'topleft_y'
),
f
.
get
(
'topleft_x'
)),
Point
(
f
.
get
(
'height'
),
f
.
get
(
'width'
)),
f
.
get_attribute
(
'quality'
),
)
bb
=
f
.
get
(
'face_detector'
)
qu
=
f
.
get_attribute
(
'quality'
,
'/face_detector'
)
return
[
BoundingBox
(
Point
(
k
[
0
],
k
[
1
]),
Point
(
k
[
2
],
k
[
3
]),
q
)
for
k
,
q
in
zip
(
bb
,
qu
)]
return
None
...
...
bob/db/hci_tagging/test.py
View file @
f0e6feee
...
...
@@ -95,8 +95,8 @@ class HCITaggingTest(unittest.TestCase):
for
obj
in
self
.
db
.
objects
()[:
3
]:
detection
=
obj
.
load_face_detection
()
assert
detection
detection
s
=
obj
.
load_face_detection
s
()
assert
detection
s
hr
=
obj
.
load_heart_rate_in_bpm
()
assert
hr
...
...
André Anjos
💬
@andre.anjos
mentioned in commit
c4b4f171
·
Oct 22, 2015
mentioned in commit
c4b4f171
mentioned in commit c4b4f171f3b766a521c43ec3043ea7fabb34581a
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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