percepto 0.1.dev40__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 (169) hide show
  1. percepto-0.1.dev40/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  2. percepto-0.1.dev40/.github/workflows/ci.yml +62 -0
  3. percepto-0.1.dev40/.github/workflows/publish.yml +37 -0
  4. percepto-0.1.dev40/.gitignore +37 -0
  5. percepto-0.1.dev40/.pre-commit-config.yaml +7 -0
  6. percepto-0.1.dev40/.python-version +1 -0
  7. percepto-0.1.dev40/LICENSE +201 -0
  8. percepto-0.1.dev40/PKG-INFO +63 -0
  9. percepto-0.1.dev40/README.md +235 -0
  10. percepto-0.1.dev40/THIRD_PARTY_NOTICES.md +114 -0
  11. percepto-0.1.dev40/convert_to_safetensors.py +218 -0
  12. percepto-0.1.dev40/eval_coco.py +153 -0
  13. percepto-0.1.dev40/pyproject.toml +131 -0
  14. percepto-0.1.dev40/src/percepto/__init__.py +131 -0
  15. percepto-0.1.dev40/src/percepto/_compose.py +68 -0
  16. percepto-0.1.dev40/src/percepto/_hardware.py +35 -0
  17. percepto-0.1.dev40/src/percepto/_registry.py +71 -0
  18. percepto-0.1.dev40/src/percepto/_resolve.py +120 -0
  19. percepto-0.1.dev40/src/percepto/_router.py +44 -0
  20. percepto-0.1.dev40/src/percepto/_skill.py +91 -0
  21. percepto-0.1.dev40/src/percepto/_version.py +34 -0
  22. percepto-0.1.dev40/src/percepto/cli/__init__.py +191 -0
  23. percepto-0.1.dev40/src/percepto/cli/_commands/__init__.py +0 -0
  24. percepto-0.1.dev40/src/percepto/cli/_commands/detect/__init__.py +0 -0
  25. percepto-0.1.dev40/src/percepto/cli/_commands/detect/analyze_cmd.py +300 -0
  26. percepto-0.1.dev40/src/percepto/cli/_commands/detect/benchmark_cmd.py +175 -0
  27. percepto-0.1.dev40/src/percepto/cli/_commands/detect/blur_cmd.py +183 -0
  28. percepto-0.1.dev40/src/percepto/cli/_commands/detect/compare_cmd.py +112 -0
  29. percepto-0.1.dev40/src/percepto/cli/_commands/detect/dashboard_cmd.py +142 -0
  30. percepto-0.1.dev40/src/percepto/cli/_commands/detect/demo_cmd.py +78 -0
  31. percepto-0.1.dev40/src/percepto/cli/_commands/detect/detect_cmd.py +415 -0
  32. percepto-0.1.dev40/src/percepto/cli/_commands/detect/evaluate_cmd.py +387 -0
  33. percepto-0.1.dev40/src/percepto/cli/_commands/detect/export_cmd.py +189 -0
  34. percepto-0.1.dev40/src/percepto/cli/_commands/detect/finetune_cmd.py +284 -0
  35. percepto-0.1.dev40/src/percepto/cli/_commands/detect/info_cmd.py +117 -0
  36. percepto-0.1.dev40/src/percepto/cli/_commands/detect/label_cmd.py +241 -0
  37. percepto-0.1.dev40/src/percepto/cli/_commands/detect/models_cmd.py +103 -0
  38. percepto-0.1.dev40/src/percepto/cli/_commands/detect/prune_cmd.py +120 -0
  39. percepto-0.1.dev40/src/percepto/cli/_commands/detect/serve_cmd.py +66 -0
  40. percepto-0.1.dev40/src/percepto/cli/_commands/detect/track_cmd.py +153 -0
  41. percepto-0.1.dev40/src/percepto/cli/_commands/detect/train_cmd.py +201 -0
  42. percepto-0.1.dev40/src/percepto/cli/_commands/detect/tune_cmd.py +183 -0
  43. percepto-0.1.dev40/src/percepto/cli/_commands/doctor_cmd.py +140 -0
  44. percepto-0.1.dev40/src/percepto/cli/_commands/mcp_install_cmd.py +90 -0
  45. percepto-0.1.dev40/src/percepto/evaluation/__init__.py +1 -0
  46. percepto-0.1.dev40/src/percepto/evaluation/coco_json.py +89 -0
  47. percepto-0.1.dev40/src/percepto/evaluation/coco_map.py +260 -0
  48. percepto-0.1.dev40/src/percepto/evaluation/confusion.py +192 -0
  49. percepto-0.1.dev40/src/percepto/export/__init__.py +7 -0
  50. percepto-0.1.dev40/src/percepto/export/coreml.py +72 -0
  51. percepto-0.1.dev40/src/percepto/export/onnx.py +81 -0
  52. percepto-0.1.dev40/src/percepto/export/openvino.py +47 -0
  53. percepto-0.1.dev40/src/percepto/export/quantize.py +127 -0
  54. percepto-0.1.dev40/src/percepto/export/tensorrt.py +90 -0
  55. percepto-0.1.dev40/src/percepto/export/tflite.py +112 -0
  56. percepto-0.1.dev40/src/percepto/hub/__init__.py +1 -0
  57. percepto-0.1.dev40/src/percepto/hub/download.py +82 -0
  58. percepto-0.1.dev40/src/percepto/hub/hub.py +260 -0
  59. percepto-0.1.dev40/src/percepto/mcp/__init__.py +19 -0
  60. percepto-0.1.dev40/src/percepto/mcp/server.py +74 -0
  61. percepto-0.1.dev40/src/percepto/nn/__init__.py +6 -0
  62. percepto-0.1.dev40/src/percepto/nn/attention.py +24 -0
  63. percepto-0.1.dev40/src/percepto/nn/conv.py +88 -0
  64. percepto-0.1.dev40/src/percepto/serving/__init__.py +1 -0
  65. percepto-0.1.dev40/src/percepto/serving/app.py +103 -0
  66. percepto-0.1.dev40/src/percepto/skills/__init__.py +0 -0
  67. percepto-0.1.dev40/src/percepto/skills/detect/__init__.py +147 -0
  68. percepto-0.1.dev40/src/percepto/skills/detect/_cli_utils.py +128 -0
  69. percepto-0.1.dev40/src/percepto/skills/detect/inference/__init__.py +5 -0
  70. percepto-0.1.dev40/src/percepto/skills/detect/inference/annotate.py +115 -0
  71. percepto-0.1.dev40/src/percepto/skills/detect/inference/detect.py +330 -0
  72. percepto-0.1.dev40/src/percepto/skills/detect/inference/onnx_detector.py +175 -0
  73. percepto-0.1.dev40/src/percepto/skills/detect/inference/postprocess.py +98 -0
  74. percepto-0.1.dev40/src/percepto/skills/detect/inference/preprocess.py +123 -0
  75. percepto-0.1.dev40/src/percepto/skills/detect/inference/visualize.py +139 -0
  76. percepto-0.1.dev40/src/percepto/skills/detect/models/__init__.py +23 -0
  77. percepto-0.1.dev40/src/percepto/skills/detect/models/_model_registry.py +75 -0
  78. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/__init__.py +44 -0
  79. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/backbone.py +63 -0
  80. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/config.py +82 -0
  81. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/decoder.py +69 -0
  82. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/encoder.py +102 -0
  83. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/head.py +80 -0
  84. percepto-0.1.dev40/src/percepto/skills/detect/models/dfine/model.py +88 -0
  85. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/__init__.py +67 -0
  86. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/backbone.py +76 -0
  87. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/blocks.py +83 -0
  88. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/config.py +112 -0
  89. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/head.py +196 -0
  90. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/model.py +45 -0
  91. percepto-0.1.dev40/src/percepto/skills/detect/models/rtmdet/neck.py +122 -0
  92. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/__init__.py +47 -0
  93. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/backbone.py +88 -0
  94. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/blocks.py +595 -0
  95. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/config.py +172 -0
  96. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/head.py +282 -0
  97. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/model.py +75 -0
  98. percepto-0.1.dev40/src/percepto/skills/detect/models/yolonas/neck.py +234 -0
  99. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/__init__.py +57 -0
  100. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/backbone.py +67 -0
  101. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/blocks.py +217 -0
  102. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/config.py +254 -0
  103. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/head.py +228 -0
  104. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/model.py +45 -0
  105. percepto-0.1.dev40/src/percepto/skills/detect/models/yolov9/neck.py +68 -0
  106. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/__init__.py +43 -0
  107. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/config.py +47 -0
  108. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/head.py +151 -0
  109. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/model.py +121 -0
  110. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/neck.py +188 -0
  111. percepto-0.1.dev40/src/percepto/skills/detect/models/yoloworld/text_encoder.py +94 -0
  112. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/__init__.py +57 -0
  113. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/backbone.py +91 -0
  114. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/blocks.py +75 -0
  115. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/config.py +63 -0
  116. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/head.py +209 -0
  117. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/model.py +45 -0
  118. percepto-0.1.dev40/src/percepto/skills/detect/models/yolox/neck.py +126 -0
  119. percepto-0.1.dev40/src/percepto/skills/detect/schemas.py +44 -0
  120. percepto-0.1.dev40/src/percepto/skills/detect/validation.py +56 -0
  121. percepto-0.1.dev40/src/percepto/tracking/__init__.py +83 -0
  122. percepto-0.1.dev40/src/percepto/tracking/byte_tracker.py +219 -0
  123. percepto-0.1.dev40/src/percepto/tracking/trackers_backend.py +143 -0
  124. percepto-0.1.dev40/src/percepto/training/__init__.py +37 -0
  125. percepto-0.1.dev40/src/percepto/training/assigners/__init__.py +3 -0
  126. percepto-0.1.dev40/src/percepto/training/assigners/tal.py +147 -0
  127. percepto-0.1.dev40/src/percepto/training/callbacks.py +360 -0
  128. percepto-0.1.dev40/src/percepto/training/config.py +99 -0
  129. percepto-0.1.dev40/src/percepto/training/datamodule.py +137 -0
  130. percepto-0.1.dev40/src/percepto/training/datasets/__init__.py +3 -0
  131. percepto-0.1.dev40/src/percepto/training/datasets/coco.py +165 -0
  132. percepto-0.1.dev40/src/percepto/training/datasets/mosaic.py +170 -0
  133. percepto-0.1.dev40/src/percepto/training/datasets/transforms.py +215 -0
  134. percepto-0.1.dev40/src/percepto/training/datasets/yolo.py +163 -0
  135. percepto-0.1.dev40/src/percepto/training/loggers.py +86 -0
  136. percepto-0.1.dev40/src/percepto/training/losses/__init__.py +3 -0
  137. percepto-0.1.dev40/src/percepto/training/losses/detection_loss.py +278 -0
  138. percepto-0.1.dev40/src/percepto/training/losses/dfl.py +50 -0
  139. percepto-0.1.dev40/src/percepto/training/losses/focal.py +102 -0
  140. percepto-0.1.dev40/src/percepto/training/losses/iou.py +82 -0
  141. percepto-0.1.dev40/src/percepto/training/metrics.py +127 -0
  142. percepto-0.1.dev40/src/percepto/training/module.py +189 -0
  143. percepto-0.1.dev40/src/percepto/training/qat.py +79 -0
  144. percepto-0.1.dev40/tests/__init__.py +0 -0
  145. percepto-0.1.dev40/tests/test_blocks.py +73 -0
  146. percepto-0.1.dev40/tests/test_cli.py +230 -0
  147. percepto-0.1.dev40/tests/test_compose.py +26 -0
  148. percepto-0.1.dev40/tests/test_dfine.py +108 -0
  149. percepto-0.1.dev40/tests/test_doctor.py +54 -0
  150. percepto-0.1.dev40/tests/test_export_coreml.py +51 -0
  151. percepto-0.1.dev40/tests/test_hub.py +111 -0
  152. percepto-0.1.dev40/tests/test_inference.py +72 -0
  153. percepto-0.1.dev40/tests/test_json_output.py +51 -0
  154. percepto-0.1.dev40/tests/test_label.py +47 -0
  155. percepto-0.1.dev40/tests/test_loggers.py +88 -0
  156. percepto-0.1.dev40/tests/test_mcp_install.py +82 -0
  157. percepto-0.1.dev40/tests/test_model_rtmdet.py +70 -0
  158. percepto-0.1.dev40/tests/test_model_yolox.py +105 -0
  159. percepto-0.1.dev40/tests/test_percepto_new_commands.py +80 -0
  160. percepto-0.1.dev40/tests/test_public_api.py +57 -0
  161. percepto-0.1.dev40/tests/test_registry.py +23 -0
  162. percepto-0.1.dev40/tests/test_resolve.py +85 -0
  163. percepto-0.1.dev40/tests/test_router.py +36 -0
  164. percepto-0.1.dev40/tests/test_skill_protocol.py +57 -0
  165. percepto-0.1.dev40/tests/test_skill_registry.py +49 -0
  166. percepto-0.1.dev40/tests/test_supervision_interop.py +129 -0
  167. percepto-0.1.dev40/tests/test_tracking.py +120 -0
  168. percepto-0.1.dev40/tests/test_validation.py +66 -0
  169. percepto-0.1.dev40/tests/test_yoloworld.py +137 -0
@@ -0,0 +1,11 @@
1
+ ## Summary
2
+
3
+ <!-- 1-3 bullet points describing your changes -->
4
+
5
+ -
6
+
7
+ ## Test plan
8
+
9
+ - [ ] Existing tests pass (`uv run pytest tests/ -v`)
10
+ - [ ] Linting passes (`uv run ruff check src/ tests/`)
11
+ - [ ] New tests added (if applicable)
@@ -0,0 +1,62 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0 # full history for hatch-vcs
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v4
23
+
24
+ - name: Set up Python ${{ matrix.python-version }}
25
+ run: uv python install ${{ matrix.python-version }}
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --dev
29
+
30
+ - name: Lint
31
+ run: uv run ruff check src/ tests/
32
+
33
+ - name: Test
34
+ run: uv run pytest tests/ -v --tb=short --cov=detectors --cov-report=term-missing --cov-report=xml
35
+
36
+ auto-tag:
37
+ needs: lint-and-test
38
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
39
+ runs-on: ubuntu-latest
40
+ permissions:
41
+ contents: write
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ with:
45
+ fetch-depth: 0
46
+ token: ${{ secrets.PAT_TOKEN }}
47
+
48
+ - name: Bump patch version and tag
49
+ run: |
50
+ latest=$(git tag --list 'v*' --sort=-v:refname | head -n1)
51
+ if [ -z "$latest" ]; then
52
+ next="v0.1.0"
53
+ else
54
+ version="${latest#v}"
55
+ major=$(echo "$version" | cut -d. -f1)
56
+ minor=$(echo "$version" | cut -d. -f2)
57
+ patch=$(echo "$version" | cut -d. -f3)
58
+ next="v${major}.${minor}.$((patch + 1))"
59
+ fi
60
+ echo "Tagging $next"
61
+ git tag "$next"
62
+ git push origin "$next"
@@ -0,0 +1,37 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ # environment: pypi
11
+ permissions:
12
+ id-token: write # OIDC trusted publishing
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0 # full history for hatch-vcs
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.13
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --dev
26
+
27
+ - name: Lint
28
+ run: uv run ruff check src/ tests/
29
+
30
+ - name: Test
31
+ run: uv run pytest tests/ -v --tb=short
32
+
33
+ - name: Build
34
+ run: uv build
35
+
36
+ - name: Publish to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,37 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ *.egg
6
+ dist/
7
+ build/
8
+ .eggs/
9
+ *.so
10
+ .venv/
11
+ venv/
12
+ env/
13
+ .env
14
+ *.env.local
15
+ .mypy_cache/
16
+ .pytest_cache/
17
+ .ruff_cache/
18
+ .coverage
19
+ htmlcov/
20
+ *.onnx
21
+ *.engine
22
+ *.trt
23
+ results/
24
+ runs/
25
+ wandb/
26
+ *.pth
27
+ *.pt
28
+ *.ckpt
29
+ uv.lock
30
+ src/detectors/_version.py
31
+ CLAUDE.md
32
+ assets
33
+ *.safetensors
34
+ .gstack/
35
+ DESIGN.md
36
+ TODOS.md
37
+ .claude
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.15.0
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,201 @@
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 the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in 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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: percepto
3
+ Version: 0.1.dev40
4
+ Summary: Universal perception platform for AI agents
5
+ Author: Luis Condados
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.13
9
+ Requires-Dist: huggingface-hub>=1.7.1
10
+ Requires-Dist: loguru>=0.7
11
+ Requires-Dist: numpy>=1.24
12
+ Requires-Dist: nvidia-cudnn-cu12>=9.20.0.48
13
+ Requires-Dist: nvidia-cusparselt-cu12>=0.8.1
14
+ Requires-Dist: nvidia-nccl-cu12>=2.29.7
15
+ Requires-Dist: nvidia-nvshmem-cu12>=3.5.21
16
+ Requires-Dist: onnxruntime>=1.24.3
17
+ Requires-Dist: onnxscript>=0.6.2
18
+ Requires-Dist: opencv-python-headless>=4.8
19
+ Requires-Dist: pillow>=10.0
20
+ Requires-Dist: pydantic>=2.12.5
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: safetensors>=0.7.0
24
+ Requires-Dist: torch>=2.7
25
+ Requires-Dist: torchvision>=0.22
26
+ Requires-Dist: typer>=0.9
27
+ Provides-Extra: agent
28
+ Requires-Dist: mcp[cli]>=1.0.0rc1; extra == 'agent'
29
+ Provides-Extra: coreml
30
+ Requires-Dist: coremltools>=7.0; extra == 'coreml'
31
+ Provides-Extra: dev
32
+ Requires-Dist: mypy>=1.0; extra == 'dev'
33
+ Requires-Dist: pre-commit; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=6.0; extra == 'dev'
35
+ Requires-Dist: pytest>=9.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.15; extra == 'dev'
37
+ Provides-Extra: fiftyone
38
+ Requires-Dist: fiftyone>=1.13.4; extra == 'fiftyone'
39
+ Provides-Extra: hub
40
+ Requires-Dist: huggingface-hub>=0.20; extra == 'hub'
41
+ Provides-Extra: mlflow
42
+ Requires-Dist: mlflow>=2.10; extra == 'mlflow'
43
+ Provides-Extra: onnx
44
+ Requires-Dist: onnx>=1.14; extra == 'onnx'
45
+ Requires-Dist: onnxruntime>=1.15; extra == 'onnx'
46
+ Provides-Extra: openvino
47
+ Requires-Dist: nncf>=2.7; extra == 'openvino'
48
+ Requires-Dist: openvino>=2024.0; extra == 'openvino'
49
+ Provides-Extra: serve
50
+ Requires-Dist: fastapi>=0.100; extra == 'serve'
51
+ Requires-Dist: python-multipart>=0.0.6; extra == 'serve'
52
+ Requires-Dist: uvicorn>=0.20; extra == 'serve'
53
+ Provides-Extra: tracking
54
+ Requires-Dist: supervision<1.0,>=0.26; extra == 'tracking'
55
+ Requires-Dist: trackers<3.0,>=2.0; extra == 'tracking'
56
+ Provides-Extra: train
57
+ Requires-Dist: pycocotools>=2.0; extra == 'train'
58
+ Requires-Dist: pytorch-lightning>=2.2; extra == 'train'
59
+ Requires-Dist: pyyaml>=6.0; extra == 'train'
60
+ Provides-Extra: wandb
61
+ Requires-Dist: wandb>=0.15; extra == 'wandb'
62
+ Provides-Extra: yoloworld
63
+ Requires-Dist: open-clip-torch>=2.24; extra == 'yoloworld'
@@ -0,0 +1,235 @@
1
+ <p align="center">
2
+ <h1 align="center">percepto</h1>
3
+ <p align="center">Universal perception platform for AI agents — clean PyTorch, no magic.</p>
4
+ </p>
5
+
6
+ ---
7
+
8
+ **percepto** is a universal perception platform built on modern PyTorch.
9
+ One consistent API for multiple perception skills — detect, train, export, and let AI agents see.
10
+
11
+ No factory registries. No metaclasses. No OmegaConf. Just explicit Python.
12
+
13
+ ## Highlights
14
+
15
+ - **Skill-based architecture** — every perception task (detect, segment, ocr, depth) is a composable Skill with structured I/O.
16
+ - **Agent-native** — MCP server auto-generated from skill definitions. Claude, Cursor, and any MCP client get perception in seconds.
17
+ - **24 detection models, 6 families** — RTMDet, YOLO-NAS, YOLOX, YOLOv9, YOLO-World, D-FINE — CNN and Transformer architectures.
18
+ - **Open-vocabulary detection** — YOLO-World detects anything from text prompts, no training needed.
19
+ - **3-line detection** — Load a model, run inference, save results.
20
+ - **20+ CLI commands** — detect, track, label, train, finetune, export, evaluate, benchmark, compare, serve, skills, mcp, and more.
21
+ - **Export** — ONNX, OpenVINO (FP32/FP16/INT8), TensorRT, TFLite, and CoreML.
22
+ - **Training** — Full PyTorch Lightning pipeline with Mosaic, MixUp, EMA, QAT, W&B, and MLflow.
23
+ - **Tracking** — Multi-algorithm tracking (SORT, ByteTrack, OC-SORT, DeepSORT) with persistent IDs.
24
+ - **Serving** — FastAPI REST API + MCP server (stdio & HTTP/SSE).
25
+ - **Modern stack** — Python 3.13+, PyTorch 2.7+, uv, typer, loguru, pydantic.
26
+ - **Lean core** — Agent/MCP deps are optional (`percepto[agent]`). Fine-tune and export without the agent overhead.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install percepto
32
+ # or
33
+ uv add percepto
34
+
35
+ # With agent/MCP support
36
+ pip install percepto[agent]
37
+
38
+ # With training
39
+ pip install percepto[train]
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### Python API
45
+
46
+ ```python
47
+ import percepto
48
+
49
+ # Skill-based: run any perception skill
50
+ result = percepto.run("detect", source="image.jpg")
51
+
52
+ # High-level: 3 lines to detect objects
53
+ det = percepto.Detector("rtmdet-s", device="auto")
54
+ result = det("image.jpg")
55
+ result.save("output.jpg")
56
+
57
+ # Discover capabilities
58
+ percepto.capabilities()
59
+ # → {'detect': ['detect', 'objects', 'bounding-boxes', 'coco', 'image', 'video']}
60
+
61
+ # Natural language routing
62
+ skill = percepto.understand("find objects in this image")
63
+ # → DetectionSkill
64
+ ```
65
+
66
+ ### MCP Server (for AI Agents)
67
+
68
+ ```bash
69
+ # Start MCP server for Claude Desktop / Cursor
70
+ percepto mcp stdio
71
+
72
+ # Or HTTP/SSE for any MCP client
73
+ percepto mcp sse --port 8081
74
+ ```
75
+
76
+ ### CLI
77
+
78
+ ```bash
79
+ # Detection
80
+ percepto detect image.jpg
81
+ percepto detect images/ --model rtmdet-l --conf 0.3
82
+
83
+ # Training & fine-tuning
84
+ percepto finetune --data my_dataset/ --model rtmdet-s --epochs 50
85
+ percepto train --config train.yaml
86
+
87
+ # Export
88
+ percepto export --model rtmdet-s --format onnx
89
+ percepto export --model rtmdet-s --format openvino --int8
90
+
91
+ # Discovery
92
+ percepto skills # List all perception skills
93
+ percepto models # Browse detection models
94
+ percepto understand "find objects" # Route query to skill
95
+
96
+ # Tracking, blur, dashboard, benchmark, evaluate, serve...
97
+ percepto --help
98
+ ```
99
+
100
+ ### Video & Webcam
101
+
102
+ ```python
103
+ import percepto
104
+
105
+ det = percepto.Detector("yolox-l", device="cuda")
106
+
107
+ # Write annotated video
108
+ stats = det.detect_video_to_file("input.mp4", "output.mp4")
109
+
110
+ # Live webcam
111
+ for frame_idx, result in det.detect_video(source=0):
112
+ print(f"Frame {frame_idx}: {len(result.boxes)} objects")
113
+ ```
114
+
115
+ ### Low-level Model API
116
+
117
+ ```python
118
+ import torch
119
+
120
+ model = percepto.load("yolov9-c", pretrained=True).eval().cuda()
121
+ x = torch.randn(1, 3, 640, 640).cuda()
122
+ pred_bboxes, pred_scores = model(x)
123
+ # pred_bboxes: [1, 8400, 4] — x1y1x2y2 pixel coordinates
124
+ # pred_scores: [1, 8400, 80] — class probabilities
125
+ ```
126
+
127
+ ## Available Models
128
+
129
+ ### RTMDet
130
+
131
+ | Model | Params | COCO mAP | Input | Paper |
132
+ |---|---|---|---|---|
133
+ | `rtmdet-tiny` | 4.9M | 41.0 | 640 | [arXiv](https://arxiv.org/abs/2212.07784) |
134
+ | `rtmdet-s` | 8.9M | 44.6 | 640 | |
135
+ | `rtmdet-m` | 24.7M | 49.3 | 640 | |
136
+ | `rtmdet-l` | 52.3M | 51.4 | 640 | |
137
+ | `rtmdet-x` | 94.9M | 52.8 | 640 | |
138
+
139
+ ### YOLO-NAS
140
+
141
+ | Model | Params | COCO mAP | Input | Paper |
142
+ |---|---|---|---|---|
143
+ | `yolo-nas-s` | 19.1M | 47.5 | 640 | [arXiv](https://arxiv.org/abs/2211.10882) |
144
+ | `yolo-nas-m` | 51.2M | 51.5 | 640 | |
145
+ | `yolo-nas-l` | 67.0M | 52.2 | 640 | |
146
+
147
+ ### YOLOX
148
+
149
+ | Model | Params | COCO mAP | Input | Paper |
150
+ |---|---|---|---|---|
151
+ | `yolox-tiny` | 5.1M | 32.8 | 416 | [arXiv](https://arxiv.org/abs/2107.08430) |
152
+ | `yolox-s` | 9.0M | 40.5 | 640 | |
153
+ | `yolox-m` | 25.3M | 46.9 | 640 | |
154
+ | `yolox-l` | 54.2M | 49.7 | 640 | |
155
+ | `yolox-x` | 99.1M | 51.1 | 640 | |
156
+
157
+ ### YOLOv9
158
+
159
+ | Model | Params | COCO mAP | Input | Paper |
160
+ |---|---|---|---|---|
161
+ | `yolov9-t` | 2.0M | 38.3 | 640 | [arXiv](https://arxiv.org/abs/2402.13616) |
162
+ | `yolov9-s` | 7.1M | 46.8 | 640 | |
163
+ | `yolov9-m` | 20.0M | 51.4 | 640 | |
164
+ | `yolov9-c` | 25.3M | 53.0 | 640 | |
165
+
166
+ ### YOLO-World
167
+
168
+ Open-vocabulary detection — detect anything from text prompts. Requires `open-clip-torch`.
169
+
170
+ | Model | Params | COCO mAP | Input | Paper |
171
+ |---|---|---|---|---|
172
+ | `yoloworld-s` | 13.0M | 37.6 | 640 | [arXiv](https://arxiv.org/abs/2401.17270) |
173
+ | `yoloworld-m` | 29.0M | 42.8 | 640 | |
174
+ | `yoloworld-l` | 54.0M | 45.7 | 640 | |
175
+
176
+ ### D-FINE
177
+
178
+ DETR-based detector — **SOTA on COCO**. No NMS needed.
179
+
180
+ | Model | Params | COCO mAP | Input | Paper |
181
+ |---|---|---|---|---|
182
+ | `dfine-s` | 11.8M | 48.5 | 640 | [arXiv](https://arxiv.org/abs/2410.13842) |
183
+ | `dfine-m` | 36.2M | 55.8 | 640 | |
184
+ | `dfine-l` | 55.3M | 59.3 | 640 | |
185
+
186
+ ## Architecture
187
+
188
+ ```
189
+ src/percepto/
190
+ ├── _skill.py # Skill Protocol — the core abstraction
191
+ ├── _registry.py # Skill registry + entry_point discovery
192
+ ├── _router.py # Smart Skill Router (NL → skill)
193
+ ├── _compose.py # Pipeline composition engine
194
+ ├── _hardware.py # Hardware-aware model auto-selection
195
+ ├── skills/
196
+ │ └── detect/ # Detection skill (first of many)
197
+ │ ├── models/ # RTMDet, YOLOX, YOLOv9, YOLO-NAS, YOLO-World, D-FINE
198
+ │ ├── inference/ # Preprocess, postprocess, NMS, visualization
199
+ │ └── schemas.py # Pydantic I/O schemas
200
+ ├── mcp/ # Auto-generated MCP server from skills
201
+ ├── cli/ # Auto-generated CLI from skills
202
+ ├── training/ # PyTorch Lightning pipeline
203
+ ├── export/ # ONNX, OpenVINO, TensorRT, TFLite, CoreML
204
+ ├── tracking/ # Multi-algorithm tracker
205
+ ├── evaluation/ # COCO mAP, confusion matrix
206
+ ├── serving/ # FastAPI server
207
+ ├── hub/ # HuggingFace Hub integration
208
+ └── nn/ # Shared building blocks
209
+ ```
210
+
211
+ ## Development
212
+
213
+ ```bash
214
+ git clone https://github.com/CondadosAI/detectors.git
215
+ cd detectors
216
+ uv sync
217
+ uv run pytest tests/ -v
218
+ uv run ruff check src/ tests/
219
+ ```
220
+
221
+ ## License & Attribution
222
+
223
+ This library is licensed under [Apache 2.0](LICENSE).
224
+
225
+ All model architectures are **clean reimplementations** — written from scratch
226
+ based on published papers, not copied from original repositories. Pretrained
227
+ weights are converted from the original project checkpoints and may carry their
228
+ upstream license terms.
229
+
230
+ | Model family | Original project | Code license | Weight license |
231
+ |---|---|---|---|
232
+ | RTMDet | [open-mmlab/mmdetection](https://github.com/open-mmlab/mmdetection) | Apache-2.0 | Apache-2.0 |
233
+ | YOLOX | [Megvii-BaseDetection/YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) | Apache-2.0 | Apache-2.0 |
234
+ | YOLO-NAS | [Deci-AI/super-gradients](https://github.com/Deci-AI/super-gradients) | Apache-2.0 | **Deci proprietary** |
235
+ | YOLOv9 | [MultimediaTechLab/YOLO](https://github.com/MultimediaTechLab/YOLO) | MIT | MIT |