Commit dae95772 authored by Laurent EL SHAFEY's avatar Laurent EL SHAFEY

Update directory structure to the currently distributed one (cf. ticket #1)

parent 697ffbb0
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
BANCA Database BANCA Database
================ ================
This package contains the access API and descriptions for the `BANCA
This package contains the access API and descriptions for the `BANCA English
Database <http://www.ee.surrey.ac.uk/CVSSP/banca/>`_. The actual raw data for Database <http://www.ee.surrey.ac.uk/CVSSP/banca/>`_. The actual raw data for
the database should be downloaded from the original URL. This package only the database should be downloaded from the original URL. This API is only
compatible with the images from the BANCA English database. This package only
contains the `Bob <http://www.idiap.ch/software/bob/>`_ accessor methods to use contains the `Bob <http://www.idiap.ch/software/bob/>`_ accessor methods to use
the DB directly from python, with our certified protocols. the DB directly from python, with our certified protocols.
......
...@@ -10,6 +10,10 @@ import os ...@@ -10,6 +10,10 @@ import os
from .models import * from .models import *
def nodot(item):
"""Can be used to ignore hidden files, starting with the . character."""
return item[0] != '.'
def add_files(session, imagedir, verbose): def add_files(session, imagedir, verbose):
"""Add files (and clients) to the BANCA database.""" """Add files (and clients) to the BANCA database."""
...@@ -27,10 +31,12 @@ def add_files(session, imagedir, verbose): ...@@ -27,10 +31,12 @@ def add_files(session, imagedir, verbose):
if verbose: print "Adding file '%s'..." %(os.path.basename(filename).split('.')[0], ) if verbose: print "Adding file '%s'..." %(os.path.basename(filename).split('.')[0], )
session.add(File(int(v[0]), os.path.basename(filename).split('.')[0], v[4], v[6], session_id)) session.add(File(int(v[0]), os.path.basename(filename).split('.')[0], v[4], v[6], session_id))
file_list = os.listdir(imagedir) subdir_list = filter(nodot, os.listdir(imagedir))
client_dict = {} client_dict = {}
for filename in file_list: for subdir in subdir_list:
add_file(session, os.path.join(imagedir, filename), client_dict, verbose) file_list = filter(nodot, os.listdir(os.path.join(imagedir, subdir)))
for filename in file_list:
add_file(session, os.path.join(imagedir, filename), client_dict)
def add_subworlds(session, verbose): def add_subworlds(session, verbose):
"""Adds splits in the world set, based on the client ids""" """Adds splits in the world set, based on the client ids"""
...@@ -207,7 +213,7 @@ def add_command(subparsers): ...@@ -207,7 +213,7 @@ def add_command(subparsers):
parser.add_argument('-v', '--verbose', action='count', parser.add_argument('-v', '--verbose', action='count',
help="Do SQL operations in a verbose way") help="Do SQL operations in a verbose way")
parser.add_argument('-D', '--imagedir', action='store', metavar='DIR', parser.add_argument('-D', '--imagedir', action='store', metavar='DIR',
default='/idiap/group/vision/visidiap/databases/banca/english/images_gray', default='/idiap/group/biometric/databases/banca/english/images/images/',
help="Change the relative path to the directory containing the images of the BANCA database (defaults to %(default)s)") help="Change the relative path to the directory containing the images of the BANCA database (defaults to %(default)s)")
parser.set_defaults(func=create) #action parser.set_defaults(func=create) #action
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment