easydetect 0.1.0__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.
- easydetect-0.1.0/.gitignore +20 -0
- easydetect-0.1.0/LICENSE +202 -0
- easydetect-0.1.0/NOTICE +28 -0
- easydetect-0.1.0/PKG-INFO +250 -0
- easydetect-0.1.0/README.md +210 -0
- easydetect-0.1.0/easydetect/__init__.py +44 -0
- easydetect-0.1.0/easydetect/cli.py +149 -0
- easydetect-0.1.0/easydetect/data/__init__.py +1 -0
- easydetect-0.1.0/easydetect/data/dataset.py +161 -0
- easydetect-0.1.0/easydetect/data/labels.py +48 -0
- easydetect-0.1.0/easydetect/downloads.py +145 -0
- easydetect-0.1.0/easydetect/errors.py +16 -0
- easydetect-0.1.0/easydetect/exporter.py +86 -0
- easydetect-0.1.0/easydetect/metrics.py +62 -0
- easydetect-0.1.0/easydetect/model.py +606 -0
- easydetect-0.1.0/easydetect/nn/__init__.py +4 -0
- easydetect-0.1.0/easydetect/nn/decoder.py +962 -0
- easydetect-0.1.0/easydetect/nn/denoising.py +125 -0
- easydetect-0.1.0/easydetect/nn/dfine_net.py +106 -0
- easydetect-0.1.0/easydetect/nn/encoder.py +483 -0
- easydetect-0.1.0/easydetect/nn/hgnetv2.py +524 -0
- easydetect-0.1.0/easydetect/nn/ops.py +407 -0
- easydetect-0.1.0/easydetect/plotting.py +93 -0
- easydetect-0.1.0/easydetect/predictor.py +170 -0
- easydetect-0.1.0/easydetect/results.py +204 -0
- easydetect-0.1.0/easydetect/sources.py +174 -0
- easydetect-0.1.0/easydetect/tracker.py +87 -0
- easydetect-0.1.0/easydetect/trainer.py +510 -0
- easydetect-0.1.0/easydetect/utils/__init__.py +1 -0
- easydetect-0.1.0/easydetect/utils/loss.py +686 -0
- easydetect-0.1.0/easydetect/utils/ops.py +63 -0
- easydetect-0.1.0/easydetect/validator.py +124 -0
- easydetect-0.1.0/platform/README.md +184 -0
- easydetect-0.1.0/platform/tests/conftest.py +9 -0
- easydetect-0.1.0/platform/tests/test_app.py +1091 -0
- easydetect-0.1.0/platform/tests/test_labeling.py +94 -0
- easydetect-0.1.0/pyproject.toml +84 -0
- easydetect-0.1.0/tests/__init__.py +1 -0
- easydetect-0.1.0/tests/conftest.py +83 -0
- easydetect-0.1.0/tests/test_cli.py +76 -0
- easydetect-0.1.0/tests/test_dataset.py +89 -0
- easydetect-0.1.0/tests/test_downloads.py +89 -0
- easydetect-0.1.0/tests/test_model.py +240 -0
- easydetect-0.1.0/tests/test_nn.py +140 -0
- easydetect-0.1.0/tests/test_predictor.py +122 -0
- easydetect-0.1.0/tests/test_results.py +147 -0
- easydetect-0.1.0/tests/test_sources.py +121 -0
- easydetect-0.1.0/tests/test_tracker.py +67 -0
- easydetect-0.1.0/tests/test_train_export.py +308 -0
- easydetect-0.1.0/tools/bench.py +120 -0
- easydetect-0.1.0/tools/build_mirror.py +82 -0
- easydetect-0.1.0/tools/convert_dfine.py +140 -0
- easydetect-0.1.0/tools/hub_README.md +143 -0
- easydetect-0.1.0/tools/make_demo.py +56 -0
- easydetect-0.1.0/tools/make_toyset.py +62 -0
easydetect-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 easydetect contributors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
easydetect-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
easydetect
|
|
2
|
+
Copyright 2026 easydetect contributors
|
|
3
|
+
|
|
4
|
+
This product includes software adapted from the following projects, each
|
|
5
|
+
licensed under the Apache License, Version 2.0:
|
|
6
|
+
|
|
7
|
+
* D-FINE (https://github.com/Peterande/D-FINE), Copyright (c) 2024 The D-FINE
|
|
8
|
+
Authors. The detector under easydetect/nn/ (HGNetv2 backbone, hybrid encoder,
|
|
9
|
+
D-FINE decoder with fine-grained distribution refinement, denoising queries)
|
|
10
|
+
and the training loss in easydetect/utils/loss.py are adapted from it, with
|
|
11
|
+
module names and numerics kept so the D-FINE COCO checkpoints load unchanged.
|
|
12
|
+
The pretrained weights easydetect downloads are those COCO checkpoints,
|
|
13
|
+
converted without retraining.
|
|
14
|
+
|
|
15
|
+
* RT-DETR (https://github.com/lyuwenyu/RT-DETR), Copyright (c) 2023 lyuwenyu,
|
|
16
|
+
from which D-FINE itself is modified.
|
|
17
|
+
|
|
18
|
+
* PaddleDetection (https://github.com/PaddlePaddle/PaddleDetection), Copyright
|
|
19
|
+
(c) PaddlePaddle Authors — the PP-HGNetV2 backbone design.
|
|
20
|
+
|
|
21
|
+
* DETR (https://github.com/facebookresearch/detr), Copyright (c) Facebook, Inc.
|
|
22
|
+
and its affiliates — box utilities.
|
|
23
|
+
|
|
24
|
+
The packaging, API, trainer, validator, exporter, predictor, CLI and the web
|
|
25
|
+
platform are this project's own.
|
|
26
|
+
|
|
27
|
+
No code or weights from AGPL-licensed projects are included. Only D-FINE's
|
|
28
|
+
COCO-trained checkpoints are used; checkpoints pretrained on Objects365 are not.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: easydetect
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Easy real-time object detection you can ship: D-FINE with PyTorch training, OpenVINO inference on CPU/GPU/NPU, and a browser app to label and train. Apache-2.0 throughout.
|
|
5
|
+
Project-URL: Homepage, https://github.com/themakerrobot/easydetect
|
|
6
|
+
Project-URL: Source, https://github.com/themakerrobot/easydetect
|
|
7
|
+
Project-URL: Documentation, https://github.com/themakerrobot/easydetect/blob/main/docs/usage.md
|
|
8
|
+
Project-URL: Issues, https://github.com/themakerrobot/easydetect/issues
|
|
9
|
+
Author-email: leeyunjai <leeyunjai1982@gmail.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: annotation,apache-2.0,computer-vision,d-fine,detr,easydetect,edge-ai,education,labeling,npu,object-detection,openvino,pytorch,real-time,rt-detr,transformer,yolo-alternative
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Multimedia :: Video
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: numpy>=1.23
|
|
26
|
+
Requires-Dist: opencv-python>=4.6
|
|
27
|
+
Requires-Dist: openvino>=2024.0
|
|
28
|
+
Requires-Dist: pyyaml>=5.4
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: httpx>=0.24; extra == 'dev'
|
|
31
|
+
Requires-Dist: pillow>=9.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
34
|
+
Provides-Extra: train
|
|
35
|
+
Requires-Dist: onnx>=1.14; extra == 'train'
|
|
36
|
+
Requires-Dist: scipy>=1.9; extra == 'train'
|
|
37
|
+
Requires-Dist: torch>=2.1; extra == 'train'
|
|
38
|
+
Requires-Dist: torchvision>=0.16; extra == 'train'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
<div align="center">
|
|
42
|
+
|
|
43
|
+
# easydetect
|
|
44
|
+
|
|
45
|
+
**Easy real-time object detection you can actually ship.**
|
|
46
|
+
Train in PyTorch, run anywhere with OpenVINO — CPU, GPU or NPU — and label,
|
|
47
|
+
train and test in a browser. Apache-2.0 from the code to the model you export.
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/easydetect/)
|
|
50
|
+
[](https://pypi.org/project/easydetect/)
|
|
51
|
+
[](https://github.com/themakerrobot/easydetect/blob/main/LICENSE)
|
|
52
|
+
[](https://github.com/themakerrobot/easydetect/actions/workflows/ci.yml)
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
## Why
|
|
59
|
+
|
|
60
|
+
* **Three lines to a detector.** `Detector("dfine-s")`, point it at a picture,
|
|
61
|
+
read the boxes. The same object trains, validates and exports.
|
|
62
|
+
* **One licence, all the way down.** Apache-2.0 code, Apache-2.0 COCO weights,
|
|
63
|
+
Apache-2.0 exports — nothing to clear with legal before it goes into a
|
|
64
|
+
product or a classroom.
|
|
65
|
+
* **Accurate for its size.** The detector is
|
|
66
|
+
[D-FINE](https://github.com/Peterande/D-FINE), a real-time DETR: D-FINE-S
|
|
67
|
+
scores 48.5 COCO mAP with 10M parameters.
|
|
68
|
+
* **Runs on the machine you have.** OpenVINO runs the model on a CPU, an Intel
|
|
69
|
+
GPU or an Intel NPU; no CUDA needed to deploy. A GPU makes training quick.
|
|
70
|
+
* **No NMS.** One box per object, so there is no IoU threshold to tune and
|
|
71
|
+
latency does not climb with a crowded frame.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install easydetect # inference
|
|
77
|
+
pip install "easydetect[train]" # + training
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Detect
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from easydetect import Detector
|
|
84
|
+
|
|
85
|
+
model = Detector("dfine-s") # COCO weights, downloaded on first use
|
|
86
|
+
r = model("photo.jpg", conf=0.5)[0]
|
|
87
|
+
|
|
88
|
+
r.boxes.xyxy, r.boxes.conf, r.boxes.cls # plain numpy
|
|
89
|
+
r.names[int(r.boxes.cls[0])] # "person"
|
|
90
|
+
r.plot(); r.save(); r.show()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Point it at an image, a folder, a glob, a video, an RTSP stream, a webcam index,
|
|
94
|
+
or a numpy array. Long sources stream, so memory stays flat:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
for r in model.predict(0, stream=True, show=True): # webcam, q or Esc quits
|
|
98
|
+
print(r.boxes.xyxyn)
|
|
99
|
+
|
|
100
|
+
model.track("clip.mp4") # adds r.boxes.id
|
|
101
|
+
model = Detector("dfine-s", device="NPU") # AUTO, CPU, GPU, NPU
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
A webcam viewer with an FPS counter is in [`examples/webcam.py`](https://github.com/themakerrobot/easydetect/blob/main/examples/webcam.py)
|
|
105
|
+
— `python examples/webcam.py --track`.
|
|
106
|
+
|
|
107
|
+
## Train
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
model = Detector("dfine-s")
|
|
111
|
+
model.train(data="data.yaml", epochs=50, imgsz=640, batch=16, device=0)
|
|
112
|
+
model.val(data="data.yaml").box.map50
|
|
113
|
+
model.export(format="openvino") # best.xml + best.bin + labels.txt
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
# data.yaml
|
|
118
|
+
path: /data/cans
|
|
119
|
+
train: images/train
|
|
120
|
+
val: images/val
|
|
121
|
+
names: {0: can, 1: bottle}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Labels are one `.txt` per image, `cls cx cy w h` normalised — the layout every
|
|
125
|
+
labelling tool already exports. A YOLO-format download (Roboflow's included)
|
|
126
|
+
trains as it comes; [training.md](https://github.com/themakerrobot/easydetect/blob/main/docs/training.md#datasets-from-elsewhere)
|
|
127
|
+
lists the variations it accepts. Training starts from the COCO weights and saves
|
|
128
|
+
an average of the weights (EMA) as the checkpoint; `freeze="backbone"` trains
|
|
129
|
+
faster on a small set, and `resume=True` picks a killed run back up.
|
|
130
|
+
|
|
131
|
+
## Label, train and watch it in a browser
|
|
132
|
+
|
|
133
|
+
`platform/` is a web app on top of this package: drop images in, label them (the
|
|
134
|
+
model drafts the boxes, you correct them), queue a training run, watch the curve,
|
|
135
|
+
then run the result over a folder, a video or your webcam — on one machine, with
|
|
136
|
+
nothing leaving it. A finished run hands you copy-ready code and a Hugging Face
|
|
137
|
+
folder whose model card is written from the run.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install -r platform/requirements.txt
|
|
141
|
+
python platform/run.py # http://<this machine>:8080
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+

|
|
145
|
+
|
|
146
|
+
## Models
|
|
147
|
+
|
|
148
|
+
| name | backbone | params | COCO mAP50-95 |
|
|
149
|
+
| --- | --- | --- | --- |
|
|
150
|
+
| `dfine-n` | HGNetv2-B0 | 4M | 42.8 |
|
|
151
|
+
| `dfine-s` | HGNetv2-B0 | 10M | 48.5 — the default |
|
|
152
|
+
| `dfine-m` | HGNetv2-B2 | 19M | 52.3 |
|
|
153
|
+
| `dfine-l` | HGNetv2-B4 | 31M | 54.0 |
|
|
154
|
+
| `dfine-x` | HGNetv2-B5 | 62M | 55.8 |
|
|
155
|
+
|
|
156
|
+
COCO numbers are D-FINE's own for these checkpoints (640 px, val2017).
|
|
157
|
+
|
|
158
|
+
## Speed
|
|
159
|
+
|
|
160
|
+
`dfine-s` at 640 on one desktop — a Core Ultra 5 250K Plus with an RTX 5090 —
|
|
161
|
+
network only, median of 30 runs:
|
|
162
|
+
|
|
163
|
+
| `device=` | latency | FPS |
|
|
164
|
+
| --- | --- | --- |
|
|
165
|
+
| `"CPU"` | 34 ms | 29 |
|
|
166
|
+
| `"NPU"` | 37 ms | 27 — and the CPU stays free |
|
|
167
|
+
| `"GPU"` (the RTX 5090 through OpenCL) | 13 ms | 74 |
|
|
168
|
+
|
|
169
|
+
Every device returns the same boxes as PyTorch (the NPU to a mean IoU of 0.98).
|
|
170
|
+
[performance.md](https://github.com/themakerrobot/easydetect/blob/main/docs/performance.md)
|
|
171
|
+
covers measuring your own machine and what makes it faster.
|
|
172
|
+
|
|
173
|
+
## Compared with YOLO
|
|
174
|
+
|
|
175
|
+
Published COCO val2017 numbers at 640 px, as each project reports them — not
|
|
176
|
+
re-measured here:
|
|
177
|
+
|
|
178
|
+
| model | params | COCO mAP50-95 | NMS | license |
|
|
179
|
+
| --- | --- | --- | --- | --- |
|
|
180
|
+
| D-FINE n / s / m / l / x | 4M / 10M / 19M / 31M / 62M | 42.8 / 48.5 / 52.3 / 54.0 / 55.8 | none | Apache-2.0 |
|
|
181
|
+
| YOLO11 n / s / m / l / x | 2.6M / 9.4M / 20.1M / 25.3M / 56.9M | 39.5 / 47.0 / 51.5 / 53.4 / 54.7 | needed | AGPL-3.0 |
|
|
182
|
+
|
|
183
|
+
Read it plainly:
|
|
184
|
+
|
|
185
|
+
* **At each size D-FINE scores a little higher on COCO**, with a similar
|
|
186
|
+
parameter count (YOLO11-n and -l are the lighter ones).
|
|
187
|
+
* **The license is the difference that usually decides.** Ultralytics YOLO is
|
|
188
|
+
AGPL-3.0: a product that ships it, or serves it over a network, must publish
|
|
189
|
+
its source or buy a commercial license. Everything here is Apache-2.0 — code
|
|
190
|
+
and weights — so it goes into closed products as it is.
|
|
191
|
+
* **Where YOLO fits better:** segmentation and pose in the same tool, and a far
|
|
192
|
+
larger ecosystem.
|
|
193
|
+
|
|
194
|
+
COCO is a guide, not your answer. Fine-tune both on your own data, then compare
|
|
195
|
+
mAP on the same validation images and latency on the same device, NMS included.
|
|
196
|
+
|
|
197
|
+
## Command line
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
easydetect predict model=dfine-s source=photo.jpg conf=0.5
|
|
201
|
+
easydetect train model=dfine-s data=data.yaml epochs=50
|
|
202
|
+
easydetect val model=best.pt data=data.yaml
|
|
203
|
+
easydetect export model=best.pt format=openvino half=true
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Docs
|
|
207
|
+
|
|
208
|
+
* [Using the model](https://github.com/themakerrobot/easydetect/blob/main/docs/usage.md) — sources, results, tracking, saving
|
|
209
|
+
* [Training](https://github.com/themakerrobot/easydetect/blob/main/docs/training.md) — datasets, validation, export, CLI
|
|
210
|
+
* [Platform](https://github.com/themakerrobot/easydetect/blob/main/platform/README.md) — the browser app: labelling, jobs, sharing
|
|
211
|
+
* [Weights](https://github.com/themakerrobot/easydetect/blob/main/docs/weights.md) — the mirror, building it, offline use
|
|
212
|
+
* [Performance](https://github.com/themakerrobot/easydetect/blob/main/docs/performance.md) — measuring speed and improving it
|
|
213
|
+
* [Design](https://github.com/themakerrobot/easydetect/blob/main/docs/design.md) — architecture and provenance
|
|
214
|
+
* [Development](https://github.com/themakerrobot/easydetect/blob/main/docs/contributing.md) — tests, releases
|
|
215
|
+
|
|
216
|
+
## What it does not do
|
|
217
|
+
|
|
218
|
+
Boxes only — no segmentation, pose or classification. One training process, one
|
|
219
|
+
machine; multi-GPU and distributed training are out of scope. Inference targets
|
|
220
|
+
OpenVINO, so a CUDA deployment means exporting to ONNX and taking it from there.
|
|
221
|
+
|
|
222
|
+
## 한국어
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from easydetect import Detector
|
|
226
|
+
|
|
227
|
+
model = Detector("dfine-s") # COCO 사전학습 가중치 자동 다운로드
|
|
228
|
+
model("photo.jpg", conf=0.5)[0].save() # 결과 이미지 저장
|
|
229
|
+
model.train(data="data.yaml", epochs=50) # 내 데이터로 학습
|
|
230
|
+
model.export(format="openvino") # 배포용 IR + labels.txt
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
세 줄이면 물체 검출이 됩니다. 모델은 D-FINE(실시간 DETR)이고, 코드와 가중치가
|
|
234
|
+
모두 Apache-2.0이라 상용 제품이나 교육 현장에 그대로 쓸 수 있습니다. CPU만으로도
|
|
235
|
+
돌고, Intel NPU·GPU에서도 같은 결과가 나옵니다. 라벨링부터 학습·추론까지
|
|
236
|
+
브라우저로 하려면 `python platform/run.py`. 가중치 캐시는 `~/.easydetect/`, 사내
|
|
237
|
+
미러는 `EASYDETECT_ASSETS_URL` 환경변수로 지정합니다.
|
|
238
|
+
|
|
239
|
+
## Credits
|
|
240
|
+
|
|
241
|
+
The detector and its COCO weights come from
|
|
242
|
+
[D-FINE](https://github.com/Peterande/D-FINE) (Apache-2.0,
|
|
243
|
+
[arXiv:2410.13842](https://arxiv.org/abs/2410.13842)), which builds on
|
|
244
|
+
[RT-DETR](https://github.com/lyuwenyu/RT-DETR). This package adapts that network
|
|
245
|
+
and loss, and adds its own training loop, inference stack and tooling — see
|
|
246
|
+
[NOTICE](https://github.com/themakerrobot/easydetect/blob/main/NOTICE).
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
Apache-2.0 — see [LICENSE](https://github.com/themakerrobot/easydetect/blob/main/LICENSE) and [NOTICE](https://github.com/themakerrobot/easydetect/blob/main/NOTICE).
|