#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) Megvii, Inc. and its affiliates.

import os

from yolox.exp import Exp as MyExp


class Exp(MyExp):
    def __init__(self):
        super(Exp, self).__init__()
        self.data_dir = "/home/kitraining/To_Annotate/"
        self.train_ann = "coco_project_50_train.json"
        self.val_ann = "coco_project_50_valid.json"
        self.test_ann = "coco_project_50_test.json"
        self.num_classes = 2
        self.pretrained_ckpt = r'/home/kitraining/Yolox/YOLOX-main/pretrained/YOLOX_s.pth'
        self.depth = 0.33
        self.width = 0.50
        self.exp_name = os.path.split(os.path.realpath(__file__))[1].split(".")[0]

        # --------------  training config --------------------- #
        self.warmup_epochs = 15           # More warmup
        self.max_epoch = 250             # more epochs
        self.act = "silu"                #Activation function
                
        # Thresholds 
        self.test_conf = 0.01            # Low to catch more the second class
        self.nmsthre = 0.7               
        
        # Data Augmentation intens to improve generalization
        self.enable_mixup = True
        self.mixup_prob = 0.9            # mixup
        self.mosaic_prob = 0.9           # mosaico
        self.degrees = 30.0              # Rotation
        self.translate = 0.4             # Translation
        self.scale = (0.2, 2.0)          # Scaling
        self.shear = 10.0                # Shear
        self.flip_prob = 0.8
        self.hsv_prob = 1.0
        
        # Learning rate 
        self.basic_lr_per_img = 0.001 / 64.0  # Lower LR to avoid divergence
        self.scheduler = "yoloxwarmcos" 
        
        # Loss weights
        self.cls_loss_weight = 8.0       # More weight to the classification loss
        self.obj_loss_weight = 1.0
        self.reg_loss_weight = 0.5
        
        # Input size bigger for better detection of small objects like babys 
        self.input_size = (832, 832)  
        self.test_size = (832, 832)
        
        # Batch size
        self.batch_size = 5              # Reduce if you have memory issues