YOLOX Base Configuration System
Overview
This directory contains base experiment configurations for YOLOX models. These configurations define "protected" parameters that are preserved during transfer learning from COCO-pretrained models.
How It Works
Transfer Learning Flow
-
COCO Transfer Learning (
transfer_learning = 'coco'):- Loads base configuration from
data/yolox_*.pybased onselected_model - Base parameters are protected and used as defaults
- User settings from the form only override what's explicitly set
- Result: Best of both worlds - proven COCO settings + your customizations
- Loads base configuration from
-
Sketch/Custom Training (
transfer_learning = 'sketch'):- No base configuration loaded
- Uses only user-defined parameters from the training form
- Full control over all settings
Base Configuration Files
yolox_s.py- YOLOX-Small (depth=0.33, width=0.50)yolox_m.py- YOLOX-Medium (depth=0.67, width=0.75)yolox_l.py- YOLOX-Large (depth=1.0, width=1.0)yolox_x.py- YOLOX-XLarge (depth=1.33, width=1.25)
Protected Parameters
These parameters are defined in base configs and preserved unless explicitly overridden:
Model Architecture:
depth- Model depth multiplierwidth- Model width multiplieractivation- Activation function (silu)
Training Hyperparameters:
basic_lr_per_img- Learning rate per imagescheduler- LR scheduler (yoloxwarmcos)warmup_epochs- Warmup epochsmax_epoch- Maximum training epochsno_aug_epochs- No augmentation epochsmin_lr_ratio- Minimum LR ratio
Optimizer:
momentum- SGD momentumweight_decay- Weight decay
Augmentation:
mosaic_prob- Mosaic probabilitymixup_prob- Mixup probabilityhsv_prob- HSV augmentation probabilityflip_prob- Flip probabilitydegrees- Rotation degreestranslate- Translationshear- Shearmosaic_scale- Mosaic scale rangemixup_scale- Mixup scale rangeenable_mixup- Enable mixup
Input/Output:
input_size- Training input sizetest_size- Testing sizerandom_size- Random size range
Evaluation:
eval_interval- Evaluation intervalprint_interval- Print interval
Customizing Base Configurations
Adding a New Model
Create a new file data/yolox_MODELNAME.py:
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Base configuration for YOLOX-MODELNAME
class BaseExp:
"""Base experiment configuration for YOLOX-MODELNAME"""
# Define protected parameters
depth = 1.0
width = 1.0
# ... other parameters
Modifying Parameters
Edit the corresponding yolox_*.py file and update the BaseExp class attributes.
Example: To change YOLOX-S max epochs:
# In data/yolox_s.py
class BaseExp:
max_epoch = 500 # Changed from 300
# ... other parameters
Parameter Priority
The merge logic follows this priority (highest to lowest):
- User form values (if explicitly set, not None)
- Base config values (if transfer_learning='coco')
- Default fallbacks (hardcoded minimums)
Example
COCO Transfer Learning
User sets in form: max_epoch=100, depth=0.5
Base config (yolox_s.py) has: depth=0.33, width=0.50, max_epoch=300
Result: depth=0.5 (user override), width=0.50 (base), max_epoch=100 (user override)
Sketch Training
User sets in form: max_epoch=100, depth=0.5
No base config loaded
Result: depth=0.5 (user), max_epoch=100 (user), width=1.0 (default fallback)
Debugging
To see which base config was loaded, check Flask logs:
Loaded base config for yolox-s: ['depth', 'width', 'activation', ...]
If base config fails to load:
Warning: Could not load base config for yolox-s: [error message]
Falling back to custom settings only