Commit 9a20cafd authored by Tiago Pereira's avatar Tiago Pereira

[pep8] 4 spaces

parent 286236ee
......@@ -38,7 +38,7 @@ import os
Base = declarative_base()
""" Defining protocols. Yes, they are static """
#PROTOCOLS = ('cuhk_p2s', 'arface_p2s', 'xm2vts_p2s', 'all-mixed_p2s', 'cuhk-arface-xm2vts_p2s', 'cuhk-xm2vts-arface_p2s',
# 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')
......@@ -46,131 +46,124 @@ Base = declarative_base()
PROTOCOLS = ('cuhk_p2s', 'arface_p2s', 'xm2vts_p2s', 'all-mixed_p2s',
'cuhk_s2p', 'arface_s2p', 'xm2vts_s2p', 'all-mixed_s2p',
'search_split1_p2s','search_split2_p2s','search_split3_p2s','search_split4_p2s','search_split5_p2s',
'search_split1_s2p','search_split2_s2p','search_split3_s2p','search_split4_s2p','search_split5_s2p')
'search_split1_p2s', 'search_split2_p2s', 'search_split3_p2s', 'search_split4_p2s', 'search_split5_p2s',
'search_split1_s2p', 'search_split2_s2p', 'search_split3_s2p', 'search_split4_s2p', 'search_split5_s2p')
GROUPS = ('world', 'dev', 'eval')
GROUPS = ('world', 'dev', 'eval')
PURPOSES = ('train', 'enroll', 'probe')
PURPOSES = ('train', 'enroll', 'probe')
class Protocol_File_Association(Base):
"""
Describe the protocols
"""
__tablename__ = 'protocol_file_association'
"""
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)
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)
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
#self.client_id = client_id
# 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
# self.client_id = client_id
class Client(Base):
"""
Information about the clients (identities) of the CUHK-CUFS.
"""
__tablename__ = 'client'
"""
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')
# 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))
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 __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)
def __repr__(self):
return "<Client({0}, {1}, {2})>".format(self.id, self.original_database, self.original_id)
class Annotation(Base):
"""
The CUHK-CUFS provides 35 coordinates.
To model this coordinates this table was built.
The columns are the following:
- Annotation.id
- x
- y
"""
__tablename__ = 'annotation'
file_id = Column(Integer, ForeignKey('file.id'), primary_key=True)
x = Column(Integer, primary_key=True)
y = Column(Integer, primary_key=True)
index = Column(Integer)
def __init__(self, file_id, x,y, index=0):
self.file_id = file_id
self.x = x
self.y = y
self.index = index
def __repr__(self):
return "<Annotation(file_id:{0}, index:{1}, y={2}, x={3})>".format(self.file_id, self.index, self.y, self.x)
"""
The CUHK-CUFS provides 35 coordinates.
To model this coordinates this table was built.
The columns are the following:
- Annotation.id
- x
- y
"""
__tablename__ = 'annotation'
file_id = Column(Integer, ForeignKey('file.id'), primary_key=True)
x = Column(Integer, primary_key=True)
y = Column(Integer, primary_key=True)
index = Column(Integer)
def __init__(self, file_id, x, y, index=0):
self.file_id = file_id
self.x = x
self.y = y
self.index = index
def __repr__(self):
return "<Annotation(file_id:{0}, index:{1}, y={2}, x={3})>".format(self.file_id, self.index, self.y, self.x)
class File(Base, bob.db.base.File):
"""
Information about the files of the CUHK-CUFS database.
Each file includes
* the client id
"""
__tablename__ = 'file'
modality_choices = ('photo', 'sketch')
id = Column(String(100), primary_key=True, autoincrement=True)
path = Column(String(100), unique=True)
client_id = Column(Integer, ForeignKey('client.id'))
modality = Column(Enum(*modality_choices))
# a back-reference from the client class to a list of files
client = relationship("Client", backref=backref("files", order_by=id))
all_annotations = relationship("Annotation", backref=backref("file"), uselist=True, order_by=Annotation.index)
def __init__(self, id, image_name, client_id, modality):
# call base class constructor
bob.db.base.File.__init__(self, file_id = id, path = image_name)
self.client_id = client_id
self.modality = modality
def annotations(self, annotation_type="eyes_center"):
if annotation_type=="eyes_center":
return {'reye' : (self.all_annotations[16].y, self.all_annotations[16].x), 'leye' : (self.all_annotations[18].y, self.all_annotations[18].x) }
else:
data = {}
for i in range(len(self.all_annotations)):
a = self.all_annotations[i]
data[i] = (a.y, a.x)
return data
"""
Information about the files of the CUHK-CUFS database.
Each file includes
* the client id
"""
__tablename__ = 'file'
modality_choices = ('photo', 'sketch')
id = Column(String(100), primary_key=True, autoincrement=True)
path = Column(String(100), unique=True)
client_id = Column(Integer, ForeignKey('client.id'))
modality = Column(Enum(*modality_choices))
# a back-reference from the client class to a list of files
client = relationship("Client", backref=backref("files", order_by=id))
all_annotations = relationship("Annotation", backref=backref("file"), uselist=True, order_by=Annotation.index)
def __init__(self, id, image_name, client_id, modality):
# call base class constructor
bob.db.base.File.__init__(self, file_id=id, path=image_name)
self.client_id = client_id
self.modality = modality
def annotations(self, annotation_type="eyes_center"):
if annotation_type == "eyes_center":
return {'reye': (self.all_annotations[16].y, self.all_annotations[16].x),
'leye': (self.all_annotations[18].y, self.all_annotations[18].x)}
else:
data = {}
for i in range(len(self.all_annotations)):
a = self.all_annotations[i]
data[i] = (a.y, a.x)
return data
This diff is collapsed.
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