Exemple #1
0
class Dataset(db.Model):
    __tablename__ = 'ai_dataset'

    id = db.Column(db.Integer, primary_key=True, nullable=False, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False, default="2020-01-01 00:00:00")
    dataset = db.Column(db.String(255), nullable=True)
    users = db.Column(db.Integer, nullable=True)
    version = db.Column(db.String(255), nullable=True)
    ai_agent = db.Column(db.String(255), nullable=True)

    def __init__(self, updated_on, dataset, users, ai_agent):
        self.updated_on = updated_on
        self.dataset = dataset
        self.users = users
        self.ai_agent = ai_agent

    def from_json(self, json):
        self.id = json.get('dataset_id', None)
        self.updated_on = json.get('updated_on', None)
        self.dataset = json.get("dataset", None)
        self.users = json.get("users", None)
        self.ai_agent = json.get("ai_agent", None)

        return self

    def to_dictionary(self):
        obj = {
            'dataset_id':self.id,
            'updated_on': self.updated_on,
            'dataset': self.dataset,
            'users': self.users,
            'ai_agent': self.ai_agent,
        }
        return obj
class Inference(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_inference"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False)
    agent_id = db.Column(db.Integer, db.ForeignKey('ai_agent.id'), nullable=True)
    file_name = db.Column(db.String(255), nullable=False)
    file_path = db.Column(db.String(255), nullable=False)
    tag = db.Column(db.String(255), nullable=False)
    model_id = db.Column(db.Integer, db.ForeignKey('ai_models.id'), nullable=False)
    camera_id = db.Column(db.Integer, db.ForeignKey('sys_camera.id'), nullable=False)
    dataset = db.Column(db.String(255), nullable=False)
    confidence = db.Column(db.Float, nullable=False)
    label = db.Column(db.String(255), nullable=False)


    def __init__(self, updated_on, agent_id, file_name, file_path, tag, model_id, camera_id, dataset, confidence, label):
        self.updated_on = updated_on
        self.agent_id = agent_id
        self.file_name = file_name
        self.file_path = file_path
        self.tag = tag
        self.model_id = model_id
        self.camera_id = camera_id
        self.dataset = dataset
        self.confidence = confidence
        self.label = label

    def from_json(self, json):
        self.id = json.get('inference_id', None)
        self.updated_on = json.get('updated_on', None)
        self.agent_id = json.get('agent_id', None)
        self.file_name = json.get('file_name', None)
        self.file_path = json.get('file_path', None)
        self.tag = json.get('tag', None)
        self.model_id = json.get('model_id', None)
        self.camera_id = json.get('camera_id', None)
        self.dataset = json.get('dataset', None)
        self.confidence = json.get('confidence', None)
        self.label = json.get('label', None)
        return self

    def to_dictionary(self):
        obj = {
            'id': self.id,
            'updated_on': self.updated_on,
            'agent_id': self.agent_id,
            'file_name': self.file_name,
            'file_path': self.file_path,
            'tag': self.tag,
            'model_id': self.model_id,
            'camera_id': self.camera_id,
            'dataset': self.dataset,
            'confidence': self.confidence,
            'label': self.label
        }
        return obj
Exemple #3
0
class Annotation(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_annotation"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False)
    image_id = db.Column(db.Integer, nullable=False)
    category_id = db.Column(db.Integer, nullable=False)
    segmentation = db.Column(db.String(255), nullable=False)
    bbox = db.Column(db.String(255), nullable=False)
    ignore = db.Column(db.Boolean, nullable=False)
    iscrowd = db.Column(db.Boolean, nullable=False)
    area = db.Column(db.Integer, nullable=False)

    def __init__(self, updated_on, image_id, category_id, segmentation, bbox,
                 ignore, iscrowd, area):
        self.updated_on = updated_on
        self.image_id = image_id
        self.category_id = category_id
        self.segmentation = segmentation
        self.bbox = bbox
        self.ignore = ignore
        self.iscrowd = iscrowd
        self.area = area

    def from_json(self, json):
        self.id = json.get('user_id', None)
        self.updated_on = json.get('updated_on', None)
        self.image_id = json.get('image_id', None)
        self.category_id = json.get('category_id', None)
        self.segmentation = json.get('segmentation', None)
        self.bbox = json.get('bbox', None)
        self.ignore = json.get('ignore', None)
        self.iscrowd = json.get('iscrowd', None)
        self.area = json.get('area', None)
        return self

    def to_dictionary(self):
        obj = {
            'annotation_id': self.id,
            'updated_on': self.updated_on,
            'image_id': self.image_id,
            'category_id': self.category_id,
            'segmentation': self.segmentation,
            'bbox': self.bbox,
            'ignore': self.ignore,
            'iscrowd': self.iscrowd,
            'area': self.area
        }
        return obj
class BlacklistToken(db.Model):
    """
    Token Model for storing JWT tokens
    """
    __tablename__ = 'blacklist_tokens'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    token = db.Column(db.String(500), unique=True, nullable=False)
    blacklisted_on = db.Column(db.DateTime(), nullable=False)

    def __init__(self, token):
        self.token = token
        self.blacklisted_on = datetime.datetime.now()

    def from_partial_json(self, dictionary):
        super(BlacklistToken, self).from_partial_json(dictionary)
        self.token = dictionary['token']
        self.blacklisted_on = datetime.datetime.now()
        return self

    def from_json(self, json):
        self.token = json.get('token', None)
        self.blacklisted_on = json.get('blacklisted_on', None)
        return self

    def to_dictionary(self):
        return {
            'token': self.token,
            'blacklisted_on': self.blacklisted_on,
        }

    @staticmethod
    def check_blacklist(auth_token):
        # check whether auth token has been blacklisted
        res = BlacklistToken.query.filter_by(token=str(auth_token)).first()
        if res:
            return True
        else:
            return False
Exemple #5
0
class Tag(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_tag"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False)
    tag_name = db.Column(db.String(255), unique=True, nullable=False)
    value = db.Column(db.Integer, nullable=False)
    description = db.Column(db.String(255), nullable=False)
    agent_id = db.Column(db.Integer,
                         db.ForeignKey('ai_agent.id'),
                         nullable=False)

    def __init__(self, updated_on, tag_name, value, description, agent_id):
        self.updated_on = updated_on
        self.tag_name = tag_name
        self.value = value
        self.description = description
        self.agent_id = agent_id

    def from_json(self, json):
        self.id = json.get('tag_id', None)
        self.updated_on = json.get('updated_on', None)
        self.tag_name = json.get('tag_name', None)
        self.value = json.get('value', None)
        self.description = json.get('description', None)
        self.agent_id = json.get('agent_id', None)
        return self

    def to_dictionary(self):
        obj = {
            'tag_id': self.id,
            'updated_on': self.updated_on,
            'tag_name': self.tag_name,
            'value': self.value,
            'description': self.description,
            'agent_id': self.agent_id
        }
        return obj
Exemple #6
0
class Models(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_models"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=True)
    model_name = db.Column(db.String(255), nullable=True)
    model_path = db.Column(db.String(255), nullable=True)
    camera_id = db.Column(db.String(255), nullable=True)
    dataset = db.Column(db.String(255), nullable=True)

    def __init__(self, updated_on, model_name, model_path, camera_id, dataset):
        self.model_name = model_name
        self.updated_on = updated_on
        self.model_path = model_path
        self.camera_id = camera_id
        self.dataset = dataset

    def from_json(self, json):
        self.id = json.get('user_id', None)
        self.updated_on = json.get('updated_on', None)
        self.model_name = json.get('model_name', None)
        self.model_path = json.get('model_path', None)
        self.camera_id = json.get('camera_id', None)
        self.dataset = json.get('dataset', None)
        return self

    def to_dictionary(self):
        obj = {
            'model_id': self.id,
            'model_name': self.model_name,
            'updated_on': self.updated_on,
            'model_path': self.model_path,
            'camera_id': self.camera_id,
            'dataset': self.dataset
        }
        return obj
Exemple #7
0
class Category(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_category"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False)
    category_name = db.Column(db.String(255), unique=True, nullable=False)
    value = db.Column(db.Integer, nullable=False)
    description = db.Column(db.String(255), nullable=False)
    dataset = db.Column(db.Integer,  nullable=False)

    def __init__(self, updated_on, category_name, value, description, dataset):
        self.updated_on = updated_on
        self.category_name = category_name
        self.value = value
        self.description = description
        self.dataset = dataset

    def from_json(self, json):
        self.id = json.get('tag_id', None)
        self.updated_on = json.get('updated_on', None)
        self.category_name = json.get('category_name', None)
        self.value = json.get('value', None)
        self.description = json.get('description', None)
        self.dataset = json.get('dataset', None)
        return self

    def to_dictionary(self):
        obj = {
            'category_id': self.id,
            'updated_on': self.updated_on,
            'category_name': self.category_name,
            'value': self.value,
            'description': self.description,
            'dataset': self.dataset
        }
        return obj
Exemple #8
0
class User(db.Model):
    """ User Model for storing user related details """
    __tablename__ = "auth_users"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(255, collation='utf8_unicode_ci'), unique=True, nullable=False)
    email = db.Column(db.String(255), unique=True, nullable=False)
    password = db.Column(db.String(255), nullable=False)
    first_name = db.Column(db.String(255, collation='utf8_unicode_ci'), nullable=False)
    last_name = db.Column(db.String(255, collation='utf8_unicode_ci'), nullable=False)
    registered_on = db.Column(db.DateTime(), nullable=False)
    confirmed = db.Column(db.Boolean, nullable=False, default=False)
    confirmed_on = db.Column(db.DateTime, nullable=True)
    last_login_at = db.Column(db.DateTime())
    current_login_at = db.Column(db.DateTime())
    company = db.Column(db.String(255))
    title = db.Column(db.String(255))
    language = db.Column(db.String(255), nullable=False)
    admin_validation = db.Column(db.Boolean, nullable=False, default=False)
    location_id = db.Column(db.Integer, db.ForeignKey('auth_locations.id', ondelete='CASCADE'), nullable=True)
    roles = db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic'),
                            post_update=True)
    location = db.relationship(Location, primaryjoin=location_id == Location.id, post_update=True, uselist=False)

    def __init__(self, username, password, email, first_name, last_name, language='en', company=None,
                 title=None, confirmed=False, confirmed_on=None, admin_validation=False, roles='PENDING', location_id=1):
        self.username = username
        self.password = encrypt_password(password)
        self.email = email
        self.first_name = first_name
        self.last_name = last_name
        self.company = company
        self.title = title
        self.language = language
        self.registered_on = datetime.datetime.now()
        self.confirmed = confirmed
        self.confirmed_on = confirmed_on
        self.admin_validation = admin_validation
        self.location_id = location_id
        self.location = Location.query.filter_by(id=location_id).one()
        # role = Role.query.filter_by(name='ADMIN').one()
        self.roles = roles.query(roles).last()

        new_roles = []

        if roles is not None:
            if roles == 'ADMIN':
                role = Role.query.filter_by(name='ADMIN').one()
                new_roles.append(role)
            elif roles == 'ANNOTATOR':
                role = Role.query.filter_by(name='ANNOTATOR').one()
                new_roles.append(role)
            else:
                role = Role.query.filter_by(name='VIEWER').one()
                new_roles.append(role)
            self.roles = new_roles
        else:
            role = Role.query.filter_by(name='VIEWER').one()
            new_roles.append(role)
            self.roles = new_roles

    def from_partial_json(self, dictionary):
        super(User, self).from_partial_json(dictionary)
        if 'password' in dictionary:
            self.password = encrypt_password(dictionary.get('password'))
        self.registered_on = datetime.datetime.now()
        return self

    def from_json(self, json):
        self.id = json.get('user_id', None)
        self.email = json.get('email', None)
        self.password = json.get('password', None)
        self.first_name = json.get('first_name', None)
        self.last_name = json.get('last_name', None)
        self.roles = json.get('roles', None)
        return self

    def to_dictionary(self):
        obj = {
            'admin_validation': self.admin_validation,
            'user_id': self.id,
            'username': self.username,
            'email': self.email,
            'first_name': self.first_name,
            'last_name': self.last_name,
            'last_login_at': self.last_login_at,
            'registered_on': self.registered_on,
            'confirmed': self.confirmed,
            'confirmed_on': self.confirmed_on,
            'company': self.company,
            'title': self.title,
            'language': self.language,
            'roles': [role.name for role in self.roles],
            'location': [get_json_clean_response(self.location)]
        }
        return obj
Exemple #9
0
class Image_Attribute(db.Model):
    """ Models Model for storing model related details """
    __tablename__ = "ai_image_attribute"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    updated_on = db.Column(db.DateTime(), nullable=False)
    agent_id = db.Column(db.Integer,
                         db.ForeignKey('ai_agent.id'),
                         unique=True,
                         nullable=False)
    file_name = db.Column(db.String(255), unique=True, nullable=False)
    file_path = db.Column(db.String(255), unique=True, nullable=False)
    tag_id = db.Column(db.String(255), unique=True, nullable=False)
    model_id = db.Column(db.String(255), unique=True, nullable=False)
    model_output = db.Column(db.String(255), unique=True, nullable=False)
    dataset = db.Column(db.String(255), nullable=False)
    annotation_path = db.Column(db.String(255), nullable=False)
    flagging = db.Column(db.String(255), nullable=False)
    image_attributes = db.Column(db.String(255), nullable=False)
    license = db.Column(db.String(255), nullable=False)
    width = db.Column(db.Float, nullable=False)
    height = db.Column(db.Float, nullable=False)

    def __init__(self, updated_on, agent_id, image_id, tag_id, model_id,
                 model_output, dataset, annotation_path, flagging, width):
        self.updated_on = updated_on
        self.agent_id = agent_id
        self.image_id = image_id
        self.tag_id = tag_id
        self.model_id = model_id
        self.model_out = model_output
        self.dataset = dataset
        self.annotation_path = annotation_path
        self.flagging = flagging
        self.width = width

    def from_json(self, json):
        self.id = json.get('id', None)
        self.updated_on = json.get('updated_on', None)
        self.agent_id = json.get('agent_id', None)
        self.image_id = json.get('image_id', None)
        self.tag_id = json.get('tag_id', None)
        self.model_id = json.get('model_id', None)
        self.model_output = json.get('model_output', None)
        self.dataset = json.get('dataset', None)
        self.annotation_path = json.get('annotation_path', None)
        self.flagging = json.get('flagging', None)
        return self

    def to_dictionary(self):
        obj = {
            'id': self.id,
            'updated_on': self.updated_on,
            'agent_id': self.agent_id,
            'image_id': self.image_id,
            'tag_id': self.tag_id,
            'model_id': self.model_id,
            'model_output': self.model_output,
            'dataset': self.dataset,
            'annotation_path': self.annotation_path,
            'flagging': self.flagging
        }
        return obj
class User(db.Model):
    """ User Model for storing user related details """
    __tablename__ = "auth_users"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(255), unique=True, nullable=False)
    email = db.Column(db.String(255), unique=True, nullable=False)
    password = db.Column(db.String(255), nullable=False)
    first_name = db.Column(db.String(255), nullable=False)
    last_name = db.Column(db.String(255), nullable=False)
    registered_on = db.Column(db.DateTime(), nullable=False)
    confirmed = db.Column(db.Boolean, nullable=False, default=False)
    confirmed_on = db.Column(db.DateTime, nullable=True)
    last_login_at = db.Column(db.DateTime())
    current_login_at = db.Column(db.DateTime())
    company = db.Column(db.String(255))
    title = db.Column(db.String(255))
    language = db.Column(db.String(255), nullable=False)
    roles = db.relationship('Role',
                            secondary=roles_users,
                            backref=db.backref('users', lazy='dynamic'),
                            post_update=True)

    def __init__(self,
                 username,
                 password,
                 email,
                 first_name,
                 last_name,
                 language='en',
                 company=None,
                 title=None,
                 admin=False,
                 confirmed=False,
                 confirmed_on=None):
        self.username = username
        self.password = encrypt_password(password)
        self.email = email
        self.first_name = first_name
        self.last_name = last_name
        self.company = company
        self.title = title
        self.language = language
        self.registered_on = datetime.datetime.now()
        self.confirmed = confirmed
        self.confirmed_on = confirmed_on

        if admin:
            role = Role.query.filter_by(name='ADMIN').one()
            self.roles.append(role)
        else:
            role = Role.query.filter_by(name='CUSTOMER').one()
            self.roles.append(role)

    def from_partial_json(self, dictionary):
        super(User, self).from_partial_json(dictionary)
        if 'password' in dictionary:
            self.password = encrypt_password(dictionary.get('password'))
        self.registered_on = datetime.datetime.now()
        return self

    def from_json(self, json):
        self.id = json.get('user_id', None)
        self.email = json.get('email', None)
        self.password = json.get('password', None)
        self.first_name = json.get('first_name', None)
        self.last_name = json.get('last_name', None)
        return self

    def to_dictionary(self):
        obj = {
            'user_id': self.id,
            'username': self.username,
            'email': self.email,
            'first_name': self.first_name,
            'last_name': self.last_name,
            'registered_on': self.registered_on,
            'confirmed': self.confirmed,
            'confirmed_on': self.confirmed_on,
            'company': self.company,
            'title': self.title,
            'language': self.language,
            'roles': [role.name for role in self.roles],
        }
        return obj
Exemple #11
0
class Camera(db.Model):
    """ Camera Model for storing camera related details """
    __tablename__ = 'sys_camera'

    id = db.Column(db.Integer, primary_key=True, nullable=False, autoincrement=True)
    camera_id = db.Column(db.String(255), nullable=True)
    updated_on = db.Column(db.DateTime(), nullable=True)
    camera_type = db.Column(db.String(255), nullable=True)
    frame_rate = db.Column(db.String(255), nullable=True)
    resolution = db.Column(db.Float, nullable=True)
    color = db.Column(db.String(255), nullable=True)
    shutter_speed = db.Column(db.Boolean, nullable=True)
    exposure = db.Column(db.String(255), nullable=True)
    image_size_H = db.Column(db.Boolean, nullable=True)
    image_size_W = db.Column(db.String(255), nullable=True)
    image_size_C = db.Column(db.String(255), nullable=True)
    spot_name = db.Column(db.String(255), nullable=True)
    weight_file = db.Column(db.String(255), nullable=True)
    threshold = db.Column(db.String(255), nullable=True)
    orientation = db.Column(db.String(255), nullable=True)
    current_status = db.Column(db.Boolean, nullable=True)
    agent_id = db.Column(db.Integer, db.ForeignKey("ai_agent.id", ondelete='CASCADE'), nullable=True)
    models_id = db.Column(db.Integer, db.ForeignKey("ai_models.id", ondelete='CASCADE'), nullable=True)
    agent = db.relationship(Agent, primaryjoin=agent_id == Agent.id)
    model = db.relationship(Models, primaryjoin=models_id == Models.id)
    # inference_id = db.Column(db.Integer, db.ForeignKey("ai_inference.id"), nullable=True)
    # inference = db.relationship(Inference, primaryjoin=inference_id == Inference.id)


    def __init__(self, camera_id, updated_on, camera_type, frame_rate, resolution, color, shutter_speed, exposure,
                 image_size_H,
                 image_size_W, image_size_C, spot_name, weight_file, threshold, orientation):
        self.camera_id = camera_id
        self.updated_on = updated_on
        self.camera_type = camera_type
        self.frame_rate = frame_rate
        self.resolution = resolution
        self.color = color
        self.shutter_speed = shutter_speed
        self.exposure = exposure
        self.image_size_H = image_size_H
        self.image_size_W = image_size_W
        self.image_size_C = image_size_C
        self.spot_name = spot_name
        self.weight_file = weight_file
        self.threshold = threshold
        self.orientation = orientation
        self.model = Models.query.all()
        # self.inference = Inference.query.all()

    def from_json(self, json):
        self.camera_id = json.get('camera_id', None)
        self.updated_on = json.get('updated_on', None)
        self.camera_type = json.get('camera_type', None)
        self.frame_rate = json.get('frame_rate', None)
        self.resolution = json.get('resolution', None)
        self.color = json.get('color', None)
        self.shutter_speed = json.get('shutter_speed', None)
        self.exposure = json.get('exposure', None)
        self.image_size_H = json.get('image_size_H', None)
        self.image_size_W = json.get('image_size_W', None)
        self.image_size_C = json.get('image_size_C', None)
        self.spot_name = json.get('spot_name', None)
        self.weight_file = json.get('weight_file', None)
        self.threshold = json.get('threshold', None)
        self.orientation = json.get('orientation', None)

        return self

    def to_dictionary(self):
        obj = {
            'camera_id': self.camera_id,
            'updated_on': self.updated_on,
            'camera_type': self.camera_type,
            'frame_rate': self.frame_rate,
            'resolution': self.resolution,
            'color': self.color,
            'shutter_speed': self.shutter_speed,
            'exposure': self.exposure,
            'image_size_H': self.image_size_H,
            'image_size_W': self.image_size_W,
            'image_size_C': self.image_size_C,
            'weight_file': self.weight_file,
            'threshold': self.threshold,
            'orientation': self.orientation,
            'model': [get_json_clean_response(self.model)],
            # 'inference': [get_json_clean_response(self.inference)]
        }
        return obj
Exemple #12
0
class Agent(db.Model):
    __tablename__ = 'ai_agent'

    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)
    updated_on = db.Column(db.DateTime(),
                           nullable=False,
                           default="2020-01-01 00:00:00")
    camera_id = db.Column(db.Integer, nullable=True)
    model_id = db.Column(db.Integer, nullable=True)
    description = db.Column(db.String(255), nullable=True)
    environment = db.Column(db.String(255), nullable=True)
    project = db.Column(db.String(255), nullable=True)
    session = db.Column(db.String(255), nullable=True)
    user = db.Column(db.String(255), nullable=True)
    random_flip = db.Column(db.String(255), nullable=True, default='NULL')
    brightness = db.Column(db.String(255), nullable=True, default='NULL')
    random_rotate = db.Column(db.String(255), nullable=True, default='NULL')
    random_crop = db.Column(db.String(255), nullable=True, default='NULL')

    def __init__(self, camera_id, model_id, description, environment, project,
                 session, user, random_flip, brightness, random_rotate,
                 random_crop):
        self.camera_id = camera_id
        self.model_id = model_id
        self.description = description
        self.environment = environment
        self.project = project
        self.session = session
        self.user = user
        self.random_flip = random_flip
        self.brightness = brightness
        self.random_rotate = random_rotate
        self.random_crop = random_crop

    def from_json(self, json):
        self.id = json.get('agent_id', None)
        self.camera_id = json.get('camera_id', None)
        self.model_id = json.get("model_id", None)
        self.description = json.get("description", None)
        self.environment = json.get("environment", None)
        self.project = json.get("project", None)
        self.session = json.get("session", None)
        self.user = json.get("user", None)
        self.random_flip = json.get("random_flip", None)
        self.brightness = json.get("brightness", None)
        self.random_rotate = json.get("random_rotate", None)
        self.random_crop = json.get("random_crop", None)

        return self

    def to_dictionary(self):
        obj = {
            'agent_id': self.id,
            'camera_id': self.camera_id,
            'model_id': self.model_id,
            'description': self.description,
            'environment': self.environment,
            'project': self.project,
            'session': self.session,
            'user': self.user,
            'random_flip': self.random_flip,
            'brightness': self.brightness,
            'random_rotate': self.random_rotate,
            'random_crop': self.random_crop
        }
        return obj