Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.db.cuhk_cufs
Commits
ed9a02b1
Commit
ed9a02b1
authored
Aug 14, 2015
by
Tiago de Freitas Pereira
Browse files
Implemented the protocol stuff and the query
parent
c7e00b5d
Changes
6
Hide whitespace changes
Inline
Side-by-side
bob/db/cuhk/__init__.py
View file @
ed9a02b1
...
...
@@ -18,12 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Details about the Voxforge database can be found here:
http://www.voxforge.org/
"""
from
.query
import
Database
from
bob.db.cuhk.models
import
File
,
Client
,
Annotation
from
bob.db.cuhk.models
import
File
,
Client
,
Annotation
,
Protocol_File_Association
def
get_config
():
"""Returns a string containing the configuration information.
...
...
bob/db/cuhk/create.py
View file @
ed9a02b1
...
...
@@ -188,6 +188,245 @@ def add_annotations(session, annotation_dir, verbose):
session
.
commit
()
def
add_protocols
(
session
,
verbose
,
photo2sketch
=
True
):
"""
There are 9 protocols:
CUHK - This covers only images from the CUHK student database
ARFACE - This covers only images from the ARFACE database
XM2VTS - This covers only images from the XM2VTS student database
ALL - It is a mixture of all databases (the training, dev and eval sets of all)
CUHK-ARFACE-XM2VTS: Training set of CUHK, dev set of ARFACE and eval set of XM2VTS
CUHK-XM2VTS-ARFACE:
ARFACE-CUHK-XM2VTS:
ARFACE-XM2VTS-CUHK:
XM2VTS-CUHK-ARFACE:
XM2VTS-ARFACE-CUHK:
"""
PROTOCOLS
=
(
'cuhk_p2s'
,
'arface_p2s'
,
'xm2vts_p2s'
,
'all-mixed_p2s'
,
'cuhk-arface-xm2vts_p2s'
,
'cuhk-xm2vts-arface_p2s'
,
'arface-cuhk-xm2vts_p2s'
,
'arface-xm2vts-cuhk_p2s'
,
'xm2vts-cuhk-arface_p2s'
,
'xm2vts-arface-cuhk_p2s'
,
'cuhk_s2p'
,
'arface_s2p'
,
'xm2vts_s2p'
,
'all-mixed_s2p'
,
'cuhk-arface-xm2vts_s2p'
,
'cuhk-xm2vts-arface_s2p'
,
'arface-cuhk-xm2vts_s2p'
,
'arface-xm2vts-cuhk_s2p'
,
'xm2vts-cuhk-arface_s2p'
,
'xm2vts-arface-cuhk_s2p'
)
GROUPS
=
(
'world'
,
'dev'
,
'eval'
)
PURPOSES
=
(
'train'
,
'enrol'
,
'probe'
)
arface
=
ARFACEWrapper
()
xm2vts
=
XM2VTSWrapper
()
cuhk
=
CUHKWrapper
()
if
(
photo2sketch
):
suffix
=
"_p2s"
else
:
suffix
=
"_s2p"
####### Protocol ARFACE
if
verbose
>=
1
:
print
(
'Creating the protocol ARFACE ...'
)
#getting the files
world_files
=
arface
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
arface
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
arface
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"arface"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############## Protocol XM2VTS
if
verbose
>=
1
:
print
(
'Creating the protocol XM2VTS ...'
)
#getting the files
world_files
=
xm2vts
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
xm2vts
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
xm2vts
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"xm2vts"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############## Protocol CUHK
if
verbose
>=
1
:
print
(
'Creating the protocol CUHK ...'
)
#getting the files
world_files
=
cuhk
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
cuhk
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
cuhk
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"cuhk"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol all-mixed
if
verbose
>=
1
:
print
(
'Creating the protocol ALL mixed ...'
)
#getting the files
world_files
=
arface
.
get_files_from_group
(
group
=
"world"
)
+
\
xm2vts
.
get_files_from_group
(
group
=
"world"
)
+
\
cuhk
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
arface
.
get_files_from_group
(
group
=
"dev"
)
+
\
xm2vts
.
get_files_from_group
(
group
=
"dev"
)
+
\
cuhk
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
arface
.
get_files_from_group
(
group
=
"eval"
)
+
\
xm2vts
.
get_files_from_group
(
group
=
"eval"
)
+
\
cuhk
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"all-mixed"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"all-mixed"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"all-mixed"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol cuhk-arface-xm2vts
if
verbose
>=
1
:
print
(
'Creating the protocol cuhk-arface-xm2vts ...'
)
#getting the files
world_files
=
cuhk
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
arface
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
xm2vts
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"cuhk-arface-xm2vts"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk-arface-xm2vts"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk-arface-xm2vts"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol cuhk-xm2vts-arface
if
verbose
>=
1
:
print
(
'Creating the protocol cuhk-xm2vts-arface ...'
)
#getting the files
world_files
=
cuhk
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
xm2vts
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
arface
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"cuhk-xm2vts-arface"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk-xm2vts-arface"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"cuhk-xm2vts-arface"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol arface-cuhk-xm2vts
if
verbose
>=
1
:
print
(
'Creating the protocol arface-cuhk-xm2vts ...'
)
#getting the files
world_files
=
arface
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
cuhk
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
xm2vts
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"arface-cuhk-xm2vts"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface-cuhk-xm2vts"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface-cuhk-xm2vts"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol arface-xm2vts-cuhk
if
verbose
>=
1
:
print
(
'Creating the protocol arface-xm2vts-cuhk ...'
)
#getting the files
world_files
=
arface
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
xm2vts
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
cuhk
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"arface-xm2vts-cuhk"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface-xm2vts-cuhk"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"arface-xm2vts-cuhk"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol xm2vts-cuhk-arface
if
verbose
>=
1
:
print
(
'Creating the protocol xm2vts-cuhk-arface ...'
)
#getting the files
world_files
=
xm2vts
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
cuhk
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
arface
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"xm2vts-cuhk-arface"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts-cuhk-arface"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts-cuhk-arface"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
############# Protocol xm2vts-arface-cuhk
if
verbose
>=
1
:
print
(
'Creating the protocol xm2vts-arface-cuhk ...'
)
#getting the files
world_files
=
xm2vts
.
get_files_from_group
(
group
=
"world"
)
dev_files
=
arface
.
get_files_from_group
(
group
=
"dev"
)
eval_files
=
cuhk
.
get_files_from_group
(
group
=
"eval"
)
#Inserting in the database
insert_protocol_data
(
session
,
"xm2vts-arface-cuhk"
+
suffix
,
"world"
,
"train"
,
world_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts-arface-cuhk"
+
suffix
,
"dev"
,
""
,
dev_files
,
photo2sketch
=
photo2sketch
)
insert_protocol_data
(
session
,
"xm2vts-arface-cuhk"
+
suffix
,
"eval"
,
""
,
eval_files
,
photo2sketch
=
photo2sketch
)
session
.
commit
()
def
insert_protocol_data
(
session
,
protocol
,
group
,
purpose
,
file_objects
,
photo2sketch
=
True
):
for
f
in
file_objects
:
if
purpose
!=
"train"
:
if
photo2sketch
and
f
.
modality
==
"photo"
:
purpose
=
"enrol"
else
:
purpose
=
"probe"
session
.
add
(
bob
.
db
.
cuhk
.
Protocol_File_Association
(
protocol
,
group
,
purpose
,
f
.
id
))
def
create_tables
(
args
):
"""Creates all necessary tables (only to be used at the first time)"""
...
...
@@ -224,8 +463,9 @@ def create(args):
add_files
(
s
,
args
.
verbose
)
add_annotations
(
s
,
args
.
annotation_dir
,
args
.
verbose
)
#add_protocols(s, args.verbose)
#add_clientxprotocols(s, args.verbose)
add_protocols
(
s
,
args
.
verbose
,
photo2sketch
=
True
)
add_protocols
(
s
,
args
.
verbose
,
photo2sketch
=
False
)
s
.
commit
()
s
.
close
()
...
...
bob/db/cuhk/data/all-cuhk.txt
View file @
ed9a02b1
...
...
@@ -18,40 +18,40 @@ CUHK-student-dataset/sketch/f1-012-01-sz1 f1-012-01
CUHK-student-dataset/sketch/f1-013-01-sz1 f1-013-01
CUHK-student-dataset/sketch/f1-014-01-sz1 f1-014-01
CUHK-student-dataset/sketch/f1-015-01-sz1 f1-015-01
CUHK-student-dataset/sketch/f2-005-01-sz1 f
2
-005-01
CUHK-student-dataset/sketch/f2-006-01-sz1 f
2
-006-01
CUHK-student-dataset/sketch/f2-007-01-sz1 f
2
-007-01
CUHK-student-dataset/sketch/f2-008-01-sz1 f
2
-008-01
CUHK-student-dataset/sketch/f2-009-01-sz1 f
2
-009-01
CUHK-student-dataset/sketch/f2-010-01-sz1 f
2
-010-01
CUHK-student-dataset/sketch/f2-011-01-sz1 f
2
-011-01
CUHK-student-dataset/sketch/f2-012-01-sz1 f
2
-012-01
CUHK-student-dataset/sketch/f2-013-01-sz1 f
2
-013-01
CUHK-student-dataset/sketch/f2-014-01-sz1 f
2
-014-01
CUHK-student-dataset/sketch/f2-015-01-sz1 f
2
-015-01
CUHK-student-dataset/sketch/f2-016-01-sz1 f
2
-016-01
CUHK-student-dataset/sketch/f2-017-01-sz1 f
2
-017-01
CUHK-student-dataset/sketch/f2-018-01-sz1 f
2
-018-01
CUHK-student-dataset/sketch/f2-019-01-sz1 f
2
-019-01
CUHK-student-dataset/sketch/f2-020-01-sz1 f
2
-020-01
CUHK-student-dataset/sketch/f2-021-01-sz1 f
2
-021-01
CUHK-student-dataset/sketch/f2-022-01-sz1 f
2
-022-01
CUHK-student-dataset/sketch/f2-023-01-sz1 f
2
-023-01
CUHK-student-dataset/sketch/f2-024-01-sz1 f
2
-024-01
CUHK-student-dataset/sketch/f2-025-01-sz1 f
2
-025-01
CUHK-student-dataset/sketch/f2-026-01-sz1 f
2
-026-01
CUHK-student-dataset/sketch/f2-027-01-sz1 f
2
-027-01
CUHK-student-dataset/sketch/f2-028-01-sz1 f
2
-028-01
CUHK-student-dataset/sketch/f2-029-01-sz1 f
2
-029-01
CUHK-student-dataset/sketch/f2-030-01-sz1 f
2
-030-01
CUHK-student-dataset/sketch/f2-031-01-sz1 f
2
-031-01
CUHK-student-dataset/sketch/f2-032-01-sz1 f
2
-032-01
CUHK-student-dataset/sketch/f2-033-01-sz1 f
2
-033-01
CUHK-student-dataset/sketch/f2-034-01-sz1 f
2
-034-01
CUHK-student-dataset/sketch/f2-035-01-sz1 f
2
-035-01
CUHK-student-dataset/sketch/f2-036-01-sz1 f
2
-036-01
CUHK-student-dataset/sketch/f2-037-01-sz1 f
2
-037-01
CUHK-student-dataset/sketch/f2-038-01-sz1 f
2
-038-01
CUHK-student-dataset/sketch/f2-005-01-sz1 f-005-01
CUHK-student-dataset/sketch/f2-006-01-sz1 f-006-01
CUHK-student-dataset/sketch/f2-007-01-sz1 f-007-01
CUHK-student-dataset/sketch/f2-008-01-sz1 f-008-01
CUHK-student-dataset/sketch/f2-009-01-sz1 f-009-01
CUHK-student-dataset/sketch/f2-010-01-sz1 f-010-01
CUHK-student-dataset/sketch/f2-011-01-sz1 f-011-01
CUHK-student-dataset/sketch/f2-012-01-sz1 f-012-01
CUHK-student-dataset/sketch/f2-013-01-sz1 f-013-01
CUHK-student-dataset/sketch/f2-014-01-sz1 f-014-01
CUHK-student-dataset/sketch/f2-015-01-sz1 f-015-01
CUHK-student-dataset/sketch/f2-016-01-sz1 f-016-01
CUHK-student-dataset/sketch/f2-017-01-sz1 f-017-01
CUHK-student-dataset/sketch/f2-018-01-sz1 f-018-01
CUHK-student-dataset/sketch/f2-019-01-sz1 f-019-01
CUHK-student-dataset/sketch/f2-020-01-sz1 f-020-01
CUHK-student-dataset/sketch/f2-021-01-sz1 f-021-01
CUHK-student-dataset/sketch/f2-022-01-sz1 f-022-01
CUHK-student-dataset/sketch/f2-023-01-sz1 f-023-01
CUHK-student-dataset/sketch/f2-024-01-sz1 f-024-01
CUHK-student-dataset/sketch/f2-025-01-sz1 f-025-01
CUHK-student-dataset/sketch/f2-026-01-sz1 f-026-01
CUHK-student-dataset/sketch/f2-027-01-sz1 f-027-01
CUHK-student-dataset/sketch/f2-028-01-sz1 f-028-01
CUHK-student-dataset/sketch/f2-029-01-sz1 f-029-01
CUHK-student-dataset/sketch/f2-030-01-sz1 f-030-01
CUHK-student-dataset/sketch/f2-031-01-sz1 f-031-01
CUHK-student-dataset/sketch/f2-032-01-sz1 f-032-01
CUHK-student-dataset/sketch/f2-033-01-sz1 f-033-01
CUHK-student-dataset/sketch/f2-034-01-sz1 f-034-01
CUHK-student-dataset/sketch/f2-035-01-sz1 f-035-01
CUHK-student-dataset/sketch/f2-036-01-sz1 f-036-01
CUHK-student-dataset/sketch/f2-037-01-sz1 f-037-01
CUHK-student-dataset/sketch/f2-038-01-sz1 f-038-01
CUHK-student-dataset/sketch/m-063-01-sz1 m-063-01
CUHK-student-dataset/sketch/m-064-01-sz1 m-064-01
CUHK-student-dataset/sketch/m-065-01-sz1 m-065-01
...
...
@@ -132,60 +132,60 @@ CUHK-student-dataset/sketch/m1-038-01-sz1 m1-038-01
CUHK-student-dataset/sketch/m1-039-01-sz1 m1-039-01
CUHK-student-dataset/sketch/m1-040-01-sz1 m1-040-01
CUHK-student-dataset/sketch/m1-041-01-sz1 m1-041-01
CUHK-student-dataset/sketch/m2-008-01-sz1 m
2
-008-01
CUHK-student-dataset/sketch/m2-009-01-sz1 m
2
-009-01
CUHK-student-dataset/sketch/m2-010-01-sz1 m
2
-010-01
CUHK-student-dataset/sketch/m2-011-01-sz1 m
2
-011-01
CUHK-student-dataset/sketch/m2-012-01-sz1 m
2
-012-01
CUHK-student-dataset/sketch/m2-013-01-sz1 m
2
-013-01
CUHK-student-dataset/sketch/m2-014-01-sz1 m
2
-014-01
CUHK-student-dataset/sketch/m2-015-01-sz1 m
2
-015-01
CUHK-student-dataset/sketch/m2-016-01-sz1 m
2
-016-01
CUHK-student-dataset/sketch/m2-017-01-sz1 m
2
-017-01
CUHK-student-dataset/sketch/m2-018-01-sz1 m
2
-018-01
CUHK-student-dataset/sketch/m2-019-01-sz1 m
2
-019-01
CUHK-student-dataset/sketch/m2-021-01-sz1 m
2
-021-01
CUHK-student-dataset/sketch/m2-022-01-sz1 m
2
-022-01
CUHK-student-dataset/sketch/m2-023-01-sz1 m
2
-023-01
CUHK-student-dataset/sketch/m2-024-01-sz1 m
2
-024-01
CUHK-student-dataset/sketch/m2-025-01-sz1 m
2
-025-01
CUHK-student-dataset/sketch/m2-026-01-sz1 m
2
-026-01
CUHK-student-dataset/sketch/m2-027-01-sz1 m
2
-027-01
CUHK-student-dataset/sketch/m2-028-01-sz1 m
2
-028-01
CUHK-student-dataset/sketch/m2-029-01-sz1 m
2
-029-01
CUHK-student-dataset/sketch/m2-030-01-sz1 m
2
-030-01
CUHK-student-dataset/sketch/m2-031-01-sz1 m
2
-031-01
CUHK-student-dataset/sketch/m2-032-01-sz1 m
2
-032-01
CUHK-student-dataset/sketch/m2-033-01-sz1 m
2
-033-01
CUHK-student-dataset/sketch/m2-034-01-sz1 m
2
-034-01
CUHK-student-dataset/sketch/m2-035-01-sz1 m
2
-035-01
CUHK-student-dataset/sketch/m2-036-01-sz1 m
2
-036-01
CUHK-student-dataset/sketch/m2-037-01-sz1 m
2
-037-01
CUHK-student-dataset/sketch/m2-038-01-sz1 m
2
-038-01
CUHK-student-dataset/sketch/m2-039-01-sz1 m
2
-039-01
CUHK-student-dataset/sketch/m2-040-01-sz1 m
2
-040-01
CUHK-student-dataset/sketch/m2-041-01-sz1 m
2
-041-01
CUHK-student-dataset/sketch/m2-042-01-sz1 m
2
-042-01
CUHK-student-dataset/sketch/m2-043-01-sz1 m
2
-043-01
CUHK-student-dataset/sketch/m2-044-01-sz1 m
2
-044-01
CUHK-student-dataset/sketch/m2-045-01-sz1 m
2
-045-01
CUHK-student-dataset/sketch/m2-046-01-sz1 m
2
-046-01
CUHK-student-dataset/sketch/m2-047-01-sz1 m
2
-047-01
CUHK-student-dataset/sketch/m2-048-01-sz1 m
2
-048-01
CUHK-student-dataset/sketch/m2-049-01-sz1 m
2
-049-01
CUHK-student-dataset/sketch/m2-050-01-sz1 m
2
-050-01
CUHK-student-dataset/sketch/m2-051-01-sz1 m
2
-051-01
CUHK-student-dataset/sketch/m2-052-01-sz1 m
2
-052-01
CUHK-student-dataset/sketch/m2-053-01-sz1 m
2
-053-01
CUHK-student-dataset/sketch/m2-054-01-sz1 m
2
-054-01
CUHK-student-dataset/sketch/m2-055-01-sz1 m
2
-055-01
CUHK-student-dataset/sketch/m2-056-01-sz1 m
2
-056-01
CUHK-student-dataset/sketch/m2-057-01-sz1 m
2
-057-01
CUHK-student-dataset/sketch/m2-058-01-sz1 m
2
-058-01
CUHK-student-dataset/sketch/m2-059-01-sz1 m
2
-059-01
CUHK-student-dataset/sketch/m2-060-01-sz1 m
2
-060-01
CUHK-student-dataset/sketch/m2-061-01-sz1 m
2
-061-01
CUHK-student-dataset/sketch/m2-062-01-sz1 m
2
-062-01
CUHK-student-dataset/sketch/m2-008-01-sz1 m-008-01
CUHK-student-dataset/sketch/m2-009-01-sz1 m-009-01
CUHK-student-dataset/sketch/m2-010-01-sz1 m-010-01
CUHK-student-dataset/sketch/m2-011-01-sz1 m-011-01
CUHK-student-dataset/sketch/m2-012-01-sz1 m-012-01
CUHK-student-dataset/sketch/m2-013-01-sz1 m-013-01
CUHK-student-dataset/sketch/m2-014-01-sz1 m-014-01
CUHK-student-dataset/sketch/m2-015-01-sz1 m-015-01
CUHK-student-dataset/sketch/m2-016-01-sz1 m-016-01
CUHK-student-dataset/sketch/m2-017-01-sz1 m-017-01
CUHK-student-dataset/sketch/m2-018-01-sz1 m-018-01
CUHK-student-dataset/sketch/m2-019-01-sz1 m-019-01
CUHK-student-dataset/sketch/m2-021-01-sz1 m-021-01
CUHK-student-dataset/sketch/m2-022-01-sz1 m-022-01
CUHK-student-dataset/sketch/m2-023-01-sz1 m-023-01
CUHK-student-dataset/sketch/m2-024-01-sz1 m-024-01
CUHK-student-dataset/sketch/m2-025-01-sz1 m-025-01
CUHK-student-dataset/sketch/m2-026-01-sz1 m-026-01
CUHK-student-dataset/sketch/m2-027-01-sz1 m-027-01
CUHK-student-dataset/sketch/m2-028-01-sz1 m-028-01
CUHK-student-dataset/sketch/m2-029-01-sz1 m-029-01
CUHK-student-dataset/sketch/m2-030-01-sz1 m-030-01
CUHK-student-dataset/sketch/m2-031-01-sz1 m-031-01
CUHK-student-dataset/sketch/m2-032-01-sz1 m-032-01
CUHK-student-dataset/sketch/m2-033-01-sz1 m-033-01
CUHK-student-dataset/sketch/m2-034-01-sz1 m-034-01
CUHK-student-dataset/sketch/m2-035-01-sz1 m-035-01
CUHK-student-dataset/sketch/m2-036-01-sz1 m-036-01
CUHK-student-dataset/sketch/m2-037-01-sz1 m-037-01
CUHK-student-dataset/sketch/m2-038-01-sz1 m-038-01
CUHK-student-dataset/sketch/m2-039-01-sz1 m-039-01
CUHK-student-dataset/sketch/m2-040-01-sz1 m-040-01
CUHK-student-dataset/sketch/m2-041-01-sz1 m-041-01
CUHK-student-dataset/sketch/m2-042-01-sz1 m-042-01
CUHK-student-dataset/sketch/m2-043-01-sz1 m-043-01
CUHK-student-dataset/sketch/m2-044-01-sz1 m-044-01
CUHK-student-dataset/sketch/m2-045-01-sz1 m-045-01
CUHK-student-dataset/sketch/m2-046-01-sz1 m-046-01
CUHK-student-dataset/sketch/m2-047-01-sz1 m-047-01
CUHK-student-dataset/sketch/m2-048-01-sz1 m-048-01
CUHK-student-dataset/sketch/m2-049-01-sz1 m-049-01
CUHK-student-dataset/sketch/m2-050-01-sz1 m-050-01
CUHK-student-dataset/sketch/m2-051-01-sz1 m-051-01
CUHK-student-dataset/sketch/m2-052-01-sz1 m-052-01
CUHK-student-dataset/sketch/m2-053-01-sz1 m-053-01
CUHK-student-dataset/sketch/m2-054-01-sz1 m-054-01
CUHK-student-dataset/sketch/m2-055-01-sz1 m-055-01
CUHK-student-dataset/sketch/m2-056-01-sz1 m-056-01
CUHK-student-dataset/sketch/m2-057-01-sz1 m-057-01
CUHK-student-dataset/sketch/m2-058-01-sz1 m-058-01
CUHK-student-dataset/sketch/m2-059-01-sz1 m-059-01
CUHK-student-dataset/sketch/m2-060-01-sz1 m-060-01
CUHK-student-dataset/sketch/m2-061-01-sz1 m-061-01
CUHK-student-dataset/sketch/m2-062-01-sz1 m-062-01
CUHK-student-dataset/photo/f-005-01 f-005-01
CUHK-student-dataset/photo/f-006-01 f-006-01
CUHK-student-dataset/photo/f-007-01 f-007-01
...
...
bob/db/cuhk/models.py
View file @
ed9a02b1
...
...
@@ -38,19 +38,35 @@ import os
Base
=
declarative_base
()
""" Defining protocols. Yes, they are static """
PROTOCOLS
=
(
'cuhk'
,
'arface'
,
'xm2vts'
,
'all-mixed'
,
'cuhk-arface-xm2vts'
,
'cuhk-xm2vts-arface'
,
'arface-cuhk-xm2vts'
,
'arface-xm2vts-cuhk'
,
'xm2vts-cuhk-arface'
,
'xm2vts-arface-cuhk'
)
PROTOCOLS
=
(
'cuhk_p2s'
,
'arface_p2s'
,
'xm2vts_p2s'
,
'all-mixed_p2s'
,
'cuhk-arface-xm2vts_p2s'
,
'cuhk-xm2vts-arface_p2s'
,
'arface-cuhk-xm2vts_p2s'
,
'arface-xm2vts-cuhk_p2s'
,
'xm2vts-cuhk-arface_p2s'
,
'xm2vts-arface-cuhk_p2s'
,
'cuhk_s2p'
,
'arface_s2p'
,
'xm2vts_s2p'
,
'all-mixed_s2p'
,
'cuhk-arface-xm2vts_s2p'
,
'cuhk-xm2vts-arface_s2p'
,
'arface-cuhk-xm2vts_s2p'
,
'arface-xm2vts-cuhk_s2p'
,
'xm2vts-cuhk-arface_s2p'
,
'xm2vts-arface-cuhk_s2p'
)
GROUPS
=
(
'world'
,
'dev'
,
'eval'
)
PURPOSES
=
(
'train'
,
'enrol'
,
'probe'
)
protocolPurpose_file_association
=
Table
(
'protocol_file_association'
,
Base
.
metadata
,
Column
(
'protocol'
,
Enum
(
*
PROTOCOLS
),
primary_key
=
True
),
Column
(
'group'
,
Enum
(
*
GROUPS
),
primary_key
=
True
),
Column
(
'purpose'
,
Enum
(
*
PURPOSES
),
primary_key
=
True
),
Column
(
'file_id'
,
Integer
,
ForeignKey
(
'file.id'
),
primary_key
=
True
))
class
Protocol_File_Association
(
Base
):
"""
Describe the protocols
"""
__tablename__
=
'protocol_file_association'
protocol
=
Column
(
'protocol'
,
Enum
(
*
PROTOCOLS
),
primary_key
=
True
)
group
=
Column
(
'group'
,
Enum
(
*
GROUPS
),
primary_key
=
True
)
purpose
=
Column
(
'purpose'
,
Enum
(
*
PURPOSES
),
primary_key
=
True
)
file_id
=
Column
(
'file_id'
,
Integer
,
ForeignKey
(
'file.id'
),
primary_key
=
True
)
def
__init__
(
self
,
protocol
,
group
,
purpose
,
file_id
):
self
.
protocol
=
protocol
self
.
group
=
group
self
.
purpose
=
purpose
self
.
file_id
=
file_id
class
Client
(
Base
):
"""
...
...
@@ -95,7 +111,7 @@ class File(Base, bob.db.verification.utils.File):
modality
=
Column
(
Enum
(
*
modality_choices
))
# a back-reference from the client class to a list of files
client
=
relationship
(
"Client"
,
backref
=
backref
(
"file"
,
order_by
=
id
))
client
=
relationship
(
"Client"
,
backref
=
backref
(
"file
s
"
,
order_by
=
id
))
all_annotations
=
relationship
(
"Annotation"
,
backref
=
backref
(
"file"
),
uselist
=
True
)
def
__init__
(
self
,
id
,
image_name
,
client_id
,
modality
):
...
...
bob/db/cuhk/query.py
View file @
ed9a02b1
...
...
@@ -21,6 +21,8 @@ import os
import
six
from
bob.db.base
import
utils
from
.models
import
*
from
.models
import
PROTOCOLS
,
GROUPS
,
PURPOSES
from
.driver
import
Interface
import
bob.db.verification.utils
...
...
@@ -40,20 +42,68 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
"""This function returns lists of File objects, which fulfill the given restrictions."""
"""
This function returns lists of File objects, which fulfill the given restrictions.
"""
def
model_ids
(
self
,
protocol
=
None
,
groups
=
None
,
gender
=
None
):
return
[]
#Checking inputs
groups
=
self
.
check_parameters_for_validity
(
groups
,
"group"
,
GROUPS
)
protocols
=
self
.
check_parameters_for_validity
(
protocol
,
"protocol"
,
PROTOCOLS
)
purposes
=
self
.
check_parameters_for_validity
(
purposes
,
"purpose"
,
PURPOSES
)
#You need to select only one protocol
if
(
len
(
protocols
)
>
1
):
raise
ValueError
(
"Please, select only one of the following protocols {0}"
.
format
(
protocols
))
#Querying
query
=
self
.
query
(
bob
.
db
.
cuhk
.
File
).
join
(
bob
.
db
.
cuhk
.
Protocol_File_Association
).
join
(
bob
.
db
.
cuhk
.
Client
)
#filtering
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Protocol_File_Association
.
group
.
in_
(
groups
))
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Protocol_File_Association
.
protocol
.
in_
(
protocols
))
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Protocol_File_Association
.
purpose
.
in_
(
purposes
))
if
model_ids
is
not
None
:
if
type
(
model_ids
)
is
not
list
and
type
(
model_ids
)
is
not
tuple
:
model_ids
=
[
model_ids
]
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Client
.
id
.
in_
(
model_ids
))
return
query
.
all
()
def
model_ids
(
self
,
protocol
=
None
,
groups
=
None
):
#Checking inputs
groups
=
self
.
check_parameters_for_validity
(
groups
,
"group"
,
GROUPS
)
protocols
=
self
.
check_parameters_for_validity
(
protocol
,
"protocol"
,
PROTOCOLS
)
#You need to select only one protocol
if
(
len
(
protocols
)
>
1
):
raise
ValueError
(
"Please, select only one of the following protocols {0}"
.
format
(
protocols
))
#Querying
query
=
self
.
query
(
bob
.
db
.
cuhk
.
Client
).
join
(
bob
.
db
.
cuhk
.
File
).
join
(
bob
.
db
.
cuhk
.
Protocol_File_Association
)
#filtering
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Protocol_File_Association
.
group
.
in_
(
groups
))
query
=
query
.
filter
(
bob
.
db
.
cuhk
.
Protocol_File_Association
.
protocol
.
in_
(
protocols
))
return
query
.
all
()
def
groups
(
self
,
protocol
=
None
,
**
kwargs
):
"""This function returns the list of groups for this database."""
return
GROUPS
def
tmodel_ids
(
self
,
groups
=
None
,
protocol
=
None
,
**
kwargs
):
"""This function returns the ids of the T-Norm models of the given groups for the given protocol."""
return
[]
def
tobjects
(
self
,
protocol
=
None
,
model_ids
=
None
,
groups
=
None
):
#No TObjects
...
...
bob/db/cuhk/utils.py
View file @
ed9a02b1
...
...
@@ -9,6 +9,7 @@ This file has some utilities to deal with the files provided by the database
"""
import
os
import
numpy
import
bob.db.arface
def
read_annotations
(
file_name
):
...
...
@@ -65,6 +66,32 @@ class ARFACEWrapper():
return
'man'
if
client_id
[
0
]
==
'm'
else
'woman'
def
get_files_from_group
(
self
,
group
=
""
):
"""
Get the bob.db.cuhk.File for a given group (world, dev or eval).
Follow bellow the steps for this selection.
1 - Select the bob.db.arface.Client for a given group
2 - Search the correspondent bob.db.cuhk.File joint with bob.db.cuhk.Client using the original_client_id as a search criteria.