Commit ·
39cfa59
1
Parent(s): 808a2bb
add configs
Browse files- configs/damo_yolo_l.yml +38 -0
- configs/damo_yolo_t.yml +38 -0
- configs/data.yaml +18 -0
- configs/rtdetrv2_s.yaml +228 -0
- configs/rtdetrv2_x.yaml +218 -0
- configs/yolov11_s.yml +42 -0
- configs/yolov11_x.yml +42 -0
configs/damo_yolo_l.yml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ====================================================
|
| 2 |
+
# Model Configuration Overrides for DAMOYOLO TinyNAS L45
|
| 3 |
+
# ====================================================
|
| 4 |
+
|
| 5 |
+
miscs:
|
| 6 |
+
eval_interval_epochs: 1 # ↓ from 10
|
| 7 |
+
ckpt_interval_epochs: 1 # ↓ from 10
|
| 8 |
+
|
| 9 |
+
train:
|
| 10 |
+
batch_size: 16 # ↓ from 256
|
| 11 |
+
total_epochs: 150 # Added
|
| 12 |
+
train.resume_path: "/path/to/checkpoint.pth" # set to null when starting training
|
| 13 |
+
train.finetune_path: "/path/to/base_model.pth" # set to null when resuming training
|
| 14 |
+
|
| 15 |
+
dataset:
|
| 16 |
+
train_ann:
|
| 17 |
+
- path/to/dataset/train
|
| 18 |
+
val_ann:
|
| 19 |
+
- path/to/dataset/val
|
| 20 |
+
class_names:
|
| 21 |
+
- Hatchback
|
| 22 |
+
- Sedan
|
| 23 |
+
- SUV
|
| 24 |
+
- MUV
|
| 25 |
+
- Bus
|
| 26 |
+
- Truck
|
| 27 |
+
- Three-wheeler
|
| 28 |
+
- Two-wheeler
|
| 29 |
+
- LCV
|
| 30 |
+
- Mini-bus
|
| 31 |
+
- tempo-traveller
|
| 32 |
+
- bicycle
|
| 33 |
+
- Vans
|
| 34 |
+
- Others
|
| 35 |
+
|
| 36 |
+
model:
|
| 37 |
+
head:
|
| 38 |
+
num_classes: 14 # ↓ from 80
|
configs/damo_yolo_t.yml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ====================================================
|
| 2 |
+
# Model Configuration Overrides for DAMOYOLO TinyNAS L20
|
| 3 |
+
# ====================================================
|
| 4 |
+
|
| 5 |
+
miscs:
|
| 6 |
+
eval_interval_epochs: 1 # ↓ from 10
|
| 7 |
+
ckpt_interval_epochs: 1 # ↓ from 10
|
| 8 |
+
|
| 9 |
+
train:
|
| 10 |
+
batch_size: 16 # ↓ from 256
|
| 11 |
+
total_epochs: 150 # Added
|
| 12 |
+
train.resume_path: "/path/to/checkpoint.pth" # set to null when starting training
|
| 13 |
+
train.finetune_path: "/path/to/base_model.pth" # set to null when resuming training
|
| 14 |
+
|
| 15 |
+
dataset:
|
| 16 |
+
train_ann:
|
| 17 |
+
- path/to/dataset/train
|
| 18 |
+
val_ann:
|
| 19 |
+
- path/to/dataset/val
|
| 20 |
+
class_names:
|
| 21 |
+
- Hatchback
|
| 22 |
+
- Sedan
|
| 23 |
+
- SUV
|
| 24 |
+
- MUV
|
| 25 |
+
- Bus
|
| 26 |
+
- Truck
|
| 27 |
+
- Three-wheeler
|
| 28 |
+
- Two-wheeler
|
| 29 |
+
- LCV
|
| 30 |
+
- Mini-bus
|
| 31 |
+
- tempo-traveller
|
| 32 |
+
- bicycle
|
| 33 |
+
- Vans
|
| 34 |
+
- Others
|
| 35 |
+
|
| 36 |
+
model:
|
| 37 |
+
head:
|
| 38 |
+
num_classes: 14 # ↓ from 80
|
configs/data.yaml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
names:
|
| 2 |
+
0: "Hatchback"
|
| 3 |
+
1: "Sedan"
|
| 4 |
+
2: "SUV"
|
| 5 |
+
3: "MUV"
|
| 6 |
+
4: "Bus"
|
| 7 |
+
5: "Truck"
|
| 8 |
+
6: "Three-wheeler"
|
| 9 |
+
7: "Two-wheeler"
|
| 10 |
+
8: "LCV"
|
| 11 |
+
9: "Mini-bus"
|
| 12 |
+
10: "tempo-traveller"
|
| 13 |
+
11: "bicycle"
|
| 14 |
+
12: "Van"
|
| 15 |
+
13: "Others"
|
| 16 |
+
nc: 14
|
| 17 |
+
train: /path/to/train/images
|
| 18 |
+
val: /path/to/val/images
|
configs/rtdetrv2_s.yaml
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
# RT-DETRv2 — Unified Training Config (R18vd/R50vd)
|
| 3 |
+
# ============================================
|
| 4 |
+
|
| 5 |
+
task: detection
|
| 6 |
+
num_classes: 16
|
| 7 |
+
remap_mscoco_category: false
|
| 8 |
+
|
| 9 |
+
# -------------------------------
|
| 10 |
+
# Dataset & Evaluation
|
| 11 |
+
# -------------------------------
|
| 12 |
+
evaluator:
|
| 13 |
+
type: CocoEvaluator
|
| 14 |
+
iou_types: ["bbox"]
|
| 15 |
+
|
| 16 |
+
train_dataloader:
|
| 17 |
+
type: DataLoader
|
| 18 |
+
dataset:
|
| 19 |
+
type: CocoDetection
|
| 20 |
+
img_folder: "/path/to/train/images" # e.g., /data/UVH-26/images/train
|
| 21 |
+
ann_file: "/path/to/annotations/train.json" # e.g., /data/UVH-26/annotations/instances_train.json
|
| 22 |
+
return_masks: false
|
| 23 |
+
transforms:
|
| 24 |
+
type: Compose
|
| 25 |
+
ops:
|
| 26 |
+
- { type: RandomPhotometricDistort, p: 0.5 }
|
| 27 |
+
- { type: RandomZoomOut, fill: 0 }
|
| 28 |
+
- { type: RandomIoUCrop, p: 0.8 }
|
| 29 |
+
- { type: SanitizeBoundingBoxes, min_size: 1 }
|
| 30 |
+
- { type: RandomHorizontalFlip }
|
| 31 |
+
- { type: Resize, size: [640, 640] }
|
| 32 |
+
- { type: SanitizeBoundingBoxes, min_size: 1 }
|
| 33 |
+
- { type: ConvertPILImage, dtype: "float32", scale: true }
|
| 34 |
+
- { type: ConvertBoxes, fmt: "cxcywh", normalize: true }
|
| 35 |
+
policy: # stop heavy augs late
|
| 36 |
+
name: stop_epoch
|
| 37 |
+
epoch: 151
|
| 38 |
+
ops: ["RandomPhotometricDistort", "RandomZoomOut", "RandomIoUCrop"]
|
| 39 |
+
shuffle: true
|
| 40 |
+
total_batch_size: 16 # global batch (sum across GPUs)
|
| 41 |
+
num_workers: 8
|
| 42 |
+
drop_last: true
|
| 43 |
+
collate_fn:
|
| 44 |
+
type: BatchImageCollateFuncion
|
| 45 |
+
scales: [480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800]
|
| 46 |
+
stop_epoch: 151
|
| 47 |
+
|
| 48 |
+
val_dataloader:
|
| 49 |
+
type: DataLoader
|
| 50 |
+
dataset:
|
| 51 |
+
type: CocoDetection
|
| 52 |
+
return_masks: false
|
| 53 |
+
transforms:
|
| 54 |
+
type: Compose
|
| 55 |
+
ops:
|
| 56 |
+
- { type: Resize, size: [640, 640] }
|
| 57 |
+
- { type: ConvertPILImage, dtype: "float32", scale: true }
|
| 58 |
+
shuffle: false
|
| 59 |
+
total_batch_size: 32
|
| 60 |
+
num_workers: 8
|
| 61 |
+
drop_last: false
|
| 62 |
+
collate_fn:
|
| 63 |
+
type: BatchImageCollateFuncion
|
| 64 |
+
|
| 65 |
+
# -------------------------------
|
| 66 |
+
# Training runtime
|
| 67 |
+
# -------------------------------
|
| 68 |
+
output_dir: "/path/to/output_dir" # e.g., ./output/rtdetrv2_uvh26
|
| 69 |
+
epoches: 152 # r18vd can override to 150 below
|
| 70 |
+
clip_max_norm: 0.1
|
| 71 |
+
use_amp: true
|
| 72 |
+
|
| 73 |
+
use_ema: true
|
| 74 |
+
ema:
|
| 75 |
+
type: ModelEMA
|
| 76 |
+
decay: 0.9999
|
| 77 |
+
warmups: 2000
|
| 78 |
+
|
| 79 |
+
# -------------------------------
|
| 80 |
+
# Optimizer & LR schedules (merged)
|
| 81 |
+
# -------------------------------
|
| 82 |
+
optimizer:
|
| 83 |
+
type: AdamW
|
| 84 |
+
params:
|
| 85 |
+
- params: "^(?=.*backbone)(?!.*norm|bn).*$" # backbone (exclude norm/bn)
|
| 86 |
+
lr: 0.00001
|
| 87 |
+
- params: "^(?=.*(?:encoder|decoder))(?=.*(?:norm|bn)).*$" # enc/dec norms
|
| 88 |
+
weight_decay: 0.0
|
| 89 |
+
lr: 0.0001
|
| 90 |
+
betas: [0.9, 0.999]
|
| 91 |
+
weight_decay: 0.0001
|
| 92 |
+
|
| 93 |
+
lr_scheduler:
|
| 94 |
+
type: MultiStepLR
|
| 95 |
+
milestones: [1000]
|
| 96 |
+
gamma: 0.1
|
| 97 |
+
|
| 98 |
+
lr_warmup_scheduler:
|
| 99 |
+
type: LinearWarmup
|
| 100 |
+
warmup_duration: 2000
|
| 101 |
+
|
| 102 |
+
# -------------------------------
|
| 103 |
+
# Model & Criterion
|
| 104 |
+
# -------------------------------
|
| 105 |
+
model: RTDETR
|
| 106 |
+
criterion: RTDETRCriterionv2
|
| 107 |
+
postprocessor: RTDETRPostProcessor
|
| 108 |
+
|
| 109 |
+
use_focal_loss: true
|
| 110 |
+
eval_spatial_size: [640, 640] # (h, w)
|
| 111 |
+
|
| 112 |
+
RTDETR:
|
| 113 |
+
backbone: PResNet
|
| 114 |
+
encoder: HybridEncoder
|
| 115 |
+
decoder: RTDETRTransformerv2
|
| 116 |
+
|
| 117 |
+
RTDETRPostProcessor:
|
| 118 |
+
num_top_queries: 300
|
| 119 |
+
|
| 120 |
+
RTDETRCriterionv2:
|
| 121 |
+
weight_dict: { loss_vfl: 1, loss_bbox: 5, loss_giou: 2 }
|
| 122 |
+
losses: ["vfl", "boxes"]
|
| 123 |
+
alpha: 0.75
|
| 124 |
+
gamma: 2.0
|
| 125 |
+
matcher:
|
| 126 |
+
type: HungarianMatcher
|
| 127 |
+
weight_dict: { cost_class: 2, cost_bbox: 5, cost_giou: 2 }
|
| 128 |
+
alpha: 0.25
|
| 129 |
+
gamma: 2.0
|
| 130 |
+
|
| 131 |
+
# -------------------------------
|
| 132 |
+
# Active variant selection
|
| 133 |
+
# -------------------------------
|
| 134 |
+
active_model_variant: r18vd # choose: [r18vd, r50vd]
|
| 135 |
+
|
| 136 |
+
# -------------------------------
|
| 137 |
+
# Model variants (override blocks)
|
| 138 |
+
# -------------------------------
|
| 139 |
+
model_variants:
|
| 140 |
+
# ---------- ResNet-18vd (your lightweight config) ----------
|
| 141 |
+
r18vd:
|
| 142 |
+
# Optional training overrides for this variant
|
| 143 |
+
overrides:
|
| 144 |
+
epoches: 150
|
| 145 |
+
train_dataloader:
|
| 146 |
+
collate_fn:
|
| 147 |
+
scales: null # disable multiscale if you want the leanest setup
|
| 148 |
+
dataset:
|
| 149 |
+
transforms:
|
| 150 |
+
policy:
|
| 151 |
+
epoch: 150 # align with epoches
|
| 152 |
+
PResNet:
|
| 153 |
+
depth: 18
|
| 154 |
+
variant: d
|
| 155 |
+
freeze_at: -1
|
| 156 |
+
return_idx: [1, 2, 3] # (if your code expects these; else omit)
|
| 157 |
+
num_stages: 4
|
| 158 |
+
freeze_norm: false
|
| 159 |
+
pretrained: true
|
| 160 |
+
HybridEncoder:
|
| 161 |
+
in_channels: [128, 256, 512]
|
| 162 |
+
feat_strides: [8, 16, 32]
|
| 163 |
+
# intra
|
| 164 |
+
hidden_dim: 256
|
| 165 |
+
use_encoder_idx: [2]
|
| 166 |
+
num_encoder_layers: 1
|
| 167 |
+
nhead: 8
|
| 168 |
+
dim_feedforward: 1024
|
| 169 |
+
dropout: 0.0
|
| 170 |
+
enc_act: "gelu"
|
| 171 |
+
# cross
|
| 172 |
+
expansion: 0.5 # narrower head vs R50
|
| 173 |
+
depth_mult: 1
|
| 174 |
+
act: "silu"
|
| 175 |
+
RTDETRTransformerv2:
|
| 176 |
+
feat_channels: [256, 256, 256]
|
| 177 |
+
feat_strides: [8, 16, 32]
|
| 178 |
+
hidden_dim: 256
|
| 179 |
+
num_levels: 3
|
| 180 |
+
num_layers: 3 # <— shallower transformer per your snippet
|
| 181 |
+
num_queries: 300
|
| 182 |
+
num_denoising: 100
|
| 183 |
+
label_noise_ratio: 0.5
|
| 184 |
+
box_noise_scale: 1.0
|
| 185 |
+
eval_idx: -1
|
| 186 |
+
num_points: [4, 4, 4]
|
| 187 |
+
cross_attn_method: default
|
| 188 |
+
query_select_method: default
|
| 189 |
+
|
| 190 |
+
# ---------- ResNet-50vd (baseline you included) ----------
|
| 191 |
+
r50vd:
|
| 192 |
+
PResNet:
|
| 193 |
+
depth: 50
|
| 194 |
+
variant: d
|
| 195 |
+
freeze_at: 0
|
| 196 |
+
return_idx: [1, 2, 3]
|
| 197 |
+
num_stages: 4
|
| 198 |
+
freeze_norm: true
|
| 199 |
+
pretrained: true
|
| 200 |
+
HybridEncoder:
|
| 201 |
+
in_channels: [512, 1024, 2048]
|
| 202 |
+
feat_strides: [8, 16, 32]
|
| 203 |
+
# intra
|
| 204 |
+
hidden_dim: 256
|
| 205 |
+
use_encoder_idx: [2]
|
| 206 |
+
num_encoder_layers: 1
|
| 207 |
+
nhead: 8
|
| 208 |
+
dim_feedforward: 1024
|
| 209 |
+
dropout: 0.0
|
| 210 |
+
enc_act: "gelu"
|
| 211 |
+
# cross
|
| 212 |
+
expansion: 1.0
|
| 213 |
+
depth_mult: 1
|
| 214 |
+
act: "silu"
|
| 215 |
+
RTDETRTransformerv2:
|
| 216 |
+
feat_channels: [256, 256, 256]
|
| 217 |
+
feat_strides: [8, 16, 32]
|
| 218 |
+
hidden_dim: 256
|
| 219 |
+
num_levels: 3
|
| 220 |
+
num_layers: 6
|
| 221 |
+
num_queries: 300
|
| 222 |
+
num_denoising: 100
|
| 223 |
+
label_noise_ratio: 0.5
|
| 224 |
+
box_noise_scale: 1.0
|
| 225 |
+
eval_idx: -1
|
| 226 |
+
num_points: [4, 4, 4]
|
| 227 |
+
cross_attn_method: default
|
| 228 |
+
query_select_method: default
|
configs/rtdetrv2_x.yaml
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
| 1 |
+
# ===============================
|
| 2 |
+
# RT-DETRv2: Unified Training Config
|
| 3 |
+
# ===============================
|
| 4 |
+
|
| 5 |
+
task: detection
|
| 6 |
+
num_classes: 16
|
| 7 |
+
remap_mscoco_category: false
|
| 8 |
+
|
| 9 |
+
# -------------------------------
|
| 10 |
+
# Dataset & Evaluation
|
| 11 |
+
# -------------------------------
|
| 12 |
+
evaluator:
|
| 13 |
+
type: CocoEvaluator
|
| 14 |
+
iou_types: ["bbox"]
|
| 15 |
+
|
| 16 |
+
train_dataloader:
|
| 17 |
+
type: DataLoader
|
| 18 |
+
dataset:
|
| 19 |
+
type: CocoDetection
|
| 20 |
+
return_masks: false
|
| 21 |
+
transforms:
|
| 22 |
+
type: Compose
|
| 23 |
+
ops:
|
| 24 |
+
- { type: RandomPhotometricDistort, p: 0.5 }
|
| 25 |
+
- { type: RandomZoomOut, fill: 0 }
|
| 26 |
+
- { type: RandomIoUCrop, p: 0.8 }
|
| 27 |
+
- { type: SanitizeBoundingBoxes, min_size: 1 }
|
| 28 |
+
- { type: RandomHorizontalFlip }
|
| 29 |
+
- { type: Resize, size: [640, 640] }
|
| 30 |
+
- { type: SanitizeBoundingBoxes, min_size: 1 }
|
| 31 |
+
- { type: ConvertPILImage, dtype: "float32", scale: true }
|
| 32 |
+
- { type: ConvertBoxes, fmt: "cxcywh", normalize: true }
|
| 33 |
+
policy: # stop heavy augs late in training
|
| 34 |
+
name: stop_epoch
|
| 35 |
+
epoch: 151 # stop the ops listed below from this epoch
|
| 36 |
+
ops: ["RandomPhotometricDistort", "RandomZoomOut", "RandomIoUCrop"]
|
| 37 |
+
shuffle: true
|
| 38 |
+
total_batch_size: 16 # global batch (sum over all GPUs)
|
| 39 |
+
num_workers: 8
|
| 40 |
+
drop_last: true
|
| 41 |
+
collate_fn:
|
| 42 |
+
type: BatchImageCollateFuncion
|
| 43 |
+
scales: [480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800]
|
| 44 |
+
stop_epoch: 151 # stop multiscale after this epoch
|
| 45 |
+
|
| 46 |
+
val_dataloader:
|
| 47 |
+
type: DataLoader
|
| 48 |
+
dataset:
|
| 49 |
+
type: CocoDetection
|
| 50 |
+
return_masks: false
|
| 51 |
+
transforms:
|
| 52 |
+
type: Compose
|
| 53 |
+
ops:
|
| 54 |
+
- { type: Resize, size: [640, 640] }
|
| 55 |
+
- { type: ConvertPILImage, dtype: "float32", scale: true }
|
| 56 |
+
shuffle: false
|
| 57 |
+
total_batch_size: 32
|
| 58 |
+
num_workers: 8
|
| 59 |
+
drop_last: false
|
| 60 |
+
collate_fn:
|
| 61 |
+
type: BatchImageCollateFuncion
|
| 62 |
+
|
| 63 |
+
# -------------------------------
|
| 64 |
+
# Training runtime
|
| 65 |
+
# -------------------------------
|
| 66 |
+
output_dir: "/path/to/output_dir" # e.g., ./output/rtdetrv2_uvh26
|
| 67 |
+
epoches: 152
|
| 68 |
+
clip_max_norm: 0.1
|
| 69 |
+
use_amp: true
|
| 70 |
+
|
| 71 |
+
use_ema: true
|
| 72 |
+
ema:
|
| 73 |
+
type: ModelEMA
|
| 74 |
+
decay: 0.9999
|
| 75 |
+
warmups: 2000
|
| 76 |
+
|
| 77 |
+
# -------------------------------
|
| 78 |
+
# Optimizer & LR Schedules
|
| 79 |
+
# (merged; keeps both param groups you had)
|
| 80 |
+
# -------------------------------
|
| 81 |
+
optimizer:
|
| 82 |
+
type: AdamW
|
| 83 |
+
params:
|
| 84 |
+
- params: "^(?=.*backbone)(?!.*norm|bn).*$" # backbone (exclude norm/bn)
|
| 85 |
+
lr: 0.00001
|
| 86 |
+
- params: "^(?=.*(?:encoder|decoder))(?=.*(?:norm|bn)).*$" # encoder/decoder norms
|
| 87 |
+
weight_decay: 0.0
|
| 88 |
+
lr: 0.0001
|
| 89 |
+
betas: [0.9, 0.999]
|
| 90 |
+
weight_decay: 0.0001
|
| 91 |
+
|
| 92 |
+
lr_scheduler:
|
| 93 |
+
type: MultiStepLR
|
| 94 |
+
milestones: [1000]
|
| 95 |
+
gamma: 0.1
|
| 96 |
+
|
| 97 |
+
lr_warmup_scheduler:
|
| 98 |
+
type: LinearWarmup
|
| 99 |
+
warmup_duration: 2000
|
| 100 |
+
|
| 101 |
+
# -------------------------------
|
| 102 |
+
# Model & Criterion
|
| 103 |
+
# -------------------------------
|
| 104 |
+
model: RTDETR
|
| 105 |
+
criterion: RTDETRCriterionv2
|
| 106 |
+
postprocessor: RTDETRPostProcessor
|
| 107 |
+
|
| 108 |
+
use_focal_loss: true
|
| 109 |
+
eval_spatial_size: [640, 640] # (h, w)
|
| 110 |
+
|
| 111 |
+
RTDETR:
|
| 112 |
+
backbone: PResNet
|
| 113 |
+
encoder: HybridEncoder
|
| 114 |
+
decoder: RTDETRTransformerv2
|
| 115 |
+
|
| 116 |
+
RTDETRPostProcessor:
|
| 117 |
+
num_top_queries: 300
|
| 118 |
+
|
| 119 |
+
RTDETRCriterionv2:
|
| 120 |
+
weight_dict: { loss_vfl: 1, loss_bbox: 5, loss_giou: 2 }
|
| 121 |
+
losses: ["vfl", "boxes"]
|
| 122 |
+
alpha: 0.75
|
| 123 |
+
gamma: 2.0
|
| 124 |
+
matcher:
|
| 125 |
+
type: HungarianMatcher
|
| 126 |
+
weight_dict: { cost_class: 2, cost_bbox: 5, cost_giou: 2 }
|
| 127 |
+
alpha: 0.25
|
| 128 |
+
gamma: 2.0
|
| 129 |
+
|
| 130 |
+
# -------------------------------
|
| 131 |
+
# Active variant selection
|
| 132 |
+
# -------------------------------
|
| 133 |
+
active_model_variant: r50vd # choose: [r50vd, r101vd]
|
| 134 |
+
|
| 135 |
+
# -------------------------------
|
| 136 |
+
# Model variants (overrides by variant)
|
| 137 |
+
# -------------------------------
|
| 138 |
+
model_variants:
|
| 139 |
+
# ----- ResNet-50vd (default; from your r50 config) -----
|
| 140 |
+
r50vd:
|
| 141 |
+
PResNet:
|
| 142 |
+
depth: 50
|
| 143 |
+
variant: d
|
| 144 |
+
freeze_at: 0
|
| 145 |
+
return_idx: [1, 2, 3]
|
| 146 |
+
num_stages: 4
|
| 147 |
+
freeze_norm: true
|
| 148 |
+
pretrained: true
|
| 149 |
+
HybridEncoder:
|
| 150 |
+
in_channels: [512, 1024, 2048]
|
| 151 |
+
feat_strides: [8, 16, 32]
|
| 152 |
+
# intra
|
| 153 |
+
hidden_dim: 256
|
| 154 |
+
use_encoder_idx: [2]
|
| 155 |
+
num_encoder_layers: 1
|
| 156 |
+
nhead: 8
|
| 157 |
+
dim_feedforward: 1024
|
| 158 |
+
dropout: 0.0
|
| 159 |
+
enc_act: "gelu"
|
| 160 |
+
# cross
|
| 161 |
+
expansion: 1.0
|
| 162 |
+
depth_mult: 1
|
| 163 |
+
act: "silu"
|
| 164 |
+
RTDETRTransformerv2:
|
| 165 |
+
feat_channels: [256, 256, 256]
|
| 166 |
+
feat_strides: [8, 16, 32]
|
| 167 |
+
hidden_dim: 256
|
| 168 |
+
num_levels: 3
|
| 169 |
+
num_layers: 6
|
| 170 |
+
num_queries: 300
|
| 171 |
+
num_denoising: 100
|
| 172 |
+
label_noise_ratio: 0.5
|
| 173 |
+
box_noise_scale: 1.0
|
| 174 |
+
eval_idx: -1
|
| 175 |
+
# NEW
|
| 176 |
+
num_points: [4, 4, 4] # alternatives: [3,3,3], [2,2,2]
|
| 177 |
+
cross_attn_method: default # default | discrete
|
| 178 |
+
query_select_method: default # default | agnostic
|
| 179 |
+
|
| 180 |
+
# ----- ResNet-101vd (your 6x-style overrides) -----
|
| 181 |
+
r101vd:
|
| 182 |
+
PResNet:
|
| 183 |
+
depth: 101
|
| 184 |
+
variant: d
|
| 185 |
+
freeze_at: 0
|
| 186 |
+
return_idx: [1, 2, 3]
|
| 187 |
+
num_stages: 4
|
| 188 |
+
freeze_norm: true
|
| 189 |
+
pretrained: true
|
| 190 |
+
HybridEncoder:
|
| 191 |
+
in_channels: [512, 1024, 2048]
|
| 192 |
+
feat_strides: [8, 16, 32]
|
| 193 |
+
# intra
|
| 194 |
+
hidden_dim: 384 # ↑ wider hidden dim
|
| 195 |
+
use_encoder_idx: [2]
|
| 196 |
+
num_encoder_layers: 1
|
| 197 |
+
nhead: 8
|
| 198 |
+
dim_feedforward: 2048 # ↑ larger FFN
|
| 199 |
+
dropout: 0.0
|
| 200 |
+
enc_act: "gelu"
|
| 201 |
+
# cross
|
| 202 |
+
expansion: 1.0
|
| 203 |
+
depth_mult: 1
|
| 204 |
+
act: "silu"
|
| 205 |
+
RTDETRTransformerv2:
|
| 206 |
+
feat_channels: [384, 384, 384] # ↑ wider channels
|
| 207 |
+
feat_strides: [8, 16, 32]
|
| 208 |
+
hidden_dim: 256 # (keep decoder dim; change if you align head widths)
|
| 209 |
+
num_levels: 3
|
| 210 |
+
num_layers: 6
|
| 211 |
+
num_queries: 300
|
| 212 |
+
num_denoising: 100
|
| 213 |
+
label_noise_ratio: 0.5
|
| 214 |
+
box_noise_scale: 1.0
|
| 215 |
+
eval_idx: -1
|
| 216 |
+
num_points: [4, 4, 4]
|
| 217 |
+
cross_attn_method: default
|
| 218 |
+
query_select_method: default
|
configs/yolov11_s.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ====================================================
|
| 2 |
+
# Model Configuration Overrides for YOLOv11 S
|
| 3 |
+
# ====================================================
|
| 4 |
+
|
| 5 |
+
# Model checkpoint to start from
|
| 6 |
+
model: "/path/to/last.pt"
|
| 7 |
+
|
| 8 |
+
# Dataset configuration
|
| 9 |
+
data: "/path/to/data.yaml"
|
| 10 |
+
|
| 11 |
+
# Hardware
|
| 12 |
+
device: [0, 1] # Use GPUs 0 and 1
|
| 13 |
+
seed: 42
|
| 14 |
+
|
| 15 |
+
# Training hyperparameters
|
| 16 |
+
epochs: 150
|
| 17 |
+
batch: 16
|
| 18 |
+
imgsz: 640
|
| 19 |
+
optimizer: AdamW
|
| 20 |
+
cos_lr: true
|
| 21 |
+
amp: false
|
| 22 |
+
resume: true
|
| 23 |
+
|
| 24 |
+
# Augmentation parameters
|
| 25 |
+
mosaic: 0.0
|
| 26 |
+
mixup: 0.0
|
| 27 |
+
auto_augment: null
|
| 28 |
+
flipud: 0.0
|
| 29 |
+
degrees: 0.0
|
| 30 |
+
shear: 0.0
|
| 31 |
+
perspective: 0.0
|
| 32 |
+
|
| 33 |
+
# Early stopping
|
| 34 |
+
patience: 150
|
| 35 |
+
|
| 36 |
+
# Checkpointing and saving
|
| 37 |
+
save: true
|
| 38 |
+
save_period: 1
|
| 39 |
+
|
| 40 |
+
# Logging and experiment naming
|
| 41 |
+
project: project
|
| 42 |
+
name: name
|
configs/yolov11_x.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ====================================================
|
| 2 |
+
# Model Configuration Overrides for YOLOv11 X
|
| 3 |
+
# ====================================================
|
| 4 |
+
|
| 5 |
+
# Model checkpoint to start from
|
| 6 |
+
model: "/path/to/last.pt"
|
| 7 |
+
|
| 8 |
+
# Dataset configuration
|
| 9 |
+
data: "/path/to/data.yaml"
|
| 10 |
+
|
| 11 |
+
# Hardware
|
| 12 |
+
device: [0, 1] # Use GPUs 0 and 1
|
| 13 |
+
seed: 42
|
| 14 |
+
|
| 15 |
+
# Training hyperparameters
|
| 16 |
+
epochs: 150
|
| 17 |
+
batch: 16
|
| 18 |
+
imgsz: 640
|
| 19 |
+
optimizer: AdamW
|
| 20 |
+
cos_lr: true
|
| 21 |
+
amp: false
|
| 22 |
+
resume: true
|
| 23 |
+
|
| 24 |
+
# Augmentation parameters
|
| 25 |
+
mosaic: 0.0
|
| 26 |
+
mixup: 0.0
|
| 27 |
+
auto_augment: null
|
| 28 |
+
flipud: 0.0
|
| 29 |
+
degrees: 0.0
|
| 30 |
+
shear: 0.0
|
| 31 |
+
perspective: 0.0
|
| 32 |
+
|
| 33 |
+
# Early stopping
|
| 34 |
+
patience: 150
|
| 35 |
+
|
| 36 |
+
# Checkpointing and saving
|
| 37 |
+
save: true
|
| 38 |
+
save_period: 1
|
| 39 |
+
|
| 40 |
+
# Logging and experiment naming
|
| 41 |
+
project: project
|
| 42 |
+
name: name
|