Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.replay
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
Model registry
Operate
Environments
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.db.replay
Commits
3ccccc84
Commit
3ccccc84
authored
12 years ago
by
Ivana CHINGOVSKA
Browse files
Options
Downloads
Patches
Plain Diff
methods for querying the face location files
parent
2e5bdc4c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
xbob/db/replay/query.py
+47
-0
47 additions, 0 deletions
xbob/db/replay/query.py
xbob/db/replay/test.py
+9
-0
9 additions, 0 deletions
xbob/db/replay/test.py
with
56 additions
and
0 deletions
xbob/db/replay/query.py
+
47
−
0
View file @
3ccccc84
...
@@ -155,6 +155,53 @@ class Database(object):
...
@@ -155,6 +155,53 @@ class Database(object):
return
retval
return
retval
def
faces
(
self
,
filenames
,
directory
=
None
):
"""
Queries the files containing the face locations for the frames in the videos specified by the input parameter filenames
Keyword parameters:
filenames
The filenames of the videos. This object should be a python iterable (such as a tuple or list).
directory
A directory name that will be prepended to the final filepaths returned. The face locations files should be located in this directory
Returns:
A list of filenames with face locations. The face location files contain the following information, tab delimited:
* Frame number
* Bounding box top-left X coordinate
* Bounding box top-left Y coordinate
* Bounding box width
* Bounding box height
There is one row for each frame, and not all the frames contain detected faces
"""
if
directory
:
return
[
os
.
path
.
join
(
directory
,
stem
+
'
.faces
'
)
for
stem
in
filenames
]
return
[
stem
+
'
.faces
'
for
stem
in
filenames
]
def
faces_ids
(
self
,
ids
,
directory
=
None
):
"""
Queries the files containing the face locations for the frames in the videos specified by the input parameter ids
Keyword parameters:
ids
The ids of the objects in the database table
"
file
"
. This object should be a python iterable (such as a tuple or list).
directory
A directory name that will be prepended to the final filepath returned. The face locations files should be located in this directory
Returns:
A list of filenames with face locations. For description on the face locations file format, see the documentation for faces()
"""
if
not
directory
:
directory
=
''
facespaths
=
self
.
paths
(
ids
,
prefix
=
directory
,
suffix
=
'
.faces
'
)
return
facespaths
def
protocols
(
self
):
def
protocols
(
self
):
"""
Returns the names of all registered protocols
"""
"""
Returns the names of all registered protocols
"""
...
...
This diff is collapsed.
Click to expand it.
xbob/db/replay/test.py
+
9
−
0
View file @
3ccccc84
...
@@ -127,3 +127,12 @@ class ReplayDatabaseTest(unittest.TestCase):
...
@@ -127,3 +127,12 @@ class ReplayDatabaseTest(unittest.TestCase):
from
bob.db.script.dbmanage
import
main
from
bob.db.script.dbmanage
import
main
self
.
assertEqual
(
main
(
'
replay checkfiles --self-test
'
.
split
()),
0
)
self
.
assertEqual
(
main
(
'
replay checkfiles --self-test
'
.
split
()),
0
)
def
test13_queryfacefile
(
self
):
db
=
Database
()
self
.
assertEqual
(
db
.
faces
((
'
foo
'
,),
directory
=
'
dir
'
)[
0
],
'
dir/foo.faces
'
,)
def
test14_queryfacefile_key
(
self
):
db
=
Database
()
self
.
assertEqual
(
db
.
faces_ids
(
ids
=
(
1
,),
directory
=
'
dir
'
),
db
.
paths
(
ids
=
(
1
,),
prefix
=
'
dir
'
,
suffix
=
'
.faces
'
))
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