nitid 0.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. nitid-0.9.1/LICENSE +190 -0
  2. nitid-0.9.1/PKG-INFO +446 -0
  3. nitid-0.9.1/README.md +387 -0
  4. nitid-0.9.1/THIRD_PARTY_NOTICES.md +95 -0
  5. nitid-0.9.1/dfine/__init__.py +23 -0
  6. nitid-0.9.1/dfine/data/__init__.py +8 -0
  7. nitid-0.9.1/dfine/data/coco_names.yml +84 -0
  8. nitid-0.9.1/dfine/exporter.py +399 -0
  9. nitid-0.9.1/dfine/integrations/__init__.py +6 -0
  10. nitid-0.9.1/dfine/integrations/mlflow.py +198 -0
  11. nitid-0.9.1/dfine/integrations/wandb.py +152 -0
  12. nitid-0.9.1/dfine/media.py +130 -0
  13. nitid-0.9.1/dfine/model.py +834 -0
  14. nitid-0.9.1/dfine/nitid.py +153 -0
  15. nitid-0.9.1/dfine/nn/__init__.py +0 -0
  16. nitid-0.9.1/dfine/nn/architecture/__init__.py +15 -0
  17. nitid-0.9.1/dfine/nn/architecture/backbone.py +578 -0
  18. nitid-0.9.1/dfine/nn/architecture/common.py +122 -0
  19. nitid-0.9.1/dfine/nn/architecture/decoder.py +1285 -0
  20. nitid-0.9.1/dfine/nn/architecture/encoder.py +494 -0
  21. nitid-0.9.1/dfine/nn/architecture/model.py +51 -0
  22. nitid-0.9.1/dfine/nn/architecture/ops.py +478 -0
  23. nitid-0.9.1/dfine/nn/build.py +56 -0
  24. nitid-0.9.1/dfine/nn/configs.py +330 -0
  25. nitid-0.9.1/dfine/nn/criterion.py +15 -0
  26. nitid-0.9.1/dfine/nn/distributed.py +30 -0
  27. nitid-0.9.1/dfine/nn/losses/__init__.py +7 -0
  28. nitid-0.9.1/dfine/nn/losses/criterion.py +904 -0
  29. nitid-0.9.1/dfine/nn/losses/matcher.py +264 -0
  30. nitid-0.9.1/dfine/nn/losses/semantic.py +124 -0
  31. nitid-0.9.1/dfine/nn/native_build.py +236 -0
  32. nitid-0.9.1/dfine/nn/openvino_runtime.py +133 -0
  33. nitid-0.9.1/dfine/nn/postprocessor.py +165 -0
  34. nitid-0.9.1/dfine/nn/transfer.py +132 -0
  35. nitid-0.9.1/dfine/plotting.py +66 -0
  36. nitid-0.9.1/dfine/predictor.py +475 -0
  37. nitid-0.9.1/dfine/results.py +535 -0
  38. nitid-0.9.1/dfine/tasks.py +66 -0
  39. nitid-0.9.1/dfine/tracking.py +364 -0
  40. nitid-0.9.1/dfine/trainer.py +1894 -0
  41. nitid-0.9.1/dfine/training_recipes.py +311 -0
  42. nitid-0.9.1/dfine/utils/__init__.py +0 -0
  43. nitid-0.9.1/dfine/utils/augmentations.py +488 -0
  44. nitid-0.9.1/dfine/utils/checkpoint.py +138 -0
  45. nitid-0.9.1/dfine/utils/data.py +1124 -0
  46. nitid-0.9.1/dfine/utils/dataset_converter.py +221 -0
  47. nitid-0.9.1/dfine/utils/device.py +25 -0
  48. nitid-0.9.1/dfine/utils/downloads.py +324 -0
  49. nitid-0.9.1/dfine/utils/logging.py +19 -0
  50. nitid-0.9.1/dfine/utils/ops.py +83 -0
  51. nitid-0.9.1/dfine/utils/reporting.py +114 -0
  52. nitid-0.9.1/dfine/utils/runs.py +151 -0
  53. nitid-0.9.1/dfine/utils/sources.py +383 -0
  54. nitid-0.9.1/dfine/validator.py +904 -0
  55. nitid-0.9.1/nitid/__init__.py +15 -0
  56. nitid-0.9.1/nitid/cli.py +582 -0
  57. nitid-0.9.1/nitid/convert_checkpoint.py +162 -0
  58. nitid-0.9.1/nitid.egg-info/PKG-INFO +446 -0
  59. nitid-0.9.1/nitid.egg-info/SOURCES.txt +63 -0
  60. nitid-0.9.1/nitid.egg-info/dependency_links.txt +1 -0
  61. nitid-0.9.1/nitid.egg-info/entry_points.txt +3 -0
  62. nitid-0.9.1/nitid.egg-info/requires.txt +41 -0
  63. nitid-0.9.1/nitid.egg-info/top_level.txt +2 -0
  64. nitid-0.9.1/pyproject.toml +142 -0
  65. nitid-0.9.1/setup.cfg +4 -0
nitid-0.9.1/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for discussing and improving the Work, but excluding
59
+ communication that is conspicuously marked or otherwise designated in
60
+ writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on your own behalf and on your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 VERIFAIT AUTOMOTION INTELLIGENCE, S.L.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
nitid-0.9.1/PKG-INFO ADDED
@@ -0,0 +1,446 @@
1
+ Metadata-Version: 2.4
2
+ Name: nitid
3
+ Version: 0.9.1
4
+ Summary: Object detection, instance segmentation and semantic segmentation, Apache 2.0 code and weights
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://nitidio.github.io/nitid/
7
+ Project-URL: Documentation, https://nitidio.github.io/nitid/
8
+ Project-URL: Issues, https://github.com/Nitidio/nitid/issues
9
+ Project-URL: Repository, https://github.com/Nitidio/nitid
10
+ Project-URL: Changelog, https://github.com/Nitidio/nitid/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: <3.13,>=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: THIRD_PARTY_NOTICES.md
23
+ Requires-Dist: torch>=2.1
24
+ Requires-Dist: torchvision>=0.16
25
+ Requires-Dist: opencv-python-headless>=4.8
26
+ Requires-Dist: numpy>=1.24
27
+ Requires-Dist: pandas>=2.0
28
+ Requires-Dist: pillow>=10.0
29
+ Requires-Dist: mss>=10.0
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: matplotlib>=3.8
32
+ Requires-Dist: onnx>=1.15
33
+ Requires-Dist: onnxscript>=0.1
34
+ Requires-Dist: onnxsim<0.8,>=0.6.5
35
+ Requires-Dist: tqdm>=4.66
36
+ Requires-Dist: tensorboard>=2.14
37
+ Requires-Dist: scipy>=1.10
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0; extra == "dev"
40
+ Requires-Dist: pytest-cov; extra == "dev"
41
+ Requires-Dist: pycocotools>=2.0; extra == "dev"
42
+ Requires-Dist: ruff; extra == "dev"
43
+ Requires-Dist: mypy; extra == "dev"
44
+ Requires-Dist: mkdocs>=1.6; extra == "dev"
45
+ Requires-Dist: mkdocs-material>=9.5; extra == "dev"
46
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
47
+ Requires-Dist: types-PyYAML; extra == "dev"
48
+ Provides-Extra: train
49
+ Requires-Dist: pycocotools>=2.0; extra == "train"
50
+ Provides-Extra: track
51
+ Requires-Dist: trackers<3,>=2.5; extra == "track"
52
+ Provides-Extra: openvino
53
+ Requires-Dist: openvino>=2024.0; extra == "openvino"
54
+ Provides-Extra: wandb
55
+ Requires-Dist: wandb>=0.17; extra == "wandb"
56
+ Provides-Extra: mlflow
57
+ Requires-Dist: mlflow<4,>=2.14; extra == "mlflow"
58
+ Dynamic: license-file
59
+
60
+ <p align="center">
61
+ <picture>
62
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/brand/nitid-logo-on-dark.png">
63
+ <img src="https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/brand/nitid-logo-on-light.png" alt="nitid" width="280">
64
+ </picture>
65
+ </p>
66
+
67
+ <p align="center"><strong>One library. DETR made simple.</strong></p>
68
+
69
+ <p align="center">
70
+ <a href="https://nitidio.github.io/nitid/"><img src="https://img.shields.io/badge/docs-GitHub%20Pages-blue" alt="Documentation"></a>
71
+ <a href="https://github.com/Nitidio/nitid/blob/v0.9.1/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-green.svg" alt="License"></a>
72
+ <a href="#installation"><img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python"></a>
73
+ <a href="https://colab.research.google.com/github/Nitidio/nitid/blob/main/examples/notebooks/01_inference.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
74
+ </p>
75
+
76
+ Train, validate, export and run vision models. The code and the official
77
+ pretrained weights are released under the Apache License 2.0, so you can ship
78
+ them inside your own product without opening your code or paying for a license.
79
+
80
+ _nitid_, from Latin _nitidus_: clear, transparent, precise.
81
+
82
+ **No AGPL, no surprises.**
83
+
84
+ ![Object detection with model1m](https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/detect-ski.jpg)
85
+
86
+ <p align="center">
87
+ <a href="#installation">Installation</a> ·
88
+ <a href="#quick-start">Quick start</a> ·
89
+ <a href="#verified-models">Models</a> ·
90
+ <a href="#documentation">Documentation</a>
91
+ </p>
92
+
93
+ ## Why nitid?
94
+
95
+ - **Edge first.** The models are designed to run at the edge, on the hardware
96
+ next to your cameras, not only on a datacenter GPU or NPU.
97
+ - **Self-contained checkpoints.** Every checkpoint carries the config and the
98
+ class names it needs to be reproduced and checked — one file per model.
99
+ - **Handles messy datasets.** COCO and YOLO layouts are read directly, with no
100
+ conversion step, and the inconsistencies real datasets have are tolerated.
101
+ - **Export anywhere.** OpenVINO, ONNX, TorchScript and TensorRT, from the same
102
+ checkpoint.
103
+
104
+ ## One library, three tasks, five operations
105
+
106
+ Object detection, instance segmentation and semantic segmentation, through one
107
+ API: `predict`, `track`, `train`, `val` and `export`. The DETR family moves fast
108
+ — RT-DETR, D-FINE — and nitid brings the best DETR made easy, so getting
109
+ from your dataset to an exported model does not mean following every paper.
110
+
111
+ What comes with it:
112
+
113
+ - Python API and command line
114
+ - Automatic download of the official COCO checkpoints for detection and
115
+ instance segmentation; semantic segmentation is fine-tuned on your own masks
116
+ - Fine-tuning and validation for boxes, masks and dense semantic maps
117
+ - ByteTrack, BoT-SORT, and OC-SORT tracking with persistent IDs and annotated
118
+ video output
119
+
120
+ ## What "open" means here
121
+
122
+ The nitid code is released under the [Apache License 2.0](https://github.com/Nitidio/nitid/blob/v0.9.1/LICENSE). You can use
123
+ it commercially, modify it, and ship it in closed products.
124
+
125
+ The official pretrained weights are published by their authors under Apache 2.0
126
+ as well: the detection checkpoints by [D-FINE](https://github.com/Peterande/D-FINE)
127
+ and the instance-segmentation checkpoints by
128
+ [D-FINE-seg](https://huggingface.co/ArgoSA/D-FINE-seg). nitid downloads them from
129
+ those sources on first use. The public datasets used for pretraining keep their
130
+ own terms: the checkpoints listed in [Verified models](#verified-models) are
131
+ trained on COCO and Objects365.
132
+
133
+ ## Installation
134
+
135
+ Requires Python 3.10, 3.11 or 3.12.
136
+
137
+ ```bash
138
+ pip install nitid
139
+ ```
140
+
141
+ Inference and export work out of the box. Other features are optional extras:
142
+
143
+ | Extra | Adds |
144
+ | :---------------- | :------------------------------------------------------- |
145
+ | `train` | Fine-tuning and COCO-style validation |
146
+ | `track` | ByteTrack, BoT-SORT, and OC-SORT object tracking |
147
+ | `openvino` | OpenVINO export and runtime for Intel CPU, iGPU, and NPU |
148
+ | `wandb`, `mlflow` | Experiment tracking during training |
149
+
150
+ ```bash
151
+ pip install "nitid[train,track]"
152
+ ```
153
+
154
+ pip installs the default PyTorch build for your platform. If you need a
155
+ specific CUDA version, install PyTorch first following
156
+ [pytorch.org](https://pytorch.org/get-started/locally/), then install nitid.
157
+ TensorRT export has its own requirements; see [docs/export.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/export.md#tensorrt).
158
+
159
+ ## Quick Start
160
+
161
+ The canonical quickstart lives in [docs/quickstart.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/quickstart.md); use the docs guide for the full walkthrough.
162
+
163
+ ### Inference
164
+
165
+ ```python
166
+ from nitid import NITID
167
+
168
+ model = NITID("model1s", task="detect")
169
+ results = model.predict("image.jpg", conf=0.5)
170
+ results[0].save("out.jpg")
171
+
172
+ # Export detections to Pandas DataFrame or crop bounding boxes
173
+ df = results[0].pandas()
174
+ results[0].crop(save_dir="crops/")
175
+ ```
176
+
177
+ | Input | Detection |
178
+ | :---: | :-------: |
179
+ | ![Skier, input image](https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/source/ski.jpg) | ![Skier, detections with model1m](https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/detect-ski.jpg) |
180
+
181
+ Generated with:
182
+
183
+ ```bash
184
+ nitid predict model=model1m task=detect source=docs/assets/demo/source/ski.jpg conf=0.5 save=true
185
+ ```
186
+
187
+ Instance segmentation uses the same API and downloads the matching COCO mask checkpoint:
188
+
189
+ ```python
190
+ model = NITID("model1s", task="segment")
191
+ result = model.predict("image.jpg", conf=0.5)[0]
192
+ print(result.masks.data.shape) # [N, H, W]
193
+ result.save("segmented.jpg")
194
+ ```
195
+
196
+ | Input | Instance segmentation |
197
+ | :---: | :-------------------: |
198
+ | ![Watchmaker's desk, input image](https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/source/watchmaker.jpg) | ![Watchmaker's desk, masks with model1l](https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/segment-watchmaker.jpg) |
199
+
200
+ Generated with:
201
+
202
+ ```bash
203
+ nitid predict model=model1l task=segment source=docs/assets/demo/source/watchmaker.jpg conf=0.3 save=true
204
+ ```
205
+
206
+ Semantic segmentation returns one class ID per pixel. There are no pretrained
207
+ semantic weights yet: `NITID("model1s", task="semantic")` is a starting point for
208
+ [fine-tuning](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/fine_tuning.md), so predict with your fine-tuned checkpoint:
209
+
210
+ ```python
211
+ model = NITID("semantic_best.pth", task="semantic")
212
+ result = model.predict("image.jpg", return_probs=True)[0]
213
+ print(result.semantic.mask.shape) # [H, W]
214
+ result.save_semantic("class_ids.png")
215
+ ```
216
+
217
+ ### Training
218
+
219
+ ```python
220
+ metrics = model.train(
221
+ data="configs/datasets/my_dataset.yml",
222
+ epochs=50,
223
+ batch=8,
224
+ )
225
+ print(f"mAP50: {metrics['mAP50']:.4f}, mAP50-95: {metrics['mAP50-95']:.4f}")
226
+ ```
227
+
228
+ See [fine-tuning](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/fine_tuning.md) for COCO, YOLO, and semantic-mask dataset formats.
229
+
230
+ ### Tracking
231
+
232
+ ```python
233
+ for result in model.track("video.mp4", conf=0.5, stream=True, save=True):
234
+ if result.boxes.id is not None:
235
+ track_ids = result.boxes.id
236
+ ```
237
+
238
+ <p align="center">
239
+ <img src="https://raw.githubusercontent.com/Nitidio/nitid/v0.9.1/docs/assets/demo/track.gif" alt="Tracking pedestrians with persistent IDs" width="600">
240
+ </p>
241
+
242
+ _`model1s` detection with ByteTrack and `vid_stride=2` on a CC0 street video._
243
+
244
+ The annotated video is saved under `runs/track/exp/`. Tracking dependencies
245
+ are optional; install them with `pip install "nitid[track]"`.
246
+
247
+ ### Validation
248
+
249
+ ```python
250
+ metrics = model.val(
251
+ data="configs/datasets/my_dataset.yml",
252
+ project="runs/val",
253
+ name="exp",
254
+ )
255
+ # saves validation plots to runs/val/exp by default
256
+ ```
257
+
258
+ ### Export
259
+
260
+ ```python
261
+ model.export(format="openvino")
262
+ model.export(format="onnx")
263
+ model.export(format="torchscript")
264
+ model.export(format="tensorrt")
265
+ ```
266
+
267
+ | Deployment target | Hardware | Export format | Extra install |
268
+ | :---------------- | :------------------------------------ | :--------------------- | :-------------------------------------------------------- |
269
+ | **OpenVINO** | Intel CPU, iGPU and NPU | `format="openvino"` | `pip install "nitid[openvino]"` |
270
+ | **ONNX** | Any ONNX runtime (CPU, GPU) | `format="onnx"` | A runtime, e.g. `pip install onnxruntime` |
271
+ | **PyTorch** | CPU, CUDA GPU | `.pth` checkpoint | None |
272
+ | **TorchScript** | LibTorch (C++) | `format="torchscript"` | None |
273
+ | **TensorRT** | NVIDIA GPU (Jetson, RTX, data center) | `format="tensorrt"` | `tensorrt>=8.6` (see [docs/export.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/export.md#tensorrt)) |
274
+
275
+ Capture Python API output, environment details, and failure tracebacks in one
276
+ attachable log:
277
+
278
+ ```python
279
+ from nitid import NITID, bugreport
280
+
281
+ with bugreport("prediction") as report:
282
+ model = NITID("model1s", task="detect")
283
+ model.predict("image.jpg")
284
+
285
+ print(report.path)
286
+ ```
287
+
288
+ ### Command Line Interface
289
+
290
+ ```bash
291
+ nitid predict model=model1s task=detect source=image.jpg
292
+ nitid predict model=semantic_best.pth task=semantic source=image.jpg save=true
293
+ nitid track model=model1s source=video.mp4 conf=0.5 save=true
294
+ nitid train model=model1s task=detect data=my_dataset.yml epochs=50
295
+ nitid val model=model1s task=detect data=my_dataset.yml
296
+ nitid export model=model1s task=detect format=onnx
297
+ nitid predict model=model1s source=image.jpg --report
298
+ nitid bugreport
299
+ ```
300
+
301
+ For the full guide:
302
+
303
+ - Full quickstart: [docs/quickstart.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/quickstart.md)
304
+ - Notebooks and scripts: [examples/](https://github.com/Nitidio/nitid/blob/v0.9.1/examples/README.md)
305
+ - Fine-tuning and validation: [docs/fine_tuning.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/fine_tuning.md)
306
+ - Export: [docs/export.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/export.md)
307
+ - Deployment: [docs/deployment.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/deployment.md)
308
+ - CLI: [docs/cli.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/cli.md)
309
+
310
+ ## Migrating from YOLO & Compatibility
311
+
312
+ If you are coming from a YOLO codebase, the quickstart has a side-by-side
313
+ mapping of the API and the behaviour that differs:
314
+ [Coming from YOLO](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/quickstart.md#coming-from-yolo).
315
+
316
+ ## Verified models
317
+
318
+ > 💡 `NITID("model1s", task=...)` is the canonical constructor. The trailing size letter selects the model size, and `model1` identifies the model generation. Supported tasks are `detect`, `segment`, and `semantic`.
319
+
320
+ ### Object Detection (`task="detect"`)
321
+
322
+ _Evaluated on COCO val2017 at 640x640 resolution._
323
+
324
+ | Model Alias | Architecture | COCO mAP<sup>50-95</sup> _(vs YOLO11)_ | Speed<sup>T4 TRT10 FP16</sup> _(vs YOLO11)_ | Params | FLOPs | Config | Official Checkpoint |
325
+ | :---------- | :----------- | :------------------------------------: | :-----------------------------------------: | :----: | :---: | :----------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------: |
326
+ | `model1n`\* | **D-FINE-N** | **42.8** _(40.9)_ | **2.12 ms** _(1.70 ms)_ | 4.0M | 7B | [yml](https://github.com/Peterande/D-FINE/blob/master/configs/dfine/dfine_hgnetv2_n_coco.yml) | [pth](https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_n_coco.pth) |
327
+ | `model1s` | **D-FINE-S** | **50.7** _(48.6)_ | **3.49 ms** _(2.50 ms)_ | 10.0M | 25B | [yml](https://github.com/Peterande/D-FINE/blob/master/configs/dfine/objects365/dfine_hgnetv2_s_obj2coco.yml) | [pth](https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_s_obj2coco.pth) |
328
+ | `model1m` | **D-FINE-M** | **55.1** _(53.1)_ | **5.62 ms** _(4.70 ms)_ | 19.0M | 57B | [yml](https://github.com/Peterande/D-FINE/blob/master/configs/dfine/objects365/dfine_hgnetv2_m_obj2coco.yml) | [pth](https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_m_obj2coco.pth) |
329
+ | `model1l` | **D-FINE-L** | **57.3** _(55.0)_ | **8.07 ms** _(6.20 ms)_ | 31.0M | 91B | [yml](https://github.com/Peterande/D-FINE/blob/master/configs/dfine/objects365/dfine_hgnetv2_l_obj2coco.yml) | [pth](https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_l_obj2coco_e25.pth) |
330
+ | `model1x` | **D-FINE-X** | **59.3** _(57.5)_ | **12.89 ms** _(11.80 ms)_ | 62.0M | 202B | [yml](https://github.com/Peterande/D-FINE/blob/master/configs/dfine/objects365/dfine_hgnetv2_x_obj2coco.yml) | [pth](https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_x_obj2coco.pth) |
331
+
332
+ _Numbers in parentheses correspond to the equivalent YOLO11 model (YOLO11n/s/m/l/x) for quick reference._
333
+ _\* Official checkpoints for `model1s/m/l/x` download automatically upon first use. `model1n` detection requires a checkpoint path or custom weights._
334
+
335
+ ### Instance Segmentation (`task="segment"`)
336
+
337
+ _Based on D-FINE-seg. Published in the official [D-FINE-seg model repository](https://huggingface.co/ArgoSA/D-FINE-seg). Official checkpoints download automatically upon first use._
338
+
339
+ | Model Alias | Architecture | Backing Checkpoint | Weights |
340
+ | :---------- | :--------------- | :-------------------: | :----------------------------------------------------------------------: |
341
+ | `model1n` | **D-FINE-Seg-N** | `dfine_seg_n_coco.pt` | [Auto-download / Hugging Face](https://huggingface.co/ArgoSA/D-FINE-seg) |
342
+ | `model1s` | **D-FINE-Seg-S** | `dfine_seg_s_coco.pt` | [Auto-download / Hugging Face](https://huggingface.co/ArgoSA/D-FINE-seg) |
343
+ | `model1m` | **D-FINE-Seg-M** | `dfine_seg_m_coco.pt` | [Auto-download / Hugging Face](https://huggingface.co/ArgoSA/D-FINE-seg) |
344
+ | `model1l` | **D-FINE-Seg-L** | `dfine_seg_l_coco.pt` | [Auto-download / Hugging Face](https://huggingface.co/ArgoSA/D-FINE-seg) |
345
+ | `model1x` | **D-FINE-Seg-X** | `dfine_seg_x_coco.pt` | [Auto-download / Hugging Face](https://huggingface.co/ArgoSA/D-FINE-seg) |
346
+
347
+ ### Semantic Segmentation (`task="semantic"`)
348
+
349
+ There are no pretrained semantic checkpoints. `NITID("model1s", task="semantic")` starts
350
+ from the instance-segmentation checkpoint of the same size and is meant for
351
+ [fine-tuning](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/fine_tuning.md) on your own masks.
352
+
353
+ ## Documentation
354
+
355
+ | Doc | Description |
356
+ | ------------------------------------------------------------ | ----------------------------------------------------------------------- |
357
+ | [docs/quickstart.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/quickstart.md) | Full quickstart |
358
+ | [examples/](https://github.com/Nitidio/nitid/blob/v0.9.1/examples/README.md) | Notebooks (Colab) and runnable scripts |
359
+ | [docs/fine_tuning.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/fine_tuning.md) | Training, validation, AMP, EMA, dataset formats |
360
+ | [docs/export.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/export.md) | OpenVINO, ONNX, TorchScript, and TensorRT export |
361
+ | [docs/deployment.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/deployment.md) | Running exported models with ONNX Runtime, OpenVINO, LibTorch, Triton |
362
+ | [docs/training_cuda_openvino.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/training_cuda_openvino.md) | End-to-end run on an NVIDIA GPU or an Intel machine with OpenVINO |
363
+ | [docs/cli.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/cli.md) | Command-line reference |
364
+ | [docs/api_reference.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/api_reference.md) | Full Python API reference |
365
+ | [docs/troubleshooting.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/troubleshooting.md) | FAQ and fixes for common install, model, Docker, CUDA, and CLI problems |
366
+ | [docs/macos_docker_setup.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/macos_docker_setup.md) | macOS / Apple Silicon development environment with Docker |
367
+ | [docs/brand.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/brand.md) | Brand: logo, palette, typography, and what the project announces |
368
+
369
+ ## Development
370
+
371
+ Everything above is for using nitid. To work on nitid itself, use a source
372
+ checkout and [uv](https://github.com/astral-sh/uv), which installs the exact
373
+ dependency versions pinned in `uv.lock` — including CUDA 12.1 PyTorch wheels on
374
+ Linux and Windows.
375
+
376
+ ```bash
377
+ git clone https://github.com/Nitidio/nitid.git && cd nitid
378
+ uv sync --extra dev --extra train
379
+ ```
380
+
381
+ Inside the checkout, run the CLI and tools through the project environment:
382
+
383
+ ```bash
384
+ uv run nitid predict model=model1s task=detect source=image.jpg
385
+
386
+ # Unit tests (no GPU, no checkpoint needed)
387
+ uv run pytest tests/unit
388
+
389
+ # All tests (integration tests build a tiny checkpoint automatically)
390
+ uv run pytest
391
+
392
+ # Lint and format
393
+ uv run ruff check .
394
+ uv run ruff format --check .
395
+
396
+ # Type-check
397
+ uv run mypy dfine tools
398
+ ```
399
+
400
+ Integration tests use a session-scoped fixture in `tests/conftest.py` that
401
+ builds a small D-FINE-S model with random weights at test time — no download
402
+ required.
403
+
404
+ - [docs/onboarding.md](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/onboarding.md) — **start here if you're new to the
405
+ codebase**: architecture, conventions, gotchas
406
+ - [CONTRIBUTING.md](https://github.com/Nitidio/nitid/blob/v0.9.1/CONTRIBUTING.md) — branch workflow, commit conventions, and
407
+ the PR checklist
408
+
409
+ ### Docker Environment
410
+
411
+ For developers on macOS (Apple Silicon) or environments needing isolated Linux containers, a preconfigured `Dockerfile` and `docker-compose.yml` are provided:
412
+
413
+ ```bash
414
+ docker compose run --rm nitid-dev
415
+ ```
416
+
417
+ See [macOS Docker Setup](https://github.com/Nitidio/nitid/blob/v0.9.1/docs/macos_docker_setup.md) for the setup guide.
418
+
419
+ ## Acknowledgements & Citation
420
+
421
+ nitid contains code derived from [D-FINE](https://github.com/Peterande/D-FINE) and [D-FINE-seg](https://github.com/ArgoHA/D-FINE-seg), with smaller portions from RT-DETR, DETR and PaddleDetection. See [THIRD_PARTY_NOTICES.md](https://github.com/Nitidio/nitid/blob/v0.9.1/THIRD_PARTY_NOTICES.md) and the [Apache 2.0 License](https://github.com/Nitidio/nitid/blob/v0.9.1/LICENSE).
422
+
423
+ If you use nitid in your research or product, please cite:
424
+
425
+ ```bibtex
426
+ @software{nitid2026,
427
+ title={nitid: Real-Time Open Source Computer Vision},
428
+ author={{Vaelsys}},
429
+ year={2026},
430
+ url={https://github.com/Nitidio/nitid}
431
+ }
432
+
433
+ @article{peng2024dfine,
434
+ title={D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement},
435
+ author={Peng, Yansong and Shi, Hongtao and Li, Shiyu and Wang, Yan and Li, Hongbin and Liu, Guozheng and Li, Bing and Hu, Weiming},
436
+ journal={arXiv preprint arXiv:2410.13842},
437
+ year={2024}
438
+ }
439
+
440
+ @article{saakyan2026dfineseg,
441
+ title={D-FINE-seg: Object Detection and Instance Segmentation Framework with multi-backend deployment},
442
+ author={Saakyan, Argo and Solntsev, Dmitry},
443
+ journal={arXiv preprint arXiv:2602.23043},
444
+ year={2026}
445
+ }
446
+ ```