24 lines
841 B
Python
24 lines
841 B
Python
from database.database import db
|
|
|
|
class Annotation(db.Model):
|
|
__tablename__ = 'annotation'
|
|
|
|
annotation_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|
image_id = db.Column(db.Integer, db.ForeignKey('image.image_id', ondelete='CASCADE'), nullable=False)
|
|
x = db.Column(db.Float, nullable=False)
|
|
y = db.Column(db.Float, nullable=False)
|
|
height = db.Column(db.Float, nullable=False)
|
|
width = db.Column(db.Float, nullable=False)
|
|
Label = db.Column(db.String(255), nullable=False)
|
|
|
|
def to_dict(self):
|
|
return {
|
|
'annotation_id': self.annotation_id,
|
|
'image_id': self.image_id,
|
|
'x': self.x,
|
|
'y': self.y,
|
|
'height': self.height,
|
|
'width': self.width,
|
|
'Label': self.Label
|
|
}
|