Example #1
0
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, dbfile, echo=(args.verbose > 2))
  add_clients(s, args.verbose)
  add_files(s, args.imagedir, args.verbose)
  add_protocols(s, args.verbose)
  if args.annotsub:
    for subdir in args.annotsub:
      add_annotations(s, os.path.join(args.annotdir, subdir), args.verbose, True)
  else:
    add_annotations(s, args.annotdir, args.verbose)
  s.commit()
  s.close()
Example #2
0
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))

    # ASV protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'ASV_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    # CM protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'cm_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    # AS protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'as_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    s.commit()
    s.close()

    return 0
Example #3
0
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.protodir, args.verbose)
  add_real_lists(s, args.protodir, args.verbose)
  add_attack_lists(s, args.protodir, args.verbose)
  define_protocols(s, args.protodir, args.verbose)
  s.commit()
  s.close()

  return 0
Example #4
0
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.protodir, args.verbose)
    add_real_lists(s, args.protodir, args.verbose)
    add_attack_lists(s, args.protodir, args.verbose)
    define_protocols(s, args.protodir, args.verbose)
    s.commit()
    s.close()

    return 0
Example #5
0
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_files(s, args.basedir, args.verbose)
    add_people(s, args.basedir, args.verbose)
    add_pairs(s, args.basedir, args.verbose)
    if 'idiap' in args.annotation_types:
        add_annotations(s, args.idiap_annotation_dir, '.pos', 'idiap',
                        args.verbose)
    if 'funneled' in args.annotation_types:
        add_annotations(s, args.funneled_annotation_dir, '.jpg.pts',
                        'funneled', args.verbose)

    s.commit()
    s.close()
Example #6
0
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, dbfile, echo=(args.verbose > 2))
    add_clients(s, args.verbose)
    add_files(s, args.imagedir, args.verbose)
    add_protocols(s, args.verbose)
    if args.annotsub:
        for subdir in args.annotsub:
            add_annotations(s, os.path.join(args.annotdir, subdir),
                            args.verbose, True)
    else:
        add_annotations(s, args.annotdir, args.verbose)
    s.commit()
    s.close()
Example #7
0
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))

    # ASV protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'ASV_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    # CM protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'cm_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    # AS protocol files
    protocol_file_list = glob.glob(os.path.join(args.protodir, 'as_*'))
    init_database(s, args.protodir, args.samplesdir, protocol_file_list)

    s.commit()
    s.close()

    return 0
Example #8
0
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.subjectlist, args.verbose)
    add_subworlds(s, args.verbose)
    add_files(s, args.imagedir, not args.noilluminations, args.poses,
              args.expressions, args.highresolutions, args.verbose)
    add_protocols(s, not args.noilluminations, args.poses, args.expressions,
                  args.highresolutions, args.verbose)
    s.commit()
    s.close()
Example #9
0
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_files(s, args.basedir, args.verbose)
  add_people(s, args.basedir, args.verbose)
  add_pairs(s, args.basedir, args.verbose)
  if 'idiap' in args.annotation_types:
    add_annotations(s, args.idiap_annotation_dir, '.pos', 'idiap', args.verbose)
  if 'funneled' in args.annotation_types:
    add_annotations(s, args.funneled_annotation_dir, '.jpg.pts', 'funneled', args.verbose)

  s.commit()
  s.close()
Example #10
0
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)
  session = session_try_nolock(args.type, args.files[0], echo=(args.verbose > 2))

  
  if args.verbose:  print("Generating the metadata files")
  generate_metadata(args.directory)
  

  files = add_files(session, args.directory, args.verbose)
  add_protocols_search(session, files, args.directory, args.verbose, args.logs)
  add_protocols_comparison(session, files, args.directory, args.verbose, args.logs)
  
  add_protocols(session, templates, args.directory, args.verbose, args.logs)  
  
  session.commit()
  session.close()
Example #11
0
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))

    #first, get list of protocol-dictionaries via construct_protocol()
    protocol_list = []
    protocol_files = [
        'clients_fold1.txt', 'clients_fold2.txt', 'clients_fold3.txt',
        'clients_fold4.txt', 'clients_fold5.txt'
    ]
    foldDir = 'bob/db/msu_mfsd_mod/folds'  #args.protodir

    for fn, foldFilename in enumerate(protocol_files):
        protocol = construct_protocol(fn + 1, foldFilename, foldDir,
                                      args.verbose)
        protocol_list.append(protocol)
    #fill in the Client table
    add_clients(s, protocol_list)

    #fill in the File table
    real_list = 'bob/db/msu_mfsd_mod/folds/msu_mfsd_mod_realvids.txt'
    attack_list = 'bob/db/msu_mfsd_mod/folds/msu_mfsd_mod_attackvids.txt'
    add_files(s, real_list, attack_list, args.verbose)

    s.commit()
    s.close()

    return 0
Example #12
0
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_all_elements(s, args.directory, args.extension, args.poses, args.verbose)
  s.commit()
  s.close()
Example #13
0
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_all_elements(s, args.directory, args.extension, args.poses,
                     args.verbose)
    s.commit()
    s.close()
Example #14
0
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))
  file_dict, client_dict = add_files(s, os.path.join(args.datadir, 'all_files.lst'), args.verbose)
  add_protocols(s, os.path.join(args.datadir, 'protocols'), file_dict, client_dict, args.verbose)
  s.commit()
  s.close()
Example #15
0
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.subjectlist, args.verbose)
  add_subworlds(s, args.verbose)
  add_files(s, args.imagedir, not args.noilluminations, args.poses, args.expressions, args.highresolutions, args.verbose)
  add_protocols(s, not args.noilluminations, args.poses, args.expressions, args.highresolutions, args.verbose)
  s.commit()
  s.close()
Example #16
0
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))
    file_dict, model_dict = add_files(
        s, os.path.join(args.datadir, 'all_files.lst'), args.verbose)
    add_protocols(s, os.path.join(args.datadir, 'protocols'), file_dict,
                  model_dict, args.verbose)
    s.commit()
    s.close()
Example #17
0
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)
    client_files = add_files(s, args.verbose)

    add_annotations(s, args.annotation_dir, args.verbose)

    add_search_protocols(s, args.verbose, client_files)

    add_verification_protocols(s,
                               args.verbose,
                               client_files['arface'],
                               protocol_name="arface",
                               n_train=44,
                               n_dev=40,
                               n_test=39)

    add_verification_protocols(s,
                               args.verbose,
                               client_files['xm2vts'],
                               protocol_name="xm2vts",
                               n_train=118,
                               n_dev=88,
                               n_test=89)

    add_verification_protocols(s,
                               args.verbose,
                               client_files['cuhk'],
                               protocol_name="cuhk",
                               n_train=75,
                               n_dev=56,
                               n_test=57)

    add_verification_protocols(
        s,
        args.verbose,
        dict(client_files['cuhk'].items() + client_files['arface'].items() +
             client_files['xm2vts'].items()),
        protocol_name="all-mixed",
        n_train=237,
        n_dev=184,
        n_test=185)

    s.commit()
    s.close()