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
831ad2cc
Commit
831ad2cc
authored
5 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
add annotations
parent
e8f59da3
Branches
Branches containing commit
No related tags found
1 merge request
!101
WIP: add high-level database interface for HQ-WMCA
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pad/face/database/hqwmca.py
+26
-3
26 additions, 3 deletions
bob/pad/face/database/hqwmca.py
with
26 additions
and
3 deletions
bob/pad/face/database/hqwmca.py
+
26
−
3
View file @
831ad2cc
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
os
from
bob.pad.base.database
import
PadDatabase
,
PadFile
from
bob.extension
import
rc
...
...
@@ -83,7 +84,7 @@ class HQWMCAPadDatabase(PadDatabase):
"""
def
__init__
(
self
,
protocol
=
'
grand_test
'
,
original_directory
=
rc
[
'
bob.db.hqwmca.directory
'
],
original_extension
=
'
.h5
'
,
load_function
=
None
,
n_frames
=
10
,
**
kwargs
):
original_extension
=
'
.h5
'
,
annotations_dir
=
None
,
load_function
=
None
,
n_frames
=
10
,
**
kwargs
):
"""
Init function
Parameters
...
...
@@ -94,6 +95,8 @@ class HQWMCAPadDatabase(PadDatabase):
The directory where the original data of the database are stored.
original_extension : :py:class:`str`
The file name extension of the original data.
annotations_dir: str
Path to the annotations
load_function: :py:func:
Function used to load data. Should be defined in a configuration file
n_frames: int:
...
...
@@ -104,6 +107,7 @@ class HQWMCAPadDatabase(PadDatabase):
self
.
db
=
LowLevelDatabase
()
self
.
load_function
=
load_function
self
.
n_frames
=
n_frames
self
.
annotations_dir
=
annotations_dir
super
(
HQWMCAPadDatabase
,
self
).
__init__
(
name
=
'
hqwmca
'
,
...
...
@@ -175,6 +179,25 @@ class HQWMCAPadDatabase(PadDatabase):
def
annotations
(
self
,
file
):
"""
No annotations are provided with this DB
"""
Generate / retrieve annotations
This function will retrieve annotations (if exisiting and provided).
Otherwise, it will generate them using the MTCNN landmarks detector.
"""
return
None
print
(
file
)
if
self
.
annotations_dir
is
not
None
:
annotations_file
=
os
.
path
.
join
(
self
.
annotations_dir
,
file
.
path
+
"
.json
"
)
print
(
annotations_file
)
#with open(file_path, 'r') as json_file:
# annotations = json.load(json_file)
# load annotations
print
(
"
I
'
m supposed to load annotations
"
)
pass
else
:
logger
.
error
(
"
No annotations are provided to crop the face
"
)
import
sys
sys
.
exit
()
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