Kaynağa Gözat

modify RMDet trainer

yjh0410 2 yıl önce
ebeveyn
işleme
f104480fee
2 değiştirilmiş dosya ile 11 ekleme ve 11 silme
  1. 6 6
      config/model_config/yolov7_config.py
  2. 5 5
      engine.py

+ 6 - 6
config/model_config/yolov7_config.py

@@ -36,7 +36,7 @@ yolov7_cfg = {
         # ---------------- Train config ----------------
         ## input
         'trans_type': 'yolox_small',
-        'multi_scale': [0.7, 1.25], # 448 -> 800
+        'multi_scale': [0.5, 1.5], # 320 -> 960
         # ---------------- Assignment config ----------------
         ## matcher
         'matcher': {'center_sampling_radius': 2.5,
@@ -47,7 +47,7 @@ yolov7_cfg = {
         'loss_cls_weight': 1.0,
         'loss_box_weight': 5.0,
         # ---------------- Train config ----------------
-        'trainer_type': 'yolox',
+        'trainer_type': 'rtmdet',
     },
 
     'yolov7':{
@@ -85,7 +85,7 @@ yolov7_cfg = {
         # ---------------- Train config ----------------
         ## input
         'trans_type': 'yolox_large',
-        'multi_scale': [0.7, 1.25], # 448 -> 800
+        'multi_scale': [0.5, 1.5], # 320 -> 960
         # ---------------- Assignment config ----------------
         ## matcher
         'matcher': {'center_sampling_radius': 2.5,
@@ -96,7 +96,7 @@ yolov7_cfg = {
         'loss_cls_weight': 1.0,
         'loss_box_weight': 5.0,
         # ---------------- Train config ----------------
-        'trainer_type': 'yolox',
+        'trainer_type': 'rtmdet',
     },
 
     'yolov7_x':{
@@ -134,7 +134,7 @@ yolov7_cfg = {
         # ---------------- Train config ----------------
         ## input
         'trans_type': 'yolox_huge',
-        'multi_scale': [0.7, 1.25], # 448 -> 800
+        'multi_scale': [0.5, 1.5], # 320 -> 960
         # ---------------- Assignment config ----------------
         ## matcher
         'matcher': {'center_sampling_radius': 2.5,
@@ -145,7 +145,7 @@ yolov7_cfg = {
         'loss_cls_weight': 1.0,
         'loss_box_weight': 5.0,
         # ---------------- Train config ----------------
-        'trainer_type': 'yolox',
+        'trainer_type': 'rtmdet',
     },
 
 }

+ 5 - 5
engine.py

@@ -721,7 +721,7 @@ class RTMTrainer(object):
         # ---------------------------- Hyperparameters refer to RTMDet ----------------------------
         self.optimizer_dict = {'optimizer': 'adamw', 'momentum': None, 'weight_decay': 5e-2, 'lr0': 0.001}
         self.ema_dict = {'ema_decay': 0.9998, 'ema_tau': 2000}
-        self.lr_schedule_dict = {'scheduler': 'linear', 'lrf': 0.01}
+        self.lr_schedule_dict = {'scheduler': 'cosine', 'lrf': 0.05}
         self.warmup_dict = {'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1}        
 
         # ---------------------------- Build Dataset & Model & Trans. Config ----------------------------
@@ -973,11 +973,11 @@ class RTMTrainer(object):
 
         # close random affine
         if 'translate' in self.trans_cfg.keys() and self.trans_cfg['translate'] > 0.0:
-            print(' - Close < translate of affine > ...')
-            self.trans_cfg['translate'] = 0.0
+            print(' - Weaken < translate of affine > ...')
+            self.trans_cfg['translate'] = 0.2
         if 'scale' in self.trans_cfg.keys():
-            print(' - Close < scale of affine >...')
-            self.trans_cfg['scale'] = [1.0, 1.0]
+            print(' - Weaken < scale of affine >...')
+            self.trans_cfg['scale'] = [0.5, 2.0]
 
         # build a new transform for second stage
         print(' - Rebuild transforms ...')