Parcourir la source

use RTCDet trainer for YOLOv7

yjh0410 il y a 2 ans
Parent
commit
b6f66b2d67
3 fichiers modifiés avec 13 ajouts et 53 suppressions
  1. 6 6
      config/model_config/yolov7_config.py
  2. 3 23
      train_multi_gpus.sh
  3. 4 24
      train_single_gpu.sh

+ 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': 'rtcdet',
     },
 
     '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': 'rtcdet',
     },
 
     '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': 'rtcdet',
     },
 
 }

+ 3 - 23
train_multi_gpus.sh

@@ -1,11 +1,11 @@
-# -------------------------- Train YOLOX series --------------------------
+# -------------------------- Train YOLOX & YOLOv7 & RTCDet --------------------------
 python -m torch.distributed.run --nproc_per_node=8 train.py \
                                                     --cuda \
                                                     -dist \
                                                     -d coco \
                                                     --root /data/datasets/ \
                                                     -m yolov7_tiny\
-                                                    -bs 64 \
+                                                    -bs 128 \
                                                     -size 640 \
                                                     --wp_epoch 3 \
                                                     --max_epoch 300 \
@@ -18,7 +18,7 @@ python -m torch.distributed.run --nproc_per_node=8 train.py \
                                                     # --load_cache \
                                                     # --resume weights/coco/yolox_l/yolox_l_best.pth \
 
-# -------------------------- Train YOLOv1~v5 & v7 series --------------------------
+# -------------------------- Train YOLOv1~v5 --------------------------
 # python -m torch.distributed.run --nproc_per_node=8 train.py \
 #                                                     --cuda \
 #                                                     -dist \
@@ -37,23 +37,3 @@ python -m torch.distributed.run --nproc_per_node=8 train.py \
 #                                                     --multi_scale \
 #                                                     # --load_cache
 #                                                     # --resume weights/coco/yolov5_l/yolov5_l_best.pth \
-
-# -------------------------- Train My RTCDet series --------------------------
-# python -m torch.distributed.run --nproc_per_node=8 train.py \
-#                                                     --cuda \
-#                                                     -dist \
-#                                                     -d coco \
-#                                                     --root /data/datasets/ \
-#                                                     -m rtcdet_v1_l\
-#                                                     -bs 128 \
-#                                                     -size 640 \
-#                                                     --wp_epoch 3 \
-#                                                     --max_epoch 300 \
-#                                                     --eval_epoch 10 \
-#                                                     --no_aug_epoch 20 \
-#                                                     --ema \
-#                                                     --fp16 \
-#                                                     --sybn \
-#                                                     --multi_scale \
-#                                                     # --load_cache
-#                                                     #  --resume weights/coco/rtcdet_v1_l/rtcdet_v1_l_best.pth \

+ 4 - 24
train_single_gpu.sh

@@ -1,16 +1,16 @@
-# -------------------------- Train YOLOX series --------------------------
+# -------------------------- Train YOLOX & YOLOv7 & RTCDet series --------------------------
 python train.py \
         --cuda \
         -d coco \
         --root /data/datasets/ \
         -m yolov7_tiny \
-        -bs 16 \
+        -bs 8 \
         -size 640 \
         --wp_epoch 3 \
         --max_epoch 300 \
         --eval_epoch 10 \
         --no_aug_epoch 15 \
-        --grad_accumulate 1 \
+        --grad_accumulate 8 \
         --ema \
         --fp16 \
         --multi_scale \
@@ -18,7 +18,7 @@ python train.py \
         # --resume weights/coco/yolox_m/yolox_m_best.pth \
         # --eval_first
 
-# -------------------------- Train YOLOv1~v5 & v7 series --------------------------
+# -------------------------- Train YOLOv1~v5 series --------------------------
 # python train.py \
 #         --cuda \
 #         -d coco \
@@ -36,23 +36,3 @@ python train.py \
 #         # --load_cache \
 #         # --resume weights/coco/yolov5_l/yolov5_l_best.pth \
 #         # --eval_first
-
-# -------------------------- Train My RTCDet series --------------------------
-# python train.py \
-#         --cuda \
-#         -d coco \
-#         --root /mnt/share/ssd2/dataset/ \
-#         -m rtcdet_v1_l \
-#         -bs 16 \
-#         -size 640 \
-#         --wp_epoch 3 \
-#         --max_epoch 300 \
-#         --eval_epoch 10 \
-#         --no_aug_epoch 20 \
-#         --grad_accumulate 8 \
-#         --ema \
-#         --fp16 \
-#         --multi_scale \
-#         # --load_cache \
-#         # --resume weights/coco/rtcdet_v1_l/rtcdet_v1_l_best.pth \
-#         # --eval_first