Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/roboflow/rf-detr
/ functions
Functions
3,167 in github.com/roboflow/rf-detr
⨍
Functions
3,167
◇
Types & classes
522
↳
Endpoints
92
↓ 101 callers
Method
to
Move tensors and mask to *device*. Args: device: Target device. **kwargs: Additional arguments forwarded to ``Tensor.to``.
src/rfdetr/utilities/tensors.py:69
↓ 100 callers
Function
build_trainer
Assemble a PTL ``Trainer`` with the full RF-DETR callback and logger stack. Resolves training precision from ``model_config.amp`` and device capa
src/rfdetr/training/trainer.py:136
↓ 99 callers
Function
_make_trainer
Create a minimal mock Trainer with controllable callback_metrics. Sets the attributes required by ModelCheckpoint and EarlyStopping skip-guards s
tests/training/callbacks/test_best_model_callback.py:28
↓ 85 callers
Method
info
(self, prefix="")
src/rfdetr/export/_onnx/exporter.py:231
↓ 83 callers
Function
_make_trainer
Return a minimal mock Trainer with an optional DataModule.
tests/training/callbacks/test_coco_eval_callback.py:28
↓ 82 callers
Method
train
Train an RF-DETR model via the PyTorch Lightning stack. All keyword arguments are forwarded to :meth:`get_train_config` to build a :class:`~r
src/rfdetr/detr.py:631
↓ 79 callers
Function
_make_pl_module
Create a minimal mock RFDETRModule with state_dict and train_config.
tests/training/callbacks/test_best_model_callback.py:59
↓ 75 callers
Function
_make_pl_module
Return a minimal mock LightningModule.
tests/training/callbacks/test_coco_eval_callback.py:23
↓ 69 callers
Function
_mc
Minimal RFDETRBaseConfig for tests.
tests/training/test_build_trainer.py:28
↓ 69 callers
Method
on_validation_end
Save best regular/EMA checkpoints when validation mAP improves. Delegates regular-model checkpoint management to the :class:`~pytorch_lightni
src/rfdetr/training/callbacks/best_model.py:399
↓ 67 callers
Function
_tc
Minimal TrainConfig for tests. Loggers are disabled by default to avoid requiring optional deps (tensorboard, wandb, mlflow) in the CPU test
tests/training/test_build_trainer.py:40
↓ 63 callers
Method
predict
Performs model inference on the input images. This method accepts a single image or a list of images in various formats (file path, image url
src/rfdetr/detr.py:1741
↓ 61 callers
Method
cpu
(self)
tests/export/test_export.py:61
↓ 58 callers
Function
op
(kind: str, ins: list[Any], outs: list[Any], attrs: dict[str, Any] | None = None)
src/rfdetr/export/_tflite/converter.py:152
↓ 57 callers
Function
v
(name: str, dtype: Any = np.float32, shape: list[int] | None = None)
src/rfdetr/export/_tflite/converter.py:142
↓ 56 callers
Function
load_pretrain_weights
Load pretrained checkpoint weights into *nn_model* in-place. Canonical implementation shared by the L1 facade (``_build_model_context`` in ``rfde
src/rfdetr/models/weights.py:259
↓ 53 callers
Function
_make_rfdetr_self
Return a MagicMock shaped like RFDETR with real config objects. No spec is used because RFDETR.model is set in __init__ (instance attr) and spec=
tests/training/test_detr_shim.py:61
↓ 50 callers
Method
update
No-op progress update for compatibility with tqdm.
tests/utilities/test_file_validation.py:37
↓ 49 callers
Method
device
(self)
tests/training/callbacks/test_ema_callback.py:31
↓ 45 callers
Function
base_model_config
Factory fixture — call with **overrides to get a minimal RFDETRBaseConfig.
tests/training/conftest.py:23
↓ 45 callers
Method
setup
Instantiate ``MeanAveragePrecision`` after DDP device placement. Args: trainer: The PTL Trainer. pl_module: The Light
src/rfdetr/training/callbacks/coco_eval.py:149
↓ 41 callers
Function
get_logger
Creates and configures a logger with stdout and stderr handlers. This function creates a logger that sends INFO and DEBUG level logs to stdout, a
src/rfdetr/utilities/logger.py:27
↓ 39 callers
Function
base_train_config
Factory fixture — call with **overrides to get a minimal TrainConfig. tmp_path is injected automatically so test methods do not need to declare i
tests/training/conftest.py:35
↓ 38 callers
Method
from_config
Build a list of :class:`AlbumentationsWrapper` instances from a config. Supports both a flat dictionary format (backward-compatible) and a li
src/rfdetr/datasets/transforms.py:881
↓ 35 callers
Function
_namespace_from_configs
Build a ``types.SimpleNamespace`` from configs and architectural defaults. This is the internal implementation behind :func:`build_namespace`. Ex
src/rfdetr/_namespace.py:115
↓ 33 callers
Method
any
Return whether any value is truthy.
tests/visualize/test_training.py:37
↓ 33 callers
Method
update
(self, model: torch.nn.Module)
src/rfdetr/training/model_ema.py:56
↓ 32 callers
Function
wrapper
(self: Any, *args: _P.args, **kwargs: _P.kwargs)
src/rfdetr/detr.py:219
↓ 31 callers
Method
optimize_for_inference
Optimize the model for inference with optional JIT compilation and dtype casting. Operations are wrapped in the correct CUDA device context t
src/rfdetr/detr.py:856
↓ 30 callers
Method
export
(self)
tests/inference/test_optimize_for_inference.py:27
↓ 29 callers
Function
_fake_dataset
Return a minimal ``_FakeDataset`` with a controllable length.
tests/training/test_module_data.py:86
↓ 28 callers
Function
build_module
Factory fixture — returns (module, fake_model, fake_criterion, fake_postprocess). build_model and build_criterion_and_postprocessors are mocked a
tests/training/test_module_model.py:191
↓ 27 callers
Function
_make_ns
Build a namespace suitable for builder functions.
tests/models/test_builder_characterization.py:35
↓ 27 callers
Method
on_validation_end
Compute effective mAP and delegate to parent stopping logic. Computes ``ema_mAP`` or ``max(regular_mAP, ema_mAP)`` depending on ``use_ema``,
src/rfdetr/training/callbacks/best_model.py:626
↓ 26 callers
Function
_fake_nn_model
Return a MagicMock that behaves enough like an LWDETR nn.Module. Returns: MagicMock with reinitialize_detection_head and load_state_dict
tests/models/test_weights.py:75
↓ 25 callers
Function
_build_module
Construct RFDETRModelModule with build_model_from_config and build_criterion_from_config mocked.
tests/training/test_module_model.py:84
↓ 24 callers
Function
_minimal_metrics
Return a minimal torchmetrics-style metrics dict.
tests/training/callbacks/test_coco_eval_callback.py:62
↓ 24 callers
Function
build_datamodule
Factory fixture — returns a constructed RFDETRDataModule. build_dataset is mocked automatically. tmp_path is injected automatically so test metho
tests/training/test_module_data.py:143
↓ 23 callers
Method
state_dict
Return callback state for checkpointing.
src/rfdetr/training/callbacks/ema.py:193
↓ 22 callers
Function
_summarize
(ap: int = 1, iou_thr: float | None = None, area_rng: str = "all", max_dets: int = 100)
src/rfdetr/evaluation/coco_eval.py:644
↓ 22 callers
Method
compute
Run OKS keypoint evaluation and return metric dict. Constructs a fresh :class:`~rfdetr.evaluation.coco_eval.CocoEvaluator`, replays a
src/rfdetr/evaluation/keypoint_oks.py:197
↓ 22 callers
Function
download_pretrain_weights
Download pretrained weights with optional MD5 validation. Download Priority Order: The function searches for models in the following orde
src/rfdetr/assets/model_weights.py:305
↓ 21 callers
Function
_call_from_checkpoint
Invoke RFDETR.from_checkpoint with torch.load mocked to return *ckpt* and the model class at *cls_patch_target* replaced by a MagicMock. Retu
tests/inference/test_from_checkpoint.py:43
↓ 21 callers
Function
_run_inference
Preprocess one image, run ONNX Runtime inference, and decode detections. Reads input shape from the session (NCHW ``float32``), resizes and norma
src/rfdetr/export/_onnx/inference.py:125
↓ 21 callers
Function
export_tflite
Convert an ONNX model to TFLite via ``onnx2tf``. Requires ``onnx2tf >= 2.4.0``. Uses the Python API with a NumPy compatibility shim. Args:
src/rfdetr/export/_tflite/converter.py:773
↓ 21 callers
Method
update
Accumulate per-batch predictions. Each call appends one batch; predictions are replayed in order inside :meth:`compute`. Predictions
src/rfdetr/evaluation/keypoint_oks.py:174
↓ 20 callers
Function
_base_model_config
Return a minimal RFDETRBaseConfig with pretrain_weights disabled.
tests/training/test_module_model.py:27
↓ 20 callers
Method
_tc
(self, tmp_path, **kwargs)
tests/models/test_config.py:214
↓ 20 callers
Method
eval
(self)
tests/export/test_export.py:58
↓ 20 callers
Method
from_checkpoint
Load an RF-DETR model from a training checkpoint, automatically inferring the model class. The correct subclass is resolved in order of prefe
src/rfdetr/detr.py:287
↓ 19 callers
Function
_build_train_resize_config
Build the training resize pipeline as an Albumentations config list. Expresses the ``RandomSelect(resize_a, Compose([resize_b1, crop, resize_b2])
src/rfdetr/datasets/coco.py:429
↓ 19 callers
Function
_make_batch
Build a (NestedTensor, targets) tuple for testing.
tests/training/test_module_model.py:136
↓ 19 callers
Function
build_model
(args: "BuilderArgs")
src/rfdetr/models/lwdetr.py:755
↓ 19 callers
Method
setup
Build datasets for the requested stage. PTL calls this on every process before the corresponding dataloader method. Datasets are built lazil
src/rfdetr/training/module_data.py:209
↓ 18 callers
Function
_base_model_config
Return a minimal RFDETRBaseConfig with pretrain_weights disabled.
tests/training/test_module_data.py:29
↓ 18 callers
Function
_base_train_config
Return a minimal TrainConfig suitable for unit tests.
tests/training/test_module_data.py:36
↓ 18 callers
Function
_base_train_config
Return a minimal TrainConfig suitable for unit tests.
tests/training/test_module_model.py:34
↓ 18 callers
Method
_capture
Instantiate ``config_cls(**kwargs)`` and return only the pretrain-compat warnings.
tests/models/test_config.py:659
↓ 18 callers
Function
_make_coco_gt
Return a minimal COCO ground-truth mock (for unit tests that patch evaluator).
tests/evaluation/test_keypoint_oks.py:27
↓ 18 callers
Function
c
(val: Any, dtype: Any = np.float32, name: str = "")
src/rfdetr/export/_tflite/converter.py:146
↓ 18 callers
Function
infer_coco_keypoint_schema
Infer a keypoint schema from a COCO annotation JSON file. Args: annotation_path: Path to a COCO annotation JSON file. keypoint_ok
src/rfdetr/datasets/_keypoint_schema.py:406
↓ 17 callers
Method
backward
Compute gradients with cuDNN disabled. Args: ctx: Autograd context with saved tensors and conv parameters. grad_outpu
src/rfdetr/models/heads/segmentation.py:71
↓ 17 callers
Function
build_criterion_and_postprocessors
(args: "BuilderArgs")
src/rfdetr/models/lwdetr.py:833
↓ 17 callers
Method
on_load_checkpoint
Auto-detect legacy formats and reconcile PE shapes at checkpoint load time. PTL calls this hook before applying ``checkpoint["state_dict"]``
src/rfdetr/training/module_model.py:676
↓ 17 callers
Method
update
Accumulate per-image predictions.
src/rfdetr/evaluation/coco_eval.py:408
↓ 17 callers
Function
validate_checkpoint_compatibility
Validate that a checkpoint is compatible with the model configuration. Checks for mismatches in ``segmentation_head`` and ``patch_size`` between
src/rfdetr/utilities/state_dict.py:248
↓ 16 callers
Method
__init__
(self, config)
src/rfdetr/models/backbone/dinov2_with_windowed_attn.py:669
↓ 16 callers
Function
_make_matching_entry
Return a compact matching dict as produced by ``build_matching_data()``.
tests/evaluation/test_evaluation.py:349
↓ 16 callers
Function
build_matching_data
Build compact per-class matching data from a batch of predictions and targets. Implements greedy highest-score-first matching compatible with the
src/rfdetr/evaluation/matching.py:127
↓ 16 callers
Function
convert_legacy_checkpoint
Convert a legacy RF-DETR ``.pth`` checkpoint to PTL ``.ckpt`` format. Loads a checkpoint saved by the pre-PTL ``engine.py`` training loop and rew
src/rfdetr/training/checkpoint.py:27
↓ 16 callers
Method
reset
( self, )
src/rfdetr/export/benchmark.py:347
↓ 16 callers
Method
state_dict
Return callback state including ``_best_ema``, ``_smoothed_regular``, and ``_best_raw_regular``. Extends the parent :class:`~pytorch_lightnin
src/rfdetr/training/callbacks/best_model.py:295
↓ 15 callers
Function
_call_manual_path
Force the manual gather-based code path by mocking input.device.type. The function checks ``input.device.type != "mps"`` to decide which branch t
tests/utilities/test_tensors.py:45
↓ 15 callers
Function
_grid_sample_reference
Ground-truth output from F.grid_sample for comparison.
tests/utilities/test_tensors.py:29
↓ 15 callers
Function
_make_interp
Build a mock TFLite interpreter with configurable I/O details.
tests/export/test_tflite_inference.py:59
↓ 15 callers
Function
_validate_shape_dims
Validate a user-supplied ``(height, width)`` shape tuple and return normalised plain-int dims. Args: shape: The raw value supplied by the
src/rfdetr/detr.py:105
↓ 15 callers
Function
build_kornia_pipeline
Build a Kornia ``AugmentationSequential`` from an aug_config dict. Each key in *aug_config* is looked up in ``_REGISTRY`` and instantiated with t
src/rfdetr/datasets/kornia_transforms.py:283
↓ 15 callers
Method
synchronize_between_processes
Merge image IDs and COCO result records across distributed processes. Each image ID is assigned to exactly one rank (first rank that reports
src/rfdetr/evaluation/coco_eval.py:417
↓ 14 callers
Function
_fmt
(v: float)
src/rfdetr/utilities/console.py:90
↓ 14 callers
Function
_labelled_query_tensor
Build a query embedding tensor where row ``g * num_queries + q`` encodes ``[g * 100 + q, 0, ...]``. This lets tests check the per-group ordering
tests/models/test_weights.py:596
↓ 14 callers
Function
merge_matching_data
Merge *new_data* into *accumulator* in place. Both arguments share the dict schema produced by ``build_matching_data()``: each class-keyed sub-di
src/rfdetr/evaluation/matching.py:250
↓ 14 callers
Method
training_step
Assert resize from on_train_batch_start propagated before calling super.
tests/training/test_trainer_smoke.py:321
↓ 13 callers
Function
_make_logits
Return (1, 10, 82) logits with one high-confidence entry when requested. Background fill is -10.0 so sigmoid scores are near zero (~0.0001) for a
tests/export/test_tflite_inference.py:47
↓ 13 callers
Function
convert_coco_poly_to_mask
Convert COCO segmentation annotations to a binary mask tensor of shape ``[N, H, W]``. Supports both polygon and RLE (Run-Length Encoding) annotat
src/rfdetr/datasets/coco.py:146
↓ 13 callers
Method
on_fit_end
Select the overall best model and optionally run test evaluation. Copies the winner (regular vs EMA, strict ``>`` for EMA) to ``checkpoint_be
src/rfdetr/training/callbacks/best_model.py:491
↓ 12 callers
Method
__new__
(cls, asset: ModelWeightAsset)
src/rfdetr/assets/model_weights.py:91
↓ 12 callers
Function
_build_model_context
Build a ModelContext from ModelConfig without using legacy main.py:Model. Replicates ``Model.__init__`` logic: builds the nn.Module, optionally l
src/rfdetr/inference.py:96
↓ 12 callers
Method
_make_pred
( boxes: list, scores: list, labels: list, masks: torch.Tensor | None = None,
tests/evaluation/test_evaluation.py:198
↓ 12 callers
Method
_make_target
( boxes: list, labels: list, iscrowd: list | None = None, masks: torch.Tensor
tests/evaluation/test_evaluation.py:214
↓ 12 callers
Function
_warn_deprecated_module
Emit a DeprecationWarning pointing users to the new module location. Args: old: Fully-qualified name of the deprecated module (e.g. ``rfd
src/rfdetr/utilities/decorators.py:15
↓ 12 callers
Method
accumulate
Accumulate per-image evaluation results into mean metrics.
src/rfdetr/evaluation/coco_eval.py:459
↓ 12 callers
Method
cleanup
(self, return_onnx=False)
src/rfdetr/export/_onnx/exporter.py:238
↓ 12 callers
Function
init_matching_accumulator
Return an empty matching accumulator compatible with ``merge_matching_data()``. Returns: Empty dict to be passed as the first argument to
src/rfdetr/evaluation/matching.py:241
↓ 12 callers
Method
load_state_dict
Restore callback state from checkpoints.
src/rfdetr/training/callbacks/ema.py:203
↓ 12 callers
Method
load_state_dict
Restore callback state from a Lightning checkpoint. Pops ``"_best_ema"``, ``"_smoothed_regular"``, and ``"_best_raw_regular"`` from a shallow
src/rfdetr/training/callbacks/best_model.py:312
↓ 12 callers
Function
make_coco_transforms
Build the standard COCO transform pipeline for a given dataset split. Returns a composed transform that resizes images to the target ``resolution
src/rfdetr/datasets/coco.py:507
↓ 12 callers
Function
make_coco_transforms_square_div_64
Create COCO transforms with square resizing where the output size is divisible by 64. This function builds a torchvision-style transform pipeline
src/rfdetr/datasets/coco.py:611
↓ 11 callers
Function
_is_rle
Check whether a COCO segmentation entry is in RLE format. RLE annotations are dicts with ``"counts"`` and ``"size"`` keys, as opposed to polygon
src/rfdetr/datasets/coco.py:130
↓ 11 callers
Function
_kp_tc
Minimal KeypointTrainConfig for tests that exercise keypoint model paths.
tests/training/test_build_trainer.py:61
↓ 11 callers
Function
_make_checkpoint
Build a minimal checkpoint dict with the given class count. Args: num_classes: Total classes including background (bias shape). n
tests/training/test_load_pretrain_weights.py:51
next →
1–100 of 3,167, ranked by callers