[build-system] requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] name = "rfdetr" version = "1.8.3" description = "RF-DETR" readme = "README.md" authors = [ {name = "Roboflow, Inc", email = "develop@roboflow.com"} ] license = {text = "Apache License 2.0"} requires-python = ">=3.10" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Typing :: Typed", "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS" ] keywords = ["machine-learning", "deep-learning", "vision", "ML", "DL", "AI", "DETR", "RF-DETR", "Roboflow"] dependencies = [ "requests", # weight download from remote URLs "numpy", # array conversion throughout inference, evaluation, export, and visualization "torch>=2.2.0", # core tensor ops and model forward pass "torchvision>=0.17.0", # image transforms and ops (aligned with torch>=2.2.0) "tqdm", # progress bars during weight download "transformers>=5.1.0,<6.0.0", # DINOv2 backbone loading "pydantic>=2.0,<3", # ModelConfig / TrainConfig validation "supervision>=0.29.0", # inference output (Detections, Masks) "pyDeprecate>=0.9,<0.10", # deprecation warnings for legacy APIs; >=0.6 for deprecated_class ] [project.optional-dependencies] lora = [ "peft", # LoRA backbone fine-tuning ] train = [ "peft", # LoRA backbone fine-tuning (available during training) "pytorch_lightning>=2.6,<3,!=2.6.2,!=2.6.3", # Keep exclusions; see issue #1016 / related advisory for why 2.6.2 and 2.6.3 are blocked "torchmetrics[detection]>=1.2", "faster-coco-eval>=1.7.2", "pycocotools", "scipy", "albumentations>=1.4.24,<3.0.0", "roboflow", "rf100vl", ] onnx = [ "onnx>=1.16.0,<2.0", "onnxsim<0.6.0", # TODO: onnxsim 0.6.0+ hangs on install "onnx_graphsurgeon", "onnxruntime", "polygraphy", ] trt = [ "pycuda", "onnxruntime-gpu", "tensorrt>=8.6.1", "polygraphy", ] tflite = [ "onnx2tf>=2.4.0,<3.0.0; python_version >= '3.12' and python_version < '3.13'", "flatbuffers>=23.5.26; python_version >= '3.12' and python_version < '3.13'", "onnx>=1.20.0,<2.0; python_version >= '3.12' and python_version < '3.13'", "tf-keras>=2.16.0; python_version >= '3.12' and python_version < '3.13'", "tensorflow>=2.16.0; python_version >= '3.12' and python_version < '3.13'", ] kornia = [ "kornia>=0.7,<1", # GPU-side augmentation via on_after_batch_transfer ] loggers = [ "tensorboard>=2.13.0", "protobuf>=3.20.0", # Cap <4.0.0 removed — tensorflow>=2.16.0 (required by [tflite]) needs protobuf>=3.20.3 and is incompatible with <4.0.0 (see #1041) "wandb", "mlflow", "clearml", ] visual = [ "matplotlib", "pandas", "seaborn", ] cli = ["jsonargparse[signatures]>=4.27.7"] plus = ["rfdetr_plus>=1.0.1, <2.0.0"] [dependency-groups] # TODO: Temporary: GPU runner only has CUDA 12.8 driver (12080); torch>=2.11 requires a newer driver. # Remove this group and the --group ci-gpu-pin references in CI once the driver is updated. # Does not affect users installing rfdetr from PyPI. ci-gpu-pin = [ "torch<2.11", "torchvision<0.26", ] build = [ "twine>=5.1.1", "wheel>=0.40", "build>=0.10" ] tests = [ "pytest>=7.2,<10", "pytest-cov>=4,<8", "pytest-xdist>=3.6,<4", "pytest-rerunfailures>=10,<15", "pytest-timeout>=2,<3", "pytest-doctestplus>=1.2,<2", "tomli>=2.0; python_version < '3.11'", ] typing = [ # Keep this pin aligned with the local mypy hook in .pre-commit-config.yaml. "mypy==1.19.1", # mypy 1.19.x can crash while processing NumPy 2.4 symbols in strict mode. "numpy<2.4", "types-PyYAML", "types-requests", "types-tqdm", ] docs = [ "mkdocs-material[imaging]>=9.7", "mkdocstrings>=0.25.2,<0.30.0", "mkdocstrings-python>=1.10.9", "mike>=2.0.0", "mkdocs-jupyter>=0.24.3", "mkdocs-git-committers-plugin-2>=2.4.1", "mkdocs-git-revision-date-localized-plugin>=1.2.4", "tomli>=2.0; python_version < '3.11'", ] [project.urls] Homepage = "https://github.com/roboflow/rf-detr" [project.scripts] rfdetr = "rfdetr.cli:main" [tool.uv] # onnx2tf>=2.4.0 pins numpy==1.26.4 (exact). Its dependency ml-dtypes==0.5.1 in turn requires # numpy>=2.1.0 on python_full_version>='3.13' — contradicting the numpy==1.26.4 pin on 3.13. # tflite deps carry python_version>='3.12' and <'3.13' markers because onnx2tf's numpy pin # cannot be satisfied on 3.13 via any available release; when onnx2tf relaxes the exact pin, # remove the <'3.13' upper bound from the tflite deps AND from the override below. override-dependencies = [ "ml-dtypes==0.5.1; python_version >= '3.12' and python_version < '3.13'", ] [tool.setuptools.packages.find] where = ["src"] include = ["rfdetr*"] [tool.setuptools] include-package-data = false [tool.setuptools.package-data] rfdetr = ["py.typed", "models/backbone/dinov2_configs/*.json"] [tool.ruff] fix = true line-length = 120 target-version = "py310" [tool.ruff.lint] select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "I", # isort "N", # pep8-naming: lowercase variables (N806) and arguments (N803) ] extend-select = [ "RUF100", # yesqa ] ignore = [ "E722", # todo: Do not use bare `except` ] [tool.ruff.lint.per-file-ignores] "notebooks/*.py" = ["E402"] # cell-local imports are intentional in percent-format scripts "docs/cookbooks/*.ipynb" = [ "E402", # cell-local imports are intentional in percent-format scripts "E501", # jupytext notebook — markdown prose lines are intentionally unwrapped ] "docs/cookbooks/*.py" = [ "E402", # cell-local imports are intentional in percent-format scripts "E501", # .py mirror of jupytext notebook — markdown prose lines are intentionally unwrapped ] [tool.docformatter] wrap-summaries = 120 wrap-descriptions = 120 [tool.pytest.ini_options] addopts = [ "-v", # verbose output "--color=yes", # colored output "--doctest-plus", # run doctests from all modules (pytest-doctestplus) ] pythonpath = ["src"] markers = [ "gpu: tests that require GPU or are slow on CPU", "coco17: tests that require COCO 2017 images or annotations", "flaky: tests that may fail due to nondeterminism", "tflite: tests requiring onnx2tf and TFLite dependencies", ] filterwarnings = [ # pytest-xdist workers close their channel before teardown completes; # this is a known false-positive that does not affect test results. "ignore::pluggy.PluggyTeardownRaisedWarning", # Many tests instantiate ModelConfig variants with `pretrain_weights=None` # to skip downloads. The pretrain-compat warning is intentional UX for # end users; silence it globally for the test suite and re-enable it # explicitly in the dedicated tests via `warnings.catch_warnings` plus # `warnings.simplefilter("always")`. # NOTE: expressed as a message regex (not as # ``ignore::rfdetr.config.PretrainWeightsCompatibilityWarning``) because a # class-path filter forces pytest to import ``rfdetr.config`` at # config-parse time — before ``pytest-cov`` starts tracing — which makes # the module's top-level statements appear uncovered. "ignore:.*was instantiated with pretrain_weights=None:UserWarning", "ignore:.*was instantiated with overrides that differ from the variant:UserWarning", ] [tool.codespell] skip = "*.pth" [tool.mypy] python_version = "3.10" ignore_missing_imports = false explicit_package_bases = true strict = true mypy_path = "src" exclude = [ "^docs/(hooks|scripts)/", ] overrides = [ { module = [ "tests.*", "einops", "einops.*", "matplotlib", "matplotlib.*", "pandas", "pandas.*", "seaborn", "seaborn.*", ], ignore_errors = true }, { module = [ "torchvision", "torchvision.*", "pycocotools", "pycocotools.*", "timm", "timm.*", "einops", "einops.*", "deprecate", "deprecate.*", "faster_coco_eval", "faster_coco_eval.*", "matplotlib", "matplotlib.*", "pandas", "pandas.*", "requests", "requests.*", "seaborn", "seaborn.*", "tqdm", "tqdm.*", "kornia", "kornia.*", "onnx", "onnx.*", "onnx2tf", "onnx2tf.*", "onnx_graphsurgeon", "onnx_graphsurgeon.*", "onnxruntime", "onnxruntime.*", "onnxsim", "onnxsim.*", "polygraphy", "polygraphy.*", "tensorrt", "tensorrt.*", "pycuda", "pycuda.*", "jsonargparse", "jsonargparse.*", "tflite_runtime", "tflite_runtime.*", "tensorflow", "tensorflow.*", "rfdetr_plus", "rfdetr_plus.*", ], ignore_missing_imports = true }, # Optional-import None assignments in console.py: type: ignore[assignment, misc] is needed when # rich IS installed (full-venv mypy sees the assignment error) but flagged as unused by the # pre-commit hook (which runs mypy with --ignore-missing-imports so rich types are unresolved). { module = ["rfdetr.utilities.console"], warn_unused_ignores = false }, # Modules with pre-existing type errors — ignored until incrementally fixed. { module = [ "rfdetr", "rfdetr._namespace", "rfdetr.assets.model_weights", "rfdetr.config", "rfdetr.datasets._develop", "rfdetr.datasets.coco", "rfdetr.datasets.save_grids", "rfdetr.datasets.synthetic", "rfdetr.datasets.transforms", "rfdetr.datasets.yolo", "rfdetr.detr", "rfdetr.training.callbacks.best_model", "rfdetr.training.callbacks.coco_eval", "rfdetr.training.callbacks.drop_schedule", "rfdetr.training.callbacks.ema", "rfdetr.training.cli", "rfdetr.training.model_ema", "rfdetr.training.module_data", "rfdetr.training.module_model", "rfdetr.training.trainer", "rfdetr.utilities.distributed", "rfdetr.utilities.logger", "rfdetr.utilities.state_dict", "rfdetr.utilities.tensors", "rfdetr.variants", ], ignore_errors = true }, ]