Commit 0ae34559 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

ORganizing the package

parent 06deef6a
'm-002-1'
'm-003-1'
'm-005-1'
'm-006-1'
'm-007-1'
'm-008-1'
'm-009-1'
'm-010-1'
'm-011-1'
'm-013-1'
'm-014-1'
'm-015-1'
'm-016-1'
'm-017-1'
'm-018-1'
'm-020-1'
'm-021-1'
'm-022-1'
'm-023-1'
'm-024-1'
'm-025-1'
'm-026-1'
'm-027-1'
'm-028-1'
'm-029-1'
'm-030-1'
'm-031-1'
'm-032-1'
'm-033-1'
'm-035-1'
'm-036-1'
'm-037-1'
'm-038-1'
'm-039-1'
'm-040-1'
'm-041-1'
'm-042-1'
'm-043-1'
'm-044-1'
'm-045-1'
'm-046-1'
'm-047-1'
'm-048-1'
'm-049-1'
'm-050-1'
'm-051-1'
'm-052-1'
'm-053-1'
'm-054-1'
'm-055-1'
'm-056-1'
'm-057-1'
'm-058-1'
'm-059-1'
'm-060-1'
'm-061-1'
'm-062-1'
'm-063-1'
'm-064-1'
'm-065-1'
'm-066-1'
'm-067-1'
'm-068-1'
'm-069-1'
'm-070-1'
'm-071-1'
'm-072-1'
'm-073-1'
'm-074-1'
'm-075-1'
'w-001-1'
'w-002-1'
'w-003-1'
'w-004-1'
'w-005-1'
'w-007-1'
'w-008-1'
'w-014-1'
'w-015-1'
'w-016-1'
'w-017-1'
'w-018-1'
'w-019-1'
'w-020-1'
'w-021-1'
'w-022-1'
'w-023-1'
'w-024-1'
'w-025-1'
'w-026-1'
'w-027-1'
'w-028-1'
'w-029-1'
'w-030-1'
'w-031-1'
'w-032-1'
'w-033-1'
'w-034-1'
'w-035-1'
'w-036-1'
'w-037-1'
'w-038-1'
'w-039-1'
'w-040-1'
'w-041-1'
'w-042-1'
'w-043-1'
'w-044-1'
'w-045-1'
'w-046-1'
'w-047-1'
'w-048-1'
'w-049-1'
'w-050-1'
'w-051-1'
'w-052-1'
'w-053-1'
'w-054-1'
'w-055-1'
'w-056-1'
'w-057-1'
'w-058-1'
'w-059-1'
\ No newline at end of file
'000_1_1'
'001_1_1'
'002_1_1'
'003_1_1'
'004_1_1'
'005_1_1'
'006_1_1'
'007_1_1'
'008_1_1'
'009_1_1'
'010_1_1'
'011_1_1'
'012_1_1'
'013_1_1'
'016_1_1'
'017_1_1'
'018_1_1'
'019_1_1'
'020_1_1'
'021_1_1'
'022_1_1'
'023_1_1'
'024_1_1'
'025_1_1'
'026_1_1'
'027_1_1'
'028_1_1'
'029_1_1'
'030_1_1'
'031_1_1'
'032_1_1'
'033_1_1'
'034_1_1'
'035_1_1'
'036_1_1'
'037_1_1'
'038_1_1'
'039_1_1'
'040_1_1'
'041_1_1'
'042_1_1'
'043_1_1'
'044_1_1'
'045_1_1'
'046_1_1'
'047_1_1'
'048_1_1'
'049_1_1'
'050_1_1'
'051_1_1'
'052_1_1'
'053_1_1'
'054_1_1'
'055_1_1'
'056_1_1'
'057_1_1'
'058_1_1'
'059_1_1'
'060_1_1'
'061_1_1'
'062_1_1'
'064_1_1'
'065_1_1'
'066_1_1'
'067_1_1'
'068_1_1'
'069_1_1'
'070_1_1'
'071_1_1'
'072_1_1'
'073_1_1'
'074_1_1'
'075_1_1'
'078_1_1'
'079_1_1'
'080_1_1'
'081_1_1'
'082_1_1'
'083_1_1'
'085_1_1'
'086_1_1'
'087_1_1'
'088_1_1'
'089_1_1'
'090_1_1'
'091_1_1'
'092_1_1'
'093_1_1'
'095_1_1'
'096_1_1'
'098_1_1'
'099_1_1'
'101_1_1'
'102_1_1'
'103_1_1'
'104_1_1'
'105_1_1'
'107_1_1'
'108_1_1'
'109_1_1'
'110_1_1'
'111_1_1'
'112_1_1'
'113_1_1'
'114_1_1'
'115_1_1'
'116_1_1'
'119_1_1'
'120_1_1'
'121_1_1'
'122_1_1'
'123_1_1'
'124_1_1'
'125_1_1'
'126_1_1'
'127_1_1'
'128_1_1'
'129_1_1'
'130_1_1'
'131_1_1'
'132_1_1'
'133_1_1'
'134_1_1'
'135_1_1'
'136_1_1'
'137_1_1'
'138_1_1'
'140_1_1'
'141_1_1'
'142_1_1'
'143_1_1'
'145_1_1'
'146_1_1'
'147_1_1'
'148_1_1'
'149_1_1'
'150_1_1'
'152_1_1'
'153_1_1'
'154_1_1'
'155_1_1'
'157_1_1'
'158_1_1'
'159_1_1'
'160_1_1'
'161_1_1'
'163_1_1'
'164_1_1'
'165_1_1'
'166_1_1'
'167_1_1'
'168_1_1'
'169_1_1'
'170_1_1'
'171_1_1'
'172_1_1'
'173_1_1'
'174_1_1'
'175_1_1'
'176_1_1'
'177_1_1'
'178_1_1'
'179_1_1'
'180_1_1'
'181_1_1'
'182_1_1'
'183_1_1'
'185_1_1'
'187_1_1'
'188_1_1'
'189_1_1'
'190_1_1'
'191_1_1'
'193_1_1'
'196_1_1'
'197_1_1'
'198_1_1'
'199_1_1'
'200_1_1'
'201_1_1'
'202_1_1'
'203_1_1'
'206_1_1'
'207_1_1'
'208_1_1'
'209_1_1'
'210_1_1'
'211_1_1'
'212_1_1'
'213_1_1'
'215_1_1'
'216_1_1'
'218_1_1'
'219_1_1'
'221_1_1'
'222_1_1'
'224_1_1'
'225_1_1'
'226_1_1'
'227_1_1'
'228_1_1'
'229_1_1'
'231_1_1'
'232_1_1'
'233_1_1'
'234_1_1'
'235_1_1'
'236_1_1'
'237_1_1'
'240_1_1'
'241_1_1'
'242_1_1'
'243_1_1'
'244_1_1'
'246_1_1'
'248_1_1'
'249_1_1'
'250_1_1'
'253_1_1'
'255_1_1'
'258_1_1'
'259_1_1'
'261_1_1'
'263_1_1'
'264_1_1'
'266_1_1'
'267_1_1'
'269_1_1'
'270_1_1'
'271_1_1'
'272_1_1'
'274_1_1'
'275_1_1'
'276_1_1'
'278_1_1'
'279_1_1'
'280_1_1'
'281_1_1'
'282_1_1'
'283_1_1'
'284_1_1'
'285_1_1'
'286_1_1'
'287_1_1'
'288_1_1'
'289_1_1'
'290_1_1'
'292_1_1'
'293_1_1'
'295_1_1'
'300_1_1'
'301_1_1'
'305_1_1'
'310_1_1'
'312_1_1'
'313_1_1'
'314_1_1'
'315_1_1'
'316_1_1'
'317_1_1'
'318_1_1'
'319_1_1'
'320_1_1'
'321_1_1'
'322_1_1'
'323_1_1'
'324_1_1'
'325_1_1'
'328_1_1'
'329_1_1'
'330_1_1'
'331_1_1'
'332_1_1'
'333_1_1'
'334_1_1'
'335_1_1'
'336_1_1'
'337_1_1'
'338_1_1'
'339_1_1'
'340_1_1'
'341_1_1'
'342_1_1'
'357_1_1'
'358_1_1'
'359_1_1'
'360_1_1'
'362_1_1'
'364_1_1'
'365_1_1'
'366_1_1'
'367_1_1'
'369_1_1'
'370_1_1'
'371_1_1'
\ No newline at end of file
......@@ -23,7 +23,7 @@ http://www.voxforge.org/
"""
from .query import Database
from bob.db.verification.filelist.models import File, Client
from bob.db.cuhk.models import File, Client, Annotation
def get_config():
"""Returns a string containing the configuration information.
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# @date: Tue Aug 11 14:07:00 CEST 2015
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
This script creates the CUHK-CUFS database in a single pass.
"""
import os
from .models import *
from utils import ARFACEWrapper, XM2VTSWrapper, CUHKWrapper
def add_clients(session, verbose = True):
"""Adds the clients and split up the groups 'world', 'dev', and 'eval'"""
#import ipdb; ipdb.set_trace();
#Adding the clients from ARFACE
arface_clients = ARFACEWrapper.get_clients()
if verbose>=1: print('Adding ARFACE clients to the database ...')
client_ids = range(1,len(arface_clients)+1)
id_offset = 1
for id in client_ids:
id_offset = id
original_client_id = arface_clients[id-1]
if verbose>=1: print(" Adding client {0}".format(original_client_id))
session.add(Client(id=id,
gender=ARFACEWrapper.get_gender_from_client_id(original_client_id),
original_id = original_client_id,
original_database = "arface"
))
del arface_clients
#Adding the clients from XM2VTS
xm2vts_clients = XM2VTSWrapper.get_clients()
if verbose>=1: print('Adding XM2VTS clients to the database ...')
client_ids = range(len(xm2vts_clients))
for id in client_ids:
id_offset += 1
original_client_id = xm2vts_clients[id]
if verbose>=1: print(" Adding client {0}".format(original_client_id))
session.add(Client(id=id_offset,
gender=XM2VTSWrapper.get_gender(),
original_id = original_client_id,
original_database = "xm2vts"
))
del xm2vts_clients
#Adding the clients from CUHK
cuhk_clients = CUHKWrapper.get_clients()
if verbose>=1: print('Adding CUHK clients to the database ...')
client_ids = range(len(cuhk_clients))
for id in client_ids:
id_offset += 1
original_client_id = cuhk_clients[id-1]
if verbose>=1: print(" Adding client {0}".format(original_client_id))
session.add(Client(id=id_offset,
gender=CUHKWrapper.get_gender_from_client_id(original_client_id),
original_id = original_client_id,
original_database = "cuhk"
))
if verbose>=1: print("Commiting changes of clients to db")
del cuhk_clients
session.commit();
def add_files(session, directory, annotations_file, verbose):
"""
Adds files with their respective information into the Database
:param session: DB session
:param directory: directory to the CASME2 directory containing the folders of subjects.
:param annotations_file: annotations for the dataset file path
:param verbose: whether or not to show some information on CLI
"""
return None
def create_tables(args):
"""Creates all necessary tables (only to be used at the first time)"""
from bob.db.base.utils import create_engine_try_nolock
engine = create_engine_try_nolock(args.type, args.files[0], echo=(args.verbose >= 2));
Client.metadata.create_all(engine)
File.metadata.create_all(engine)
Annotation.metadata.create_all(engine)
# Driver API
# ==========
def create(args):
"""Creates or re-creates this database"""
from bob.db.base.utils import session_try_nolock
dbfile = args.files[0]
if args.recreate:
if args.verbose and os.path.exists(dbfile):
print('unlinking %s...' % dbfile)
if os.path.exists(dbfile): os.unlink(dbfile)
if not os.path.exists(os.path.dirname(dbfile)):
os.makedirs(os.path.dirname(dbfile))
# the real work...
create_tables(args)
s = session_try_nolock(args.type, args.files[0], echo=(args.verbose >= 2))
add_clients(s, args.verbose)
#add_files(s, args.directory, args.annotdir, args.verbose)
#add_protocols(s, args.verbose)
#add_clientxprotocols(s, args.verbose)
s.commit()
s.close()
def add_command(subparsers):
"""Add specific subcommands that the action "create" can use"""
parser = subparsers.add_parser('create', help=create.__doc__)
parser.add_argument('-R', '--recreate', action='store_true', help='If set, I\'ll first erase the current database')
parser.add_argument('-v', '--verbose', action='count', help='Do SQL operations in a verbose way?')
parser.add_argument('-D', '--directory', metavar='DIR', default='../CASME2/Cropped/', help='The path to the directory containing the subjects folders, which have the frames')
parser.add_argument('--extension', metavar='STR', default='.jpg', help='The file extension of the image files from the CASME2 database')
parser.add_argument('-A', '--annotdir', metavar='DIR', default='bob/db/casme2/annotations.csv', help="Change the relative path to the directory containing the action_unit information file of the CASME2 database (defaults to %(default)s)")
parser.set_defaults(func=create) #action
......@@ -17,11 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Commands the CASIA NIR-VIS 2.0 database can respond to.
"""
Commands the CUHK-CUFS database can respond to.
"""
import os
import sys
from bob.db.base.driver import Interface as BaseInterface
def dumplist(args):
......@@ -74,29 +76,40 @@ def checkfiles(args):
return 0
class Interface(BaseInterface):
def name(self):
return 'voxforge'
return 'cuhk'
def version(self):
import pkg_resources # part of setuptools
import pkg_resources # part of setuptools
return pkg_resources.require('bob.db.%s' % self.name())[0].version
def files(self):
return ()
from pkg_resources import resource_filename
raw_files = ('db.sql3',)
return [resource_filename(__name__, k) for k in raw_files]
def type(self):
return 'text'
return 'sqlite'
def add_commands(self, parser):