RF-DETR supports custom data augmentations via Albumentations, with automatic bounding box and mask handling for geometric transforms. Albumentations 1.4.24+ and 2.x are supported.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/roboflow/rf-detr/llms.txt
Use this file to discover all available pages before exploring further.
Quick start
Passaug_config to your training call. The simplest approach is to use one of the built-in presets:
aug_config uses the default (horizontal flip at 50%).
Built-in presets
| Preset | Best for |
|---|---|
AUG_CONSERVATIVE | Small datasets (under 500 images) |
AUG_AGGRESSIVE | Large datasets (2000+ images) |
AUG_AERIAL | Satellite / overhead imagery |
AUG_INDUSTRIAL | Manufacturing / inspection data |
Recommendations by dataset size
| Dataset size | Recommended preset |
|---|---|
| Under 500 images | AUG_CONSERVATIVE — flip + mild brightness/contrast |
| 500–2000 images | Default or AUG_CONSERVATIVE with a few extra transforms added |
| 2000+ images | AUG_AGGRESSIVE — rotations, affine, color jitter |
Nested transforms
RF-DETR supportsOneOf, SomeOf, and Sequential container transforms from Albumentations. The most common pattern is OneOf, which randomly picks one transform from a group:
p controls its relative selection weight. The container itself always fires.
If you need the same transform twice, or want explicit ordering, pass a list instead of a dict:
Geometric vs. pixel-level transforms
RF-DETR automatically handles bounding boxes for geometric transforms (flips, rotations, crops, affine, perspective). Pixel-level transforms (blur, noise, color) preserve coordinates unchanged. You don’t need to handle this distinction — it’s automatic based on the transform name.Best practices
- CPU-bound: Augmentations run on CPU during data loading — more transforms means slower loading.
- Use
num_workers: Parallelize augmentation across DataLoader workers. - Monitor training mAP vs. validation mAP: A gap is expected with strong augmentations and is not a bug.
Advanced: custom transforms
Any Albumentations transform works by name. If your custom transform is geometric, register it inrfdetr/datasets/transforms.py so bounding boxes are updated automatically:
Troubleshooting
Training is slow — reduce the number of transforms or increasenum_workers.
Boxes disappear after augmentation — aggressive rotations or crops can push boxes outside the image boundary. Reduce rotation angles or avoid large crops.
Model not improving — augmentations may be too aggressive. Start with AUG_CONSERVATIVE and add transforms gradually. Try removing geometric transforms first to isolate the cause.
Validation mAP is much higher than training mAP — this is expected with strong augmentations and is not a bug.
Upgrading Albumentations to 2.x with existing RandomSizedCrop configs? RF-DETR automatically adapts height/width kwargs to the size=(height, width) format required by Albumentations 2.x. No config changes needed.