class Client(Base): """Database clients, marked by an integer identifier and the group they belong to""" __tablename__ = 'client' # Key identifier for the client id = Column(Integer, primary_key=True) # Group to which the client belongs to group_choices = ('dev', 'eval', 'world') sgroup = Column(Enum(*group_choices)) # do NOT use group (SQL keyword) # Birthyear of the client birthyear = Column(Integer) # Gender to which the client belongs to gender_choices = ('m', 'f') gender = Column(Enum(*gender_choices)) # Does he has a beard? beard = Column(Boolean) # Does he has a moustache? moustache = Column(Boolean) # Does he has glasses? glasses = Column(Boolean) def __init__(self, id, group, birthyear, gender, beard, moustache, glasses): self.id = id self.sgroup = group self.birthyear = birthyear self.gender = gender self.beard = beard self.moustache = moustache self.glasses = glasses def __repr__(self): return "Client(%d, '%s')" % (self.id, self.sgroup)
class Client(Base): """Database clients, marked by an integer identifier and the group they belong to""" __tablename__ = 'client' # Key identifier for the client id = Column(Integer, primary_key=True) # Gender to which the client belongs to gender_choices = ('m', 'f') gender = Column(Enum(*gender_choices)) # Group to which the client belongs to group_choices = ('g1', 'g2', 'world') sgroup = Column(Enum(*group_choices)) # do NOT use group (SQL keyword) # Language spoken by the client language_choices = ('en', ) language = Column(Enum(*language_choices)) def __init__(self, id, gender, group, language): self.id = id self.gender = gender self.sgroup = group self.language = language def __repr__(self): return "Client(%d, '%s', '%s', '%s')" % (self.id, self.gender, self.sgroup, self.language)
class File(Base, bob.db.verification.utils.File): """Generic file container""" __tablename__ = 'file' # Key identifier for the file id = Column(Integer, primary_key=True) # Key identifier of the client associated with this file client_id = Column(Integer, ForeignKey('client.id')) # for SQL # Unique path to this file inside the database path = Column(String(100), unique=True) # Session identifier session_id = Column(Integer) # Shot identifier shot_id = Column(Integer) # Finger identifier - left/right, index/middle finger_choices = ('li', 'lm', 'ri', 'rm') finger = Column(Enum(*finger_choices)) # Sensor identifier sensor_choices = ('optical', 'thermal') sensor = Column(Enum(*sensor_choices)) # For Python: A direct link to the client object that this file belongs to client = relationship("Client", backref=backref("files", order_by=id)) def __init__(self, client_id, path, session_id, shot_id, finger, sensor): # call base class constructor bob.db.verification.utils.File.__init__(self, client_id=client_id, path=path) self.session_id = session_id self.shot_id = shot_id self.finger = finger self.sensor = sensor
class Client(Base): """ Information about the clients (identities) of the CUHK-CUFS. """ __tablename__ = 'client' # We define the possible values for the member variables as STATIC class variables gender_choices = ('man', 'woman', 'none') database_choices = ('cuhk', 'arface', 'xm2vts') id = Column(Integer, primary_key=True) original_id = Column(Integer) original_database = Column(Enum(*database_choices)) gender = Column(Enum(*gender_choices)) def __init__(self, id, gender, original_id, original_database): self.id = id self.gender = gender self.original_id = original_id self.original_database = original_database def __repr__(self): return "<Client({0}, {1}, {2})>".format(self.id, self.original_database, self.original_id)
class Client(Base): """Database clients, marked by an integer identifier and the set they belong to""" __tablename__ = 'client' gender_choices = ('male', 'female', 'undefined') """Male or female speech""" group_choices = ('train', 'dev', 'eval') """Possible groups to which clients may belong to""" id = Column(String, primary_key=True) """Key identifier for clients""" gender = Column(Enum(*gender_choices)) """The gender of the subject""" group = Column(Enum(*group_choices)) """Group to which this client belongs to""" def __init__(self, id, gender, group): self.id = id self.gender = gender self.group = group def __repr__(self): return "Client('%s', '%s', '%s')" % (self.id, self.gender, self.group)
class Client(Base): """Database clients, marked by an integer identifier and the group they belong to""" __tablename__ = 'client' # Key identifier for the client id = Column(Integer, primary_key=True) # Gender to which the client belongs to gender_choices = ('female', 'male') gender = Column(Enum(*gender_choices)) # Group to which the client belongs to group_choices = ('dev', 'eval', 'world') sgroup = Column(Enum(*group_choices)) # do NOT use group (SQL keyword) # Institute to which the client belongs to institute_choices = ('idiap', 'manchester', 'surrey', 'oulu', 'brno', 'avignon') institute = Column(Enum(*institute_choices)) def __init__(self, id, group, gender, institute): self.id = id self.sgroup = group self.gender = gender self.institute = institute def __repr__(self): return "Client('%d', '%s')" % (self.id, self.sgroup)
class ProtocolPurpose(Base): """SCface protocol purposes""" __tablename__ = 'protocolPurpose' # Unique identifier for this protocol purpose object id = Column(Integer, primary_key=True) # Id of the protocol associated with this protocol purpose object protocol_id = Column(Integer, ForeignKey('protocol.id')) # for SQL # Group associated with this protocol purpose object group_choices = ('world', 'dev', 'eval') sgroup = Column(Enum(*group_choices)) # Purpose associated with this protocol purpose object purpose_choices = ('train', 'enroll', 'probe') purpose = Column(Enum(*purpose_choices)) # For Python: A direct link to the Protocol object that this ProtocolPurpose belongs to protocol = relationship("Protocol", backref=backref("purposes", order_by=id)) # For Python: A direct link to the File objects associated with this ProtcolPurpose files = relationship("File", secondary=protocolPurpose_file_association, backref=backref("protocol_purposes", order_by=id)) def __init__(self, protocol_id, sgroup, purpose): self.protocol_id = protocol_id self.sgroup = sgroup self.purpose = purpose def __repr__(self): return "ProtocolPurpose('%s', '%s', '%s')" % ( self.protocol.name, self.sgroup, self.purpose)
class Subset(Base): """VERA protocol subsets""" __tablename__ = 'subset' id = Column(Integer, primary_key=True) protocol_id = Column(Integer, ForeignKey('protocol.id')) protocol = relationship("Protocol", backref=backref("subsets")) group_choices = ('train', 'dev', 'eval') group = Column(Enum(*group_choices)) purpose_choices = ('train', 'enroll', 'probe') purpose = Column(Enum(*purpose_choices)) files = relationship("File", secondary=subset_file_association, backref=backref("subsets")) avoid_self_probe = Column(Boolean, default=False) def __init__(self, protocol, group, purpose): self.protocol = protocol self.group = group self.purpose = purpose def __repr__(self): return "Subset(%s, %s, %s)" % (self.protocol, self.group, self.purpose)
class Client(Base): """Database clients, marked by an integer identifier and the set they belong to""" __tablename__ = 'client' gender_choices = ('male', 'female') """Male or female speech""" set_choices = ('train', 'devel', 'test') """Possible groups to which clients may belong to""" id = Column(Integer, primary_key=True) """Key identifier for clients""" gender = Column(Enum(*gender_choices)) """The gender of the subject""" set = Column(Enum(*set_choices)) """Set to which this client belongs to""" def __init__(self, id, gender, set): self.id = id self.gender = gender self.set = set def __repr__(self): return "Client('%d', '%s', '%s')" % (self.id, self.gender, self.set)
class Protocol(Base): """The protocols of the AR face database.""" __tablename__ = 'protocol' protocol_choices = ('all', 'expression', 'illumination', 'occlusion', 'occlusion_and_illumination') id = Column(Integer, primary_key=True) name = Column(Enum(*protocol_choices)) session = Column(Enum(*File.session_choices), ForeignKey('file.session')) expression = Column(Enum(*File.expression_choices), ForeignKey('file.expression')) illumination = Column(Enum(*File.illumination_choices), ForeignKey('file.illumination')) occlusion = Column(Enum(*File.occlusion_choices), ForeignKey('file.occlusion')) def __init__(self, protocol, session, expression='neutral', illumination='front', occlusion='none'): self.name = protocol self.session = session self.expression = expression self.illumination = illumination self.occlusion = occlusion def __repr__(self): return "<Protocol('%s', '%s', '%s', '%s', '%s')>" % ( self.name, self.session, self.expression, self.illumination, self.occlusion)
class File(Base, bob.db.base.File): """Information about the files of the AR face database. Each file includes * the session (first, second) * the expression (neutral, smile, anger, scream) * the illumination (front, left, right, all) * the occlusion (none, sunglasses, scarf) * the client id """ __tablename__ = 'file' # We define the possible values for the member variables as STATIC class # variables session_choices = ('first', 'second') purpose_choices = ('enroll', 'probe') expression_choices = ('neutral', 'smile', 'anger', 'scream') illumination_choices = ('front', 'left', 'right', 'all') occlusion_choices = ('none', 'sunglasses', 'scarf') id = Column(String(100), primary_key=True) path = Column(String(100), unique=True) client_id = Column(String(100), ForeignKey('client.id')) session = Column(Enum(*session_choices)) purpose = Column(Enum(*purpose_choices)) expression = Column(Enum(*expression_choices)) illumination = Column(Enum(*illumination_choices)) occlusion = Column(Enum(*occlusion_choices)) # a back-reference from the client class to a list of files client = relationship("Client", backref=backref("files", order_by=id)) annotation = relationship("Annotation", backref=backref("file"), uselist=False) def __init__(self, image_name): # call base class constructor bob.db.base.File.__init__(self, path=image_name, file_id=image_name) self.client_id = image_name[:5] # get shot id shot_id = int(os.path.splitext(image_name)[0][6:]) # automatically fill member variables according to shot id self.session = self.session_choices[int((shot_id - 1) / 13)] shot_id = (shot_id - 1) % 13 + 1 self.purpose = self.purpose_choices[0 if shot_id == 1 else 1] self.expression = self.expression_choices[shot_id - 1] if shot_id in ( 2, 3, 4) else self.expression_choices[0] self.illumination = self.illumination_choices[shot_id - 4] if shot_id in (5, 6, 7) else \ self.illumination_choices[shot_id - 8] if shot_id in (9, 10) else \ self.illumination_choices[shot_id - 11] if shot_id in (12, 13) else \ self.illumination_choices[0] self.occlusion = self.occlusion_choices[1] if shot_id in (8, 9, 10) else \ self.occlusion_choices[2] if shot_id in (11, 12, 13) else \ self.occlusion_choices[0]
class Attack(Base): """Defines Spoofing Attacks (illicit attempts to authenticate)""" __tablename__ = 'attack' attack_support_choices = ('fixed', 'hand') """Types of attack support""" attack_device_choices = ('print', 'mattescreen') """Types of devices used for spoofing""" sample_type_choices = ('video', 'photo') """Original sample type""" type_device = ('mobile', 'tablet') """List of devices""" id = Column(Integer, primary_key=True) """Unique identifier for this attack""" file_id = Column(Integer, ForeignKey('file.id')) # for SQL """The file identifier this attack is linked to""" attack_support = Column(Enum(*attack_support_choices)) """The attack support""" attack_device = Column(Enum(*attack_device_choices)) """The attack device""" sample_type = Column(Enum(*sample_type_choices)) """The attack sample type""" sample_device = Column(Enum(*type_device)) """The attack sample device""" # for Python file = relationship(File, backref=backref('attack', order_by=id)) """A direct link to the :py:class:`.File` object bound to this attack""" protocols = relationship("Protocol", secondary=attacks_protocols, backref='attacks') """A direct link to the protocols this file is linked to""" def __init__(self, file, attack_support, attack_device, sample_type, sample_device): self.file = file self.attack_support = attack_support self.attack_device = attack_device self.sample_type = sample_type self.sample_device = sample_device def __repr__(self): return "<Attack('%s')>" % (self.file.path)
class Client(Base): """Database clients, marked by an integer identifier and the set they belong to""" __tablename__ = 'client' # NOTE: the following 2 '_choices' tuples are only for information; they are not directly used for adding fields to the client-Table. group_choices = ('train', 'devel', 'test') fold_choices = ('fold1', 'fold2', 'fold3', 'fold4', 'fold5') fold1_choices = group_choices # ('train', 'devel', 'test') """Possible groups to which clients may belong to""" fold2_choices = group_choices # ('train', 'devel', 'test') fold3_choices = group_choices # ('train', 'devel', 'test') fold4_choices = group_choices # ('train', 'devel', 'test') fold5_choices = group_choices # ('train', 'devel', 'test') # group_choices = ('train', 'devel', 'test') id = Column(Integer, primary_key=True) """Key identifier for clients""" client_fold1 = Column(Enum(*fold1_choices)) """ Client's group in this fold. """ client_fold2 = Column(Enum(*fold2_choices)) """ Client's group in this fold. """ client_fold3 = Column(Enum(*fold3_choices)) """ Client's group in this fold. """ client_fold4 = Column(Enum(*fold4_choices)) """ Client's group in this fold. """ client_fold5 = Column(Enum(*fold5_choices)) """ Client's group in this fold. """ def __init__(self, client_num, client_fold1, client_fold2, client_fold3, client_fold4, client_fold5): self.id = client_num self.client_fold1 = client_fold1 self.client_fold2 = client_fold2 self.client_fold3 = client_fold3 self.client_fold4 = client_fold4 self.client_fold5 = client_fold5 def __repr__(self): return "<Client('%s', '%s', '%s', '%s', '%s', '%s')>" % ( self.id, self.client_fold1, self.client_fold2, self.client_fold3, self.client_fold4, self.client_fold5)
class File(Base, bob.db.base.File): """Generic file container""" __tablename__ = 'file' # Key identifier for the file id = Column(Integer, primary_key=True) # Key identifier of the client associated with this file client_id = Column(Integer, ForeignKey('client.id')) # for SQL # Unique path to this file inside the database path = Column(String(100), unique=True) # Session identifier session_id = Column(Integer) # Camera identifier camera_choices = ('ca0', 'caf', 'wc') camera = Column(Enum(*camera_choices)) # Shot identifier shot_id = Column(Integer) # for Python client = relationship("Client", backref=backref("files", order_by=id)) annotation = relationship("Annotation", backref=backref("file"), uselist=False) def __init__(self, client_id, path, session_id, camera, shot_id): # call base class constructor bob.db.base.File.__init__(self, path=path) self.client_id = client_id self.session_id = session_id self.camera = camera self.shot_id = shot_id
class Client(Base): """Database clients, marked by an integer identifier. Each client entry represents a single humans hand, in this way database entries are doubled. """ __tablename__ = 'client' # Key identifier for the client id = Column(Integer, primary_key=True) original_client_id = Column(Integer) # Other Client atributes: #gender_choices = ('M', 'F') #gender = Column(Enum(*gender_choices)) hand_choices = ('L', 'R') hand = Column(Enum(*hand_choices)) def __init__(self, original_client_id, hand): # gender, """ Client constructor """ self.original_client_id = original_client_id #self.gender = gender self.hand = hand def __repr__(self): return "Client(assigned SQL id = {}, original client id = {}, hand = {})".format( self.id, self.original_client_id, self.hand)
class Pair(Base): """Information of the pairs (as given in the pairs.txt files) of the LFW database.""" __tablename__ = 'pair' id = Column(Integer, primary_key=True) # train and test for view1, the folds for view2 protocol = Column( Enum('train', 'test', 'fold1', 'fold2', 'fold3', 'fold4', 'fold5', 'fold6', 'fold7', 'fold8', 'fold9', 'fold10', 'view2')) enroll_file_id = Column(String(100), ForeignKey('file.id')) probe_file_id = Column(String(100), ForeignKey('file.id')) enroll_file = relationship("File", backref=backref("enroll_files", order_by=id), primaryjoin="Pair.enroll_file_id==File.id") probe_file = relationship("File", backref=backref("probe_files", order_by=id), primaryjoin="Pair.probe_file_id==File.id") is_match = Column(Boolean) def __init__(self, protocol, enroll_file_id, probe_file_id, is_match): self.protocol = protocol self.enroll_file_id = enroll_file_id self.probe_file_id = probe_file_id self.is_match = is_match def __repr__(self): return "<Pair('%s', '%s', '%s', '%d')>" % ( self.protocol, self.enroll_file_id, self.probe_file_id, 1 if self.is_match else 0)
class File(Base, bob.db.verification.utils.File): """Generic file container""" __tablename__ = 'file' # Key identifier for the file id = Column(Integer, primary_key=True) # Key identifier of the client associated with this file client_id = Column(Integer, ForeignKey('client.id')) # for SQL # Unique path to this file inside the database path = Column(String(100), unique=True) # Session identifier session_id = Column(Integer) # Whether it is a darkened image (left 'l' or right 'r') or not 'n' darkened = Column(Enum('n', 'l', 'r')) # none, left, right # Shot identifier shot_id = Column(Integer) # For Python: A direct link to the client object that this file belongs to client = relationship("Client", backref=backref("files", order_by=id)) annotation = relationship("Annotation", backref=backref("file", order_by=id, uselist=False), uselist=False) def __init__(self, client_id, path, session_id, darkened, shot_id): # call base class constructor bob.db.verification.utils.File.__init__(self, client_id=client_id, path=path) self.session_id = session_id self.darkened = darkened self.shot_id = shot_id
class RealAccess(Base): """Defines Real-Accesses (licit attempts to authenticate)""" __tablename__ = 'realaccess' purpose_choices = ('authenticate', 'enroll') """Types of purpose for this video""" id = Column(Integer, primary_key=True) """Unique identifier for this real-access object""" file_id = Column(Integer, ForeignKey('file.id')) # for SQL """The file identifier the current real-access is bound to""" purpose = Column(Enum(*purpose_choices)) """The purpose of this video""" take = Column(Integer) """Take number""" # for Python file = relationship(File, backref=backref('realaccess', order_by=id)) """A direct link to the :py:class:`.File` object this real-access belongs to""" protocols = relationship("Protocol", secondary=realaccesses_protocols, backref='realaccesses') """A direct link to the protocols this file is linked to""" def __init__(self, file, purpose, take): self.file = file self.purpose = purpose self.take = take def __repr__(self): return "RealAccess('%s')" % (self.file.path)
class Client(Base): """Unique clients in the database, referred by a single integer""" __tablename__ = 'client' id = Column(Integer, primary_key=True) gender_choices = ('M', 'F') gender = Column(Enum(*gender_choices)) age = Column(Integer) handedness_choices = ('R', 'L', 'X') handedness = Column(Enum(*handedness_choices)) publishable = Column(Boolean) daydiff = Column(Integer) comment = Column(String(41)) def __init__(self, id, gender, age, handedness, publishable, daydiff, comment): self.id = id self.gender = gender self.age = age self.handedness = handedness self.publishable = publishable self.daydiff = daydiff self.comment = comment def gender_display(self): """Returns a representation of the client gender""" return 'male' if self.gender == 'M' else 'female' def handedness_display(self): """Returns a representation of the client handedness""" return {'L': 'left', 'R': 'right', 'X': 'unknown'}[self.handedness] def __repr__(self): return "Client(%04d) <%s,%s>, %d years old" % \ (self.id, self.gender_display(), self.handedness_display(), self.age)
class File(Base, bob.db.base.File): """ NOTE:this interface is the variant of the CASME2 database which does not use the video files, but rather the ones converted into frames of images. (i.e. the ones in the "CROPPED" folder). As such, this folder is supposed to be an abstract representation of the video file - in this case, its a fodler containing the video frames. This is represent the video file directory containing the frames. * the emotions ('happiness', 'repression', 'disgust', 'surprise', 'sadness', 'others') for the client * the client id, in this case, each file is a frame in the video """ __tablename__ = 'file' # The definitions of the various emotions/expressions from the micro-expression databse in CASME2 emotion_choices = ('happiness', 'repression', 'disgust', 'surprise', 'sadness', 'fear', 'others') ###### COLUMNS ######### id = Column(Integer, primary_key=True, autoincrement=True) #path to the file directory, in this case - its the path to the folder containing the frames path = Column(String) #directory containing the video frames for the CASME2 database #client in the file client_id = Column(Integer, ForeignKey('client.id')) #emotion expressed in the file emotion = Column(Enum(*emotion_choices)) #onset of the emotion onset = Column(Integer) #apex of the emotion apex = Column(Integer) #offset of the emotions offset = Column(Integer) ##### RELATIONSHIPS ##### # a back-reference from the client class to a list of files client = relationship("Client", backref=backref("files", order_by=id)) def __init__(self, client_id, path, emotion, onset, apex, offset): # call base class constructor bob.db.base.File.__init__(self, path=path) self.client_id = client_id self.path = path self.emotion = emotion #emotion self.onset = onset #onset self.apex = apex #apex self.offset = offset #offset def __repr__(self): return "<File(filename:'%s', Client_id:'%s, emotion:'%s', onset: %d, apex: %d, offset: %d)>" % ( self.path, self.client_id, self.emotion, self.onset, self.apex, self.offset)
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) # client_id = Column('client_id', Integer, ForeignKey('client.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 File(Base, bob.db.base.File): """Generic file container""" __tablename__ = 'file' # Key identifier for the file id = Column(Integer, primary_key=True) # Key identifier of the client associated with this file client_id = Column(Integer, ForeignKey('client.id')) # for SQL # Unique path to this file inside the database path = Column(String(100), unique=True) # Identifier of the session session_id = Column(Integer) # Speech type speech_type_choices = ('p', 'l', 'r', 'f') speech_type = Column(Enum(*speech_type_choices)) # Identifier of the shot shot_id = Column(Integer) # Identifier of the environment environment_choices = ('i', 'o') environment = Column(Enum(*environment_choices)) # Identifier of the device device_choices = ('mobile', 'laptop') device = Column(Enum(*device_choices)) # Identifier of the channel channel_id = Column(Integer) # For Python: A direct link to the client object that this file belongs to client = relationship("Client", backref=backref("files", order_by=id)) def __init__(self, client_id, path, session_id, speech_type, shot_id, environment, device, channel_id): # call base class constructor bob.db.base.File.__init__(self, path=path) # fill the remaining bits of the file information self.client_id = client_id self.session_id = session_id self.speech_type = speech_type self.shot_id = shot_id self.environment = environment self.device = device self.channel_id = channel_id
class Client(Base): """Information about the clients (identities) of the AR face database""" __tablename__ = 'client' # We define the possible values for the member variables as STATIC class # variables gender_choices = ('m', 'w') group_choices = ('world', 'dev', 'eval') id = Column(String(100), primary_key=True) gender = Column(Enum(*gender_choices)) sgroup = Column(Enum(*group_choices)) def __init__(self, id, group): self.id = id self.gender = id[0:1] self.sgroup = group def __repr__(self): return "<Client('%s')>" % self.id
class Attack(Base): """Defines Spoofing Attacks (illicit attempts to authenticate)""" __tablename__ = 'attack' attack_support_choices = ('replay', 'voice_conversion', 'speech_synthesis') """Types of attacks support""" attack_device_choices = ('laptop', 'laptop_HQ_speaker', 'phone1', 'phone2', 'logical_access', 'physical_access', 'physical_access_HQ_speaker') """Types of devices and types of access used for spoofing""" id = Column(Integer, primary_key=True) """Unique identifier for this attack""" file_id = Column(Integer, ForeignKey('file.id')) # for SQL """The file identifier this attack is linked to""" attack_support = Column(Enum(*attack_support_choices)) """The attack support""" attack_device = Column(Enum(*attack_device_choices)) """The attack device""" # for Python file = relationship(File, backref=backref('attack', order_by=id)) """A direct link to the :py:class:`.File` object bound to this attack""" protocols = relationship("Protocol", secondary=attacks_protocols, backref='attack') """A direct link to the protocols this file is linked to""" def __init__(self, file, attack_support, attack_device): self.file = file self.attack_support = attack_support self.attack_device = attack_device def __repr__(self): return "Attack('%s')" % self.file.path
class Client(Base): """Information about the clients (identities) of the CAS-PEAL database""" __tablename__ = 'client' # We define the possible values for the member variables as STATIC class variables gender_choices = ('F', 'M') age_choices = ('Y', 'M', 'O') id = Column(Integer, primary_key=True) gender = Column(Enum(*gender_choices)) age = Column(Enum(*age_choices)) def __init__(self, client_type, client_id): """Creates a client name by parsing the given first two part of the filename""" assert client_type[0] in 'FM' assert client_type[1] in 'YMO' self.id = int(client_id) self.gender = client_type[0] self.age = client_type[1] def __repr__(self): return "<Client('%s%s_%06d')>" % (self.gender, self.age, self.id)
class Protocol(Base): """The protocol class stores both the protocol name, as well as the purpose.""" __tablename__ = 'protocol' protocol_choices = ('Good', 'Bad', 'Ugly') purpose_choices = ('enroll', 'probe') id = Column(Integer, primary_key=True) name = Column(Enum(*protocol_choices)) # one of the protocol names purpose = Column( Enum(*purpose_choices)) # one o the choices, enroll or probe # A direct link to the File objects associated with this Protocol files = relationship("File", secondary=protocol_file_association, backref=backref("protocols", order_by=id)) def __init__(self, name, purpose): self.name = name self.purpose = purpose def __repr__(self): return "<Protocol('%s', '%s')>" % (self.name, self.purpose)
class Protocol(Base): """The probe protocols of the CAS-PEAL database. Training and enrollment is identical for all protocols of CAS-PEAL.""" __tablename__ = 'protocol' # query protocols start from index 2 protocol_choices = ('training', 'gallery', 'accessory', 'aging', 'background', 'distance', 'expression', 'lighting', 'pose') id = Column(Integer, primary_key=True) name = Column(Enum(*protocol_choices)) def __init__(self, name): self.name = name def __repr__(self): return "<Protocol('%d', '%s')>" % (self.id, self.name)
class Client(Base): """Database clients, marked by an integer identifier and the group they belong to""" __tablename__ = 'client' # Key identifier for the client id = Column(String(100), primary_key=True) # Group to which the client belongs to # There is no separate training, development and evaluation group in XM2VTS. # They are split into client, impostorDev and impostorEval (resp. labeled # "impostor evaluation" and "impostor test" in the original paper describing the database) group_choices = ('world', 'clientDev', 'impostorDev', 'clientEval', 'impostorEval') sgroup = Column(Enum(*group_choices)) # do NOT use group (SQL keyword) type_choices = ('Genuine', 'Impostor') stype = Column(Enum(*type_choices)) def __init__(self, id, group, stype): self.id = id self.sgroup = group self.stype = stype def __repr__(self): return "Client(%d, '%s', '%s')" % (self.id, self.sgroup, self.stype)
class Client(Base): """Database clients, marked by an integer identifier and the group they belong to""" __tablename__ = 'client' # Key identifier for the client id = Column(String(20), primary_key=True) # speaker_pin gender_choices = ('male', 'female') gender = Column(Enum(*gender_choices)) def __init__(self, id, gender): self.id = id self.gender = gender def __repr__(self): return "Client(%s, %s)" % (self.id, self.gender)
class People(Base): """Information about the people (as given in the people.txt file) of the LFW database.""" __tablename__ = 'people' id = Column(Integer, primary_key=True) protocol = Column( Enum('train', 'test', 'fold1', 'fold2', 'fold3', 'fold4', 'fold5', 'fold6', 'fold7', 'fold8', 'fold9', 'fold10', 'view2')) file_id = Column(String(100), ForeignKey('file.id')) def __init__(self, protocol, file_id): self.protocol = protocol self.file_id = file_id def __repr__(self): return "<People('%s', '%s')>" % (self.protocol, self.file_id)