Recent Releases of rf-detr
rf-detr - RF-DETR 1.1.0
Changelog
https://github.com/user-attachments/assets/87a3cefe-f3d1-42df-a799-f1d45dddf75e
🚀 Added
- Early stopping - Early stopping monitors validation mAP and halts training if improvements remain below a threshold for a set number of epochs. This can reduce wasted computation once the model converges. Additional parameters—such as
early_stopping_patience,early_stopping_min_delta, andearly_stopping_use_ema—let you fine-tune the stopping behavior. (https://github.com/roboflow/rf-detr/pull/87)
```python from rfdetr import RFDETRBase
model = RFDETRBase()
model.train(datasetdir=<DATASETPATH>, epochs=12, batchsize=4, gradaccumsteps=4, earlystopping=True) ```
- Gradient checkpointing - Gradient checkpointing - Gradient checkpointing re-computes certain parts of the forward pass during backpropagation to reduce peak memory usage. This allows training larger models or higher batch sizes on limited GPU memory at the cost of slightly longer training time. Enable it by setting
gradient_checkpointing=True. (https://github.com/roboflow/rf-detr/pull/91)
```python from rfdetr import RFDETRBase
model = RFDETRBase()
model.train(datasetdir=<DATASETPATH>, epochs=12, batchsize=8, gradaccumsteps=2, gradientcheckpointing=True) ```
- Saving metrics - Training and validation metrics (e.g., losses, mAP) are now automatically saved to your output directory after training. (https://github.com/roboflow/rf-detr/pull/58)
Logging with TensorBoard - Added support for logging training progress and metrics to TensorBoard, providing live visualizations of your model’s performance. Simply pass
tensorboard=Trueto.train(), then runtensorboard --logdir <OUTPUT_DIR>to monitor. (https://github.com/roboflow/rf-detr/pull/62)Using TensorBoard with RF-DETR
TensorBoard logging requires additional packages. Install them with:
bash pip install "rfdetr[metrics]"To activate logging, pass the extra parameter
tensorboard=Trueto.train():```python from rfdetr import RFDETRBase
model = RFDETRBase()
model.train(datasetdir=<DATASETPATH>, epochs=12, batchsize=4, gradaccumsteps=4, tensorboard=True, outputdir=
) ``` To use TensorBoard locally, navigate to your project directory and run:
bash tensorboard --logdir <OUTPUT_DIR>Then open
http://localhost:6006/in your browser to view your logs.To use TensorBoard in Google Colab run:
bash %load_ext tensorboard %tensorboard --logdir <OUTPUT_DIR>
Logging with Weights and Biases - Integrated Weights and Biases (W&B) for collaborative, cloud-based experiment tracking. Passing wandb=True to .train() will automatically log metrics, hyperparameters, and system stats to your W&B project. (https://github.com/roboflow/rf-detr/pull/70)
Using Weights and Biases with RF-DETR
Weights and Biases logging requires additional packages. Install them with:
bash pip install "rfdetr[metrics]"Before using W&B, make sure you are logged in:
bash wandb loginYou can retrieve your API key at wandb.ai/authorize.
To activate logging, pass the extra parameter
wandb=Trueto.train():```python from rfdetr import RFDETRBase
model = RFDETRBase()
model.train(datasetdir=<DATASETPATH>, epochs=12, batchsize=4, gradaccumsteps=4, wandb=True, project=<PROJECTNAME>, run=
) ``` In W&B, projects are collections of related machine learning experiments, and runs are individual sessions where training or evaluation happens. If you don't specify a name for a run, W&B will assign a random one automatically.
Automated Python package publish - Implemented a GitHub Actions workflow to build and publish the
rfdetrpackage to PyPI on each new release, ensuring the latest version is immediately available. (https://github.com/roboflow/rf-detr/pull/71)
đź”§ Fixed
- Resume training - You can resume training from a previously saved checkpoint by passing the path to the
checkpoint.pthfile using theresumeargument. This is useful when training is interrupted or you want to continue fine-tuning an already partially trained model. The training loop will automatically load the weights and optimizer state from the provided checkpoint file. (https://github.com/roboflow/rf-detr/pull/88)
```python from rfdetr import RFDETRBase
model = RFDETRBase()
model.train(datasetdir=<DATASETPATH>, epochs=12, batchsize=4, gradaccumsteps=4, resume=<CHECKPOINTPATH>) ```
🏆 Contributors
@mario-dg (Mario da Graca), @onuralpszr (Onuralp SEZER), @farukalamai (Md Faruk Alam), @probicheaux (Peter Robicheaux), @isaacrob-roboflow (Isaac Robinson), @Matvezy (Matvei Popov), @SkalskiP (Piotr Skalski)
- Python
Published by SkalskiP 9 months ago