Jisnu Kalita Claude Sonnet 4.6 commited on
Commit ·
f88d737
1
Parent(s): 52674e0
optimized hyperparams: cosine LR, copy_paste, augmentation tuning, 100 epochs
Browse files
main.py
CHANGED
|
@@ -12,12 +12,38 @@ def train():
|
|
| 12 |
|
| 13 |
results = model.train(
|
| 14 |
data=str(DATASET_YAML),
|
| 15 |
-
epochs=
|
| 16 |
imgsz=1280,
|
| 17 |
-
batch=
|
| 18 |
project=str(RUNS_DIR),
|
| 19 |
name="pothole",
|
| 20 |
exist_ok=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
print(f"Training complete. Results saved to: {results.save_dir}")
|
|
|
|
| 12 |
|
| 13 |
results = model.train(
|
| 14 |
data=str(DATASET_YAML),
|
| 15 |
+
epochs=100,
|
| 16 |
imgsz=1280,
|
| 17 |
+
batch=64,
|
| 18 |
project=str(RUNS_DIR),
|
| 19 |
name="pothole",
|
| 20 |
exist_ok=True,
|
| 21 |
+
|
| 22 |
+
# LR scheduling — cosine annealing with warmup
|
| 23 |
+
lr0=0.001,
|
| 24 |
+
lrf=0.01,
|
| 25 |
+
warmup_epochs=3,
|
| 26 |
+
warmup_momentum=0.8,
|
| 27 |
+
cos_lr=True,
|
| 28 |
+
|
| 29 |
+
# Regularization
|
| 30 |
+
weight_decay=0.0005,
|
| 31 |
+
dropout=0.0,
|
| 32 |
+
patience=50,
|
| 33 |
+
|
| 34 |
+
# Augmentation — tuned for road/pothole data
|
| 35 |
+
mosaic=1.0,
|
| 36 |
+
copy_paste=0.3, # paste potholes onto new backgrounds
|
| 37 |
+
degrees=5.0, # slight rotation (roads tilt a bit)
|
| 38 |
+
scale=0.5, # scale jitter
|
| 39 |
+
fliplr=0.5, # horizontal flip
|
| 40 |
+
flipud=0.0, # roads are always right-side up
|
| 41 |
+
hsv_h=0.015, # hue jitter (lighting conditions)
|
| 42 |
+
hsv_s=0.7, # saturation jitter (wet/dry roads)
|
| 43 |
+
hsv_v=0.4, # brightness jitter (day/night)
|
| 44 |
+
translate=0.1,
|
| 45 |
+
perspective=0.0, # road camera is always flat
|
| 46 |
+
mixup=0.1, # blend images for harder examples
|
| 47 |
)
|
| 48 |
|
| 49 |
print(f"Training complete. Results saved to: {results.save_dir}")
|