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
↓ 4 callers
Method
_mc
(self, **kwargs)
tests/models/test_config.py:390
↓ 4 callers
Function
_nonempty_file_exists
Check whether a file exists and contains at least one byte. Returns ``False`` for a missing or empty file so callers can trigger a re-downloa
src/rfdetr/datasets/_develop.py:75
↓ 4 callers
Function
_numpy_allow_pickle
Temporarily patch :func:`numpy.load` to set ``allow_pickle=True``. ``onnx2tf`` 1.x calls ``np.load()`` on its bundled calibration data without pa
src/rfdetr/export/_tflite/converter.py:515
↓ 4 callers
Function
_read_metrics_csv
Read a PTL CSVLogger metrics file and return both step-level and epoch-averaged DataFrames. Returns: A ``(raw_df, epoch_df)`` pair where
src/rfdetr/visualize/training.py:198
↓ 4 callers
Function
_replace_gridsample_for_tflite
Rewrite every GridSample node in *onnx_path* to use TFLite-safe ops. ``onnx2tf``'s built-in GridSample handler lowers to ``tf.gather_nd(batch_dim
src/rfdetr/export/_tflite/converter.py:401
↓ 4 callers
Method
_rescale_accumulated_gradients
Rescale gradients already accumulated in the current optimizer window. Args: scale: Multiplicative factor that converts previous
src/rfdetr/training/module_model.py:333
↓ 4 callers
Function
_resolve_augmentation_backend
Resolve ``"auto"`` to ``"cpu"`` or ``"gpu"`` based on runtime availability. For ``"cpu"`` and ``"gpu"`` the value is returned unchanged. For ``"
src/rfdetr/training/module_data.py:107
↓ 4 callers
Method
_run
Run deploy.export.main(args) with all heavy dependencies mocked. Stubs out build_model, make_infer_image, and export_onnx, and injects mock o
tests/export/test_export.py:280
↓ 4 callers
Method
_run_test_step
(self, tmp_path)
tests/training/test_module_model.py:1295
↓ 4 callers
Method
_sanitize_cost_matrix
Replace non-finite cost entries with a large finite sentinel. >>> HungarianMatcher._sanitize_cost_matrix( ... torch.tensor([[1.0,
src/rfdetr/models/matcher.py:97
↓ 4 callers
Function
_save_rgb_image
Write a small solid-colour RGB JPEG to *path*.
tests/export/test_tflite_inference.py:88
↓ 4 callers
Method
_setup_dm_with_test
(self, tmp_path, dataset_length=30, batch_size=2, num_workers=0)
tests/training/test_module_data.py:810
↓ 4 callers
Method
_setup_with_mock
Helper: construct DataModule and call setup(stage) with build_dataset mocked.
tests/training/test_module_data.py:396
↓ 4 callers
Function
_suppress_pretrain_io
Suppress download/validate/file-existence side effects on the canonical load path.
tests/training/test_load_pretrain_weights.py:100
↓ 4 callers
Function
_to_active_first
Strip the leading background slot from a bg-first schema. Always returns a new list. A no-op (copy) when *schema* is already active-first or
src/rfdetr/utilities/keypoints.py:43
↓ 4 callers
Method
_write_coco_categories
Write a minimal COCO annotation file with provided categories.
tests/training/test_detr_shim.py:1785
↓ 4 callers
Function
_write_minimal_roboflow_yolo_dataset
Create a minimal Roboflow YOLO dataset root.
tests/datasets/test_yolo.py:25
↓ 4 callers
Function
compute_multi_scale_scales
( resolution: int, expanded_scales: bool = False, patch_size: int = 16, num_windows: int = 4,
src/rfdetr/datasets/coco.py:113
↓ 4 callers
Function
contrib
(gathered: Any, wx: Any, wy: Any, name: str)
src/rfdetr/export/_tflite/converter.py:369
↓ 4 callers
Function
export_onnx
Export a model to ONNX. Args: output_dir: Directory where the ONNX file will be written. model: Model to export. input_na
src/rfdetr/export/_onnx/exporter.py:52
↓ 4 callers
Function
flat_global_index
(xc: Any, yc: Any, name: str)
src/rfdetr/export/_tflite/converter.py:337
↓ 4 callers
Function
gather_flat
(gidx: Any, name: str)
src/rfdetr/export/_tflite/converter.py:355
↓ 4 callers
Function
get_norm
Args: norm: Either one of BN, SyncBN, FrozenBN, GN; or a callable that takes a channel number and returns the normalization l
src/rfdetr/models/backbone/projector.py:47
↓ 4 callers
Function
get_world_size
Return the number of processes in the current distributed group.
src/rfdetr/utilities/distributed.py:31
↓ 4 callers
Function
int_shifted_clamped
(coord_f: Any, clamp_max: Any, name: str)
src/rfdetr/export/_tflite/converter.py:308
↓ 4 callers
Function
is_valid_yolo_dataset
Checks if the specified dataset directory is in yolo format. We accept a dataset to be in yolo format if the following conditions are met: -
src/rfdetr/datasets/yolo.py:588
↓ 4 callers
Method
maybe_download_pretrain_weights
Skip weight download in tests.
tests/inference/helpers.py:96
↓ 4 callers
Method
on_train_batch_end
Accumulate train predictions for optional train-split mAP logging. Args: trainer: The PTL Trainer. pl_module: The Lig
src/rfdetr/training/callbacks/coco_eval.py:277
↓ 4 callers
Method
on_train_batch_start
Apply the scheduled rates for the current global step. Args: trainer: The Lightning Trainer instance. pl_module: The
src/rfdetr/training/callbacks/drop_schedule.py:85
↓ 4 callers
Function
plot_metrics
Read a PTL ``CSVLogger`` metrics file and build a training plot. The figure contains one subplot per metric group (loss, detection metrics, k
src/rfdetr/visualize/training.py:441
↓ 4 callers
Method
predict_step
Run inference on a preprocessed batch and return postprocessed results. Args: batch: Tuple of (NestedTensor samples, list of targ
src/rfdetr/training/module_model.py:659
↓ 4 callers
Method
reinitialize_detection_head
Resize the detection classification head to *num_classes* outputs. Replaces ``self.class_embed`` (and each ``enc_out_class_embed`` when the m
src/rfdetr/models/lwdetr.py:224
↓ 4 callers
Method
reinitialize_detection_head
(self, *args, **kwargs)
tests/training/helpers.py:41
↓ 4 callers
Method
reset
Clear accumulated predictions. Examples: >>> from unittest.mock import MagicMock >>> metric = MetricKeypointOKS(Magic
src/rfdetr/evaluation/keypoint_oks.py:161
↓ 4 callers
Method
summary
(self)
src/rfdetr/training/model_ema.py:95
↓ 4 callers
Method
synchronize
( self, )
src/rfdetr/export/benchmark.py:284
↓ 4 callers
Method
test_dataloader
Return the test DataLoader. Returns: DataLoader for the test dataset with sequential sampling.
src/rfdetr/training/module_data.py:332
↓ 4 callers
Method
time
( self, )
src/rfdetr/export/benchmark.py:352
↓ 4 callers
Method
transfer_batch_to_device
Move a ``(NestedTensor, targets)`` batch to *device*. PTL's default iterates tuple elements and calls ``.to(device)``; that works for plain t
src/rfdetr/training/module_data.py:673
↓ 3 callers
Method
__init__
(self, input_dim: int, hidden_dim: int, output_dim: int, num_layers: int)
src/rfdetr/models/transformer.py:38
↓ 3 callers
Method
_avg_fn
Compute the EMA update for a single parameter tensor. Matches the ``ModelEma`` formula where ``updates`` is 1-indexed: PTL's ``num_averaged``
src/rfdetr/training/callbacks/ema.py:55
↓ 3 callers
Function
_base_outputs
Build minimal detection outputs used across matcher keypoint tests.
tests/models/test_matcher_keypoints.py:13
↓ 3 callers
Method
_bool_mask
Return a [1, h, w] boolean mask with the specified region set to True.
tests/evaluation/test_evaluation.py:31
↓ 3 callers
Method
_boxes
Return an [N, 4] float32 tensor from a sequence of [x1,y1,x2,y2] rows.
tests/evaluation/test_evaluation.py:89
↓ 3 callers
Method
_build_dm
(self, tmp_path, *, use_grouppose_keypoints: bool, augmentation_backend: str = "cpu")
tests/training/test_module_data.py:499
↓ 3 callers
Method
_build_dm
(self, tmp_path, augmentation_backend="auto")
tests/training/test_module_data.py:1420
↓ 3 callers
Function
_build_keypoint_cat2label
Map COCO category ids onto model label slots that have keypoint capacity. RF-DETR keypoint schemas are indexed by model label. The preview person
src/rfdetr/datasets/coco.py:57
↓ 3 callers
Function
_build_yolo_samples
Build the class list and sample list shared by both YOLO builder functions. Iterates over every image in ``img_folder``, reads image dimensions v
src/rfdetr/datasets/yolo.py:339
↓ 3 callers
Function
_ckpt_with_model_name
Fake checkpoint with model_name key (new format).
tests/inference/test_from_checkpoint.py:330
↓ 3 callers
Method
_collect_links
Instantiate a minimal parser and collect registered link sources.
tests/training/test_cli.py:73
↓ 3 callers
Method
_compute_and_log_keypoint_map
Compute and log OKS keypoint AP/AR metrics when keypoint mode is active. Args: split: Internal metric split (``"val"``, ``"val_em
src/rfdetr/training/callbacks/coco_eval.py:891
↓ 3 callers
Method
_depthwise_conv
(self, x: torch.Tensor)
src/rfdetr/models/heads/segmentation.py:154
↓ 3 callers
Function
_ema_callback
Return a mock that ``_get_ema_callback`` recognises (has ``get_ema_model_state_dict``).
tests/training/callbacks/test_coco_eval_callback.py:1268
↓ 3 callers
Function
_extract_yolo_class_names
Read class names from a YOLO ``data.yaml`` file.
src/rfdetr/datasets/yolo.py:101
↓ 3 callers
Function
_fake_criterion
Return a MagicMock criterion with a realistic weight_dict.
tests/training/test_module_model.py:71
↓ 3 callers
Function
_fake_postprocess
Return a callable MagicMock for postprocess.
tests/training/test_module_model.py:79
↓ 3 callers
Function
_filter_keypoint_hflip_entries
Filter ordered single-key augmentation entries.
src/rfdetr/datasets/_aug_utils.py:64
↓ 3 callers
Function
_fit_and_read_csv
Run 1 epoch (2 train + 2 val batches) and return the resulting metrics.csv.
tests/training/test_metrics_csv.py:36
↓ 3 callers
Function
_has_cuda_device
Return ``True`` when the runtime has a CUDA accelerator available. Uses the fork-safe global ``DEVICE`` constant instead of direct ``torch.cuda.i
src/rfdetr/training/module_data.py:32
↓ 3 callers
Function
_infer_keypoint_counts_by_category
Infer keypoint count for each category from COCO category metadata or annotations.
src/rfdetr/evaluation/coco_eval.py:134
↓ 3 callers
Function
_keypoint_tensor
Build a zero keypoint prediction tensor with the shape expected by _aggregate_keypoint_class_logits. The second-to-last dimension must equal num_
tests/models/heads/test_detection_head.py:103
↓ 3 callers
Method
_make_args
Return minimal args consumed by ``build_roboflow_from_coco`` in keypoint mode.
tests/datasets/test_coco.py:316
↓ 3 callers
Method
_make_args_dict_checkpoint
Build a checkpoint with labelled query weights and dict-style args.
tests/models/test_weights.py:764
↓ 3 callers
Function
_make_keypoint_lwdetr
Construct a minimal keypoint-capable LWDETR with detection head resized to num_classes+1. Mirrors what happens after loading a pretrained checkpo
tests/models/heads/test_detection_head.py:60
↓ 3 callers
Method
_make_minimal_ckpt
Write a minimal checkpoint to a temp file.
tests/utilities/test_state_dict.py:457
↓ 3 callers
Method
_make_module_inputs
Build minimal valid inputs for MSDeformAttn.forward. Returns: Tuple of (query, reference_points, input_flatten,
tests/models/test_transformer.py:261
↓ 3 callers
Method
_make_module_with_trainer
Build a module with a stub trainer exposing ``num_training_batches`` for the test scenario.
tests/training/test_module_model.py:1033
↓ 3 callers
Method
_make_target
(self)
tests/datasets/test_augmentations.py:1941
↓ 3 callers
Method
_make_targets_with_masks
Build target dicts with boolean mask tensors for given instance counts.
tests/datasets/test_kornia_transforms.py:533
↓ 3 callers
Function
_match_single_class
Greedy highest-score-first matching for one class in one image. Implements the COCO matching algorithm: each GT is matched at most once; detectio
src/rfdetr/evaluation/matching.py:52
↓ 3 callers
Function
_merge_category_keypoint_flip_pairs
Return one global flip-pair list when all keypoint categories agree.
src/rfdetr/datasets/_keypoint_schema.py:275
↓ 3 callers
Function
_metric_with_state
Mock MeanAveragePrecision carrying minimal per-image state lists (one entry each).
tests/training/callbacks/test_coco_eval_callback.py:1357
↓ 3 callers
Function
_plot_map_columns
Plot mAP metrics on a single axes with line style by split.
src/rfdetr/visualize/training.py:414
↓ 3 callers
Function
_plot_metric_groups
Build a figure for grouped metrics.
src/rfdetr/visualize/training.py:254
↓ 3 callers
Function
_pytorch_preprocess
Mirror of the PyTorch predict() preprocessing: to_tensor -> resize -> normalize.
tests/export/test_tflite_inference_parity.py:43
↓ 3 callers
Function
_require_kornia
Verify that Kornia is importable, raising a clear error if not. Raises: ImportError: When ``kornia`` is not installed, with an install hi
src/rfdetr/datasets/kornia_transforms.py:125
↓ 3 callers
Method
_resolve_category_id
Resolve a predicted label to a COCO category_id.
src/rfdetr/evaluation/coco_eval.py:385
↓ 3 callers
Function
_resolve_runtime_augmentation_backend
Resolve ``augmentation_backend`` at runtime for dataset builders. Thin wrapper around :func:`rfdetr.datasets.kornia_transforms.resolve_augmentati
src/rfdetr/datasets/coco.py:776
↓ 3 callers
Function
_safe_multinormalize
Clamp a MultiheadAttention head count to at least one.
src/rfdetr/models/transformer.py:30
↓ 3 callers
Method
_set_class_names
Update class names and keep args.num_classes in sync.
tests/training/test_detr_shim.py:1498
↓ 3 callers
Method
_should_use_raw_category_ids
Detect whether model predictions are already raw COCO category IDs.
src/rfdetr/evaluation/coco_eval.py:396
↓ 3 callers
Method
_tc
(self, tmp_path, **kwargs)
tests/models/test_config.py:364
↓ 3 callers
Function
_tflite_preprocess_to_nchw
Call ``_preprocess_image`` and convert NHWC -> NCHW for apples-to-apples comparison.
tests/export/test_tflite_inference_parity.py:51
↓ 3 callers
Function
_write_roboflow_keypoint_coco
Write a minimal Roboflow-style COCO keypoint split.
tests/datasets/test_coco.py:143
↓ 3 callers
Function
_write_yolo_segmentation_dataset
Create a minimal YOLO segmentation dataset on disk.
tests/datasets/test_yolo.py:35
↓ 3 callers
Function
active_keypoint_counts
Return non-zero keypoint counts from a model schema. Args: num_keypoints_per_class: Model keypoint schema. Returns: Positive
src/rfdetr/datasets/_keypoint_schema.py:506
↓ 3 callers
Function
build_coco
(image_set: str, args: Any, resolution: int)
src/rfdetr/datasets/coco.py:691
↓ 3 callers
Function
build_namespace
Build a ``types.SimpleNamespace`` from Pydantic model and train configs. .. deprecated:: 1.7.0 ``build_namespace`` is a backward-compatib
src/rfdetr/_namespace.py:176
↓ 3 callers
Function
build_o365_raw
(image_set: str, args: Any, resolution: int)
src/rfdetr/datasets/o365.py:24
↓ 3 callers
Function
build_roboflow
Build a Roboflow dataset, auto-detecting COCO or YOLO format. This function detects the dataset format and delegates to the appropriate builder f
src/rfdetr/datasets/__init__.py:74
↓ 3 callers
Method
clip_gradients
Override PTL gradient clipping to support fused AdamW. PTL's AMP precision plugin refuses to clip gradients when the optimizer declares it ha
src/rfdetr/training/module_model.py:605
↓ 3 callers
Function
gen_sineembed_for_position
(pos_tensor: Tensor, dim: int = 128)
src/rfdetr/models/transformer.py:50
↓ 3 callers
Method
get_loss
(self, loss, outputs, targets, indices, num_boxes, **kwargs)
src/rfdetr/models/criterion.py:592
↓ 3 callers
Function
infer_transforms
()
src/rfdetr/export/benchmark.py:52
↓ 3 callers
Function
is_valid_coco_dataset
(dataset_dir: str)
src/rfdetr/datasets/coco.py:39
↓ 3 callers
Function
make_infer_image
(infer_dir, shape, batch_size, device="cuda", num_channels: int = 3)
src/rfdetr/export/main.py:31
↓ 3 callers
Method
on_fit_start
Seed RNGs at fit start when ``TrainConfig.seed`` is set. This avoids hidden global side-effects in ``build_trainer`` while still preserving d
src/rfdetr/training/module_model.py:119
↓ 3 callers
Method
on_train_epoch_start
(self, trainer, pl_module)
tests/training/callbacks/test_best_model_callback.py:122
↓ 3 callers
Function
patched_pycocotools_summarize
Compute and display summary metrics for evaluation results.
src/rfdetr/evaluation/coco_eval.py:641
↓ 3 callers
Method
prepare
Convert predictions to COCO format for the given iou_type.
src/rfdetr/evaluation/coco_eval.py:530
← previous
next →
301–400 of 3,167, ranked by callers