RFDETRTrain
Python template · sinapsis_rfdetr.templates.rfdetr_train
Overview
A class that handles the training process for the RF-DETR model.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-rfdetr==1.0.0uv pip install sinapsis-rfdetr==1.0.0uv add sinapsis-rfdetr==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Specifies the callback function to be executed at specific stages during the training process. Default is "on_fit_epoch_end".
Optional
Default: "on_fit_epoch_end"
Optional
Default: null
Optional
Default: null
Optional
Default: true
Optional
Default: "cuda"
Optional
Default: "dinov2_windowed_small"
Optional
Default: 16
Optional
Default: 8
Optional
Default: true
Optional
Default: 3
Optional
Default: 13
Optional
Default: 256
Optional
Default: true
Optional
Default: 300
Optional
Default: 14
Optional
Default: 560
Optional
Default: 90
Optional
Default: 300
Optional
Default: 4
Optional
Default: true
Optional
Default: 2
Optional
Default: ["P4"]
Optional
Default: "rf-detr-base.pth"
Optional
Default: [2,5,8,11]
Optional
Default: true
Optional
Default: false
Optional
Default: 37
An instance of `TrainConfig` containing the training parameters for training the RF-DETR model. If not specified, default parameters will be used. Key parameters that can be included in `training_params` are: -… Read full field description
An instance of `TrainConfig` containing the training parameters for training the RF-DETR model. If not specified, default parameters will be used. Key parameters that can be included in `training_params` are: - `dataset_dir`: Path to the COCO-formatted dataset directory, containing `train`, `valid`, and `test` folders, each containing an `_annotations.coco.json` file. - `epochs`: Total number of training epochs. - `batch_size`: Number of samples per training iteration. Adjust based on available GPU memory and use in conjunction with `grad_accum_steps` to maintain the intended effective batch size. - `grad_accum_steps`: Number of mini-batches over which gradients are accumulated. This effectively increases the total batch size without requiring as much memory at once, making it useful for smaller GPUs - `lr`: Learning rate for optimization. - `resume`: Path to a saved checkpoint for resuming training. Note on memory usage: Adjust `batch_size` and `grad_accum_steps` based on GPU VRAM. For example: - On powerful GPUs like the A100, you can use `batch_size=16` and `grad_accum_steps=1`. - On smaller GPUs like the T4, you may want to use `batch_size=4` and `grad_accum_steps=4`. Complete documentation for the available training parameters and an example dataset structure can be found on the RF-DETR GitHub: https://github.com/roboflow/rf-detr/tree/main
Optional
Default: null
Optional
Default: 0.0001
Optional
Default: null
Optional
Default: false
Optional
Default: 100
Optional
Default: 100
Optional
Default: 100
Optional
Default: null
Optional
Default: true
Optional
Default: true
Optional
Default: 0
Optional
Default: 0.993
Optional
Default: 4
Optional
Default: 13
Optional
Default: 0.00015
Optional
Default: 300
Optional
Default: "output"
Optional
Default: null
Required
Default: null
Optional
Default: true
Optional
Default: true
Optional
Default: 2
Optional
Default: true
Optional
Default: "roboflow"
Optional
Default: 0.0001
Optional
Default: 1
Optional
Default: 0
Optional
Default: false
Optional
Default: true
Optional
Default: 4
Optional
Default: 0.7
Optional
Default: 0.8
Optional
Default: 10
Optional
Default: true
Optional
Default: false
Optional
Default: 10
Optional
Default: 0.001
Optional
Default: false
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: RFDETRTrain
class_name: RFDETRTrain
template_input: InputTemplate
attributes:
training_params:
dataset_dir: '/path/to/dataset'
epochs: 10
batch_size: 4
grad_accum_steps: 4
lr: 1e-4
early_stopping: True
resume: 'path/to/checkpoint'Show schema-based configuration skeleton
templates:
- template_name: "RFDETRTrain"
class_name: "RFDETRTrain"
attributes:
callback: "on_fit_epoch_end"
model_params:
amp: true
device: "cuda"
encoder: "dinov2_windowed_small"
ca_nheads: 16
sa_nheads: 8
two_stage: true
dec_layers: 3
group_detr: 13
hidden_dim: 256
layer_norm: true
num_select: 300
patch_size: 14
resolution: 560
num_classes: 90
num_queries: 300
num_windows: 4
bbox_reparam: true
dec_n_points: 2
projector_scale: ["P4"]
pretrain_weights: "rf-detr-base.pth"
out_feature_indexes: [2, 5, 8, 11]
lite_refpoint_refine: true
gradient_checkpointing: false
positional_encoding_size: 37
training_params:
lr: 0.0001
run: null
wandb: false
epochs: 100
ema_tau: 100
lr_drop: 100
project: null
use_ema: true
run_test: true
drop_path: 0
ema_decay: 0.993
batch_size: 4
group_detr: 13
lr_encoder: 0.00015
num_select: 300
output_dir: "output"
class_names: null
dataset_dir: "<required>"
ia_bce_loss: true
multi_scale: true
num_workers: 2
tensorboard: true
dataset_file: "roboflow"
weight_decay: 0.0001
cls_loss_coef: 1
warmup_epochs: 0
early_stopping: false
expanded_scales: true
grad_accum_steps: 4
lr_component_decay: 0.7
lr_vit_layer_decay: 0.8
checkpoint_interval: 10
square_resize_div_64: true
early_stopping_use_ema: false
early_stopping_patience: 10
early_stopping_min_delta: 0.001
do_random_resize_via_padding: false
Inheritance
sinapsis_rfdetr.templates.rfdetr_model_base.RFDETRModelBaseEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.