About
Train RF-DETR instance segmentation models
Train RF-DETR instance segmentation models.

🚀 Use with Ikomia API
1. Install Ikomia API
We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.
pip install ikomia
2. Create your workflow
from ikomia.dataprocess.workflow import Workflow# Init your workflowwf = Workflow()# Add COCO instance segmentation dataset loadercoco = wf.add_task(name="dataset_coco")coco.set_parameters({"json_file": "path/to/instances_train.json","image_folder": "path/to/images","task": "instance_segmentation",})# Add training algorithmtrain = wf.add_task(name="train_rf_detr_seg", auto_connect=True)# Launch trainingwf.run()
☀️ Use with Ikomia Studio
Ikomia Studio offers a friendly UI with the same features as the API.
- If you haven't started using Ikomia Studio yet, download and install it from this page.
- For additional guidance on getting started with Ikomia Studio, check out this blog post.
📝 Set algorithm parameters
model_name(str) - defaultrf-detr-seg-medium: Name of the RF-DETR segmentation model. Available models:rf-detr-seg-nanorf-detr-seg-smallrf-detr-seg-mediumrf-detr-seg-baserf-detr-seg-large
model_weight_file(str, optional): Path to custom starting weights.dataset_folder(str): Folder where the Ikomia dataset is converted to COCO format.batch_size(int) - default2: Number of samples processed before the model is updated.grad_accum_steps(int) - default4: Number of gradient accumulation steps.epochs(int) - default100: Number of complete passes through the training dataset.dataset_split_ratio(float) - default0.9: Ratio used to split the dataset into train and validation sets.input_size(int) - default576: Training image size. It is adjusted to the selected RF-DETR segmentation model block size when needed.workers(int) - default0: Number of worker threads for data loading. Use0on Windows if multiprocessing is unstable.weight_decay(float) - default1e-4: Weight decay regularization.lr(float) - default1e-4: Learning rate.lr_encoder(float) - default1.5e-4: Encoder learning rate.output_folder(str): Folder where training runs, weights, andclass_names.yamlare saved.early_stopping(bool) - defaultFalse: Stored for compatibility with the UI and future RF-DETR training options.early_stopping_patience(int) - default10: Stored with the training configuration when early stopping is enabled.
The training dataset must contain polygon instance masks. For Ikomia datasets, those masks are read from segmentation_poly and exported to COCO segmentation annotations.
Pretrained RF-DETR segmentation weights are cached in train_rf_detr_seg/weights, following the same local cache pattern as infer_rf_detr.
Parameters should be in strings format when added to the dictionary.
from ikomia.dataprocess.workflow import Workflow# Init your workflowwf = Workflow()# Add COCO instance segmentation dataset loadercoco = wf.add_task(name="dataset_coco")coco.set_parameters({"json_file": "path/to/instances_train.json","image_folder": "path/to/images","task": "instance_segmentation",})# Add training algorithmtrain = wf.add_task(name="train_rf_detr_seg", auto_connect=True)train.set_parameters({"model_name": "rf-detr-seg-medium","epochs": "100","batch_size": "2","grad_accum_steps": "4","input_size": "576","dataset_split_ratio": "0.9","workers": "0","weight_decay": "1e-4","lr": "1e-4","lr_encoder": "1.5e-4","output_folder": "path/to/output/folder",})# Launch trainingwf.run()
After training, use the generated weights and class_names.yaml with infer_rf_detr_seg.
Developer
Ikomia
License
Apache License 2.0
A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
| Permissions | Conditions | Limitations |
|---|---|---|
Commercial use | License and copyright notice | Trademark use |
Modification | State changes | Liability |
Distribution | Warranty | |
Patent use | ||
Private use |
This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.