fastpipo 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.
- fastpipo-0.1.0/.clang-format +10 -0
- fastpipo-0.1.0/.gitignore +229 -0
- fastpipo-0.1.0/CHANGELOG.md +67 -0
- fastpipo-0.1.0/CITATION.cff +17 -0
- fastpipo-0.1.0/CMakeLists.txt +60 -0
- fastpipo-0.1.0/CONTRIBUTING.md +47 -0
- fastpipo-0.1.0/LICENSE +21 -0
- fastpipo-0.1.0/PKG-INFO +267 -0
- fastpipo-0.1.0/README.md +233 -0
- fastpipo-0.1.0/SECURITY.md +16 -0
- fastpipo-0.1.0/benchmarks/__init__.py +0 -0
- fastpipo-0.1.0/benchmarks/datasets/__init__.py +3 -0
- fastpipo-0.1.0/benchmarks/datasets/synthetic.py +252 -0
- fastpipo-0.1.0/benchmarks/python/array_native_sliced.py +259 -0
- fastpipo-0.1.0/benchmarks/python/bench_common.py +561 -0
- fastpipo-0.1.0/benchmarks/python/bench_end_to_end.py +165 -0
- fastpipo-0.1.0/benchmarks/python/bench_grid.py +77 -0
- fastpipo-0.1.0/benchmarks/python/bench_postprocess.py +504 -0
- fastpipo-0.1.0/benchmarks/python/bench_supervision.py +221 -0
- fastpipo-0.1.0/benchmarks/python/capture_raw.py +51 -0
- fastpipo-0.1.0/benchmarks/python/make_mosaic.py +49 -0
- fastpipo-0.1.0/benchmarks/python/run_day2.sh +73 -0
- fastpipo-0.1.0/benchmarks/python/run_step0.sh +77 -0
- fastpipo-0.1.0/benchmarks/python/step0_end_to_end.py +390 -0
- fastpipo-0.1.0/benchmarks/python/summarize_day2.py +103 -0
- fastpipo-0.1.0/benchmarks/python/summarize_v0_1.py +150 -0
- fastpipo-0.1.0/docs/architecture.md +103 -0
- fastpipo-0.1.0/docs/decisions.md +50 -0
- fastpipo-0.1.0/docs/semantics.md +151 -0
- fastpipo-0.1.0/include/fastpipo/algorithms/greedy_nmm.hpp +45 -0
- fastpipo-0.1.0/include/fastpipo/algorithms/nmm.hpp +62 -0
- fastpipo-0.1.0/include/fastpipo/geometry/hbb.hpp +91 -0
- fastpipo-0.1.0/include/fastpipo/merge.hpp +32 -0
- fastpipo-0.1.0/include/fastpipo/spatial/grid.hpp +229 -0
- fastpipo-0.1.0/include/fastpipo/types.hpp +64 -0
- fastpipo-0.1.0/pyproject.toml +64 -0
- fastpipo-0.1.0/python/fastpipo/__init__.py +22 -0
- fastpipo-0.1.0/python/fastpipo/_api.py +310 -0
- fastpipo-0.1.0/python/fastpipo/_result.py +29 -0
- fastpipo-0.1.0/python/fastpipo/_tiles.py +170 -0
- fastpipo-0.1.0/python/fastpipo/sahi.py +295 -0
- fastpipo-0.1.0/python/fastpipo/supervision.py +116 -0
- fastpipo-0.1.0/requirements-bench.txt +9 -0
- fastpipo-0.1.0/requirements-test.txt +6 -0
- fastpipo-0.1.0/src/bindings/module.cpp +102 -0
- fastpipo-0.1.0/src/core/merge.cpp +400 -0
- fastpipo-0.1.0/tests/cpp/CMakeLists.txt +14 -0
- fastpipo-0.1.0/tests/cpp/test_grid.cpp +98 -0
- fastpipo-0.1.0/tests/cpp/test_hbb.cpp +85 -0
- fastpipo-0.1.0/tests/cpp/test_merge.cpp +196 -0
- fastpipo-0.1.0/tests/python/conftest.py +23 -0
- fastpipo-0.1.0/tests/python/golden/conftest.py +14 -0
- fastpipo-0.1.0/tests/python/golden/sahi_methods.py +206 -0
- fastpipo-0.1.0/tests/python/golden/sahi_reference.py +27 -0
- fastpipo-0.1.0/tests/python/golden/test_adapter_sahi.py +110 -0
- fastpipo-0.1.0/tests/python/golden/test_adapter_sahi_methods.py +158 -0
- fastpipo-0.1.0/tests/python/golden/test_adapter_supervision.py +146 -0
- fastpipo-0.1.0/tests/python/golden/test_greedy_nmm_sahi.py +107 -0
- fastpipo-0.1.0/tests/python/golden/test_greedy_nmm_sahi_boundary.py +204 -0
- fastpipo-0.1.0/tests/python/golden/test_greedy_nmm_sahi_matrix.py +34 -0
- fastpipo-0.1.0/tests/python/golden/test_merge_tiles_methods.py +179 -0
- fastpipo-0.1.0/tests/python/golden/test_merge_tiles_sahi.py +134 -0
- fastpipo-0.1.0/tests/python/golden/test_new_datasets_sahi.py +50 -0
- fastpipo-0.1.0/tests/python/golden/test_nmm_pr1524_sahi.py +149 -0
- fastpipo-0.1.0/tests/python/golden/test_nmm_sahi.py +82 -0
- fastpipo-0.1.0/tests/python/golden/test_nms_sahi.py +74 -0
- fastpipo-0.1.0/tests/python/golden/test_phase2_float64.py +127 -0
- fastpipo-0.1.0/tests/python/golden/test_sahi_path_coverage.py +32 -0
- fastpipo-0.1.0/tests/python/golden/test_supervision_golden.py +89 -0
- fastpipo-0.1.0/tests/python/property/test_invariants.py +159 -0
- fastpipo-0.1.0/tests/python/property/test_pair_search.py +119 -0
- fastpipo-0.1.0/tests/python/test_edge_cases.py +97 -0
- fastpipo-0.1.0/tests/python/test_greedy_nmm_cases.py +109 -0
- fastpipo-0.1.0/tests/python/test_greedy_nmm_supervision_cases.py +109 -0
- fastpipo-0.1.0/tests/python/test_greedy_nmm_validation.py +131 -0
- fastpipo-0.1.0/tests/python/test_merge_tiles.py +187 -0
- fastpipo-0.1.0/tests/python/test_nmm_cases.py +131 -0
- fastpipo-0.1.0/tests/python/test_nms_cases.py +137 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
BasedOnStyle: Google
|
|
2
|
+
IndentWidth: 4
|
|
3
|
+
ColumnLimit: 100
|
|
4
|
+
AccessModifierOffset: -4
|
|
5
|
+
DerivePointerAlignment: false
|
|
6
|
+
PointerAlignment: Left
|
|
7
|
+
AllowShortFunctionsOnASingleLine: Inline
|
|
8
|
+
AllowShortIfStatementsOnASingleLine: WithoutElse
|
|
9
|
+
AllowShortLoopsOnASingleLine: true
|
|
10
|
+
IncludeBlocks: Regroup
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
# Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# uv
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
# poetry.lock
|
|
110
|
+
# poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
# pdm.lock
|
|
117
|
+
# pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
# pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi/*
|
|
127
|
+
!.pixi/config.toml
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule*
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Conda environments
|
|
163
|
+
conda-meta/
|
|
164
|
+
|
|
165
|
+
# Spyder project settings
|
|
166
|
+
.spyderproject
|
|
167
|
+
.spyproject
|
|
168
|
+
|
|
169
|
+
# Rope project settings
|
|
170
|
+
.ropeproject
|
|
171
|
+
|
|
172
|
+
# mkdocs/Zensical documentation
|
|
173
|
+
/site
|
|
174
|
+
|
|
175
|
+
# mypy
|
|
176
|
+
.mypy_cache/
|
|
177
|
+
.dmypy.json
|
|
178
|
+
dmypy.json
|
|
179
|
+
|
|
180
|
+
# Pyre type checker
|
|
181
|
+
.pyre/
|
|
182
|
+
|
|
183
|
+
# pytype static type analyzer
|
|
184
|
+
.pytype/
|
|
185
|
+
|
|
186
|
+
# Cython debug symbols
|
|
187
|
+
cython_debug/
|
|
188
|
+
|
|
189
|
+
# PyCharm
|
|
190
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
191
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
192
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
193
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
194
|
+
# .idea/
|
|
195
|
+
|
|
196
|
+
# Abstra
|
|
197
|
+
# Abstra is an AI-powered process automation framework.
|
|
198
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
199
|
+
# Learn more at https://abstra.io/docs
|
|
200
|
+
.abstra/
|
|
201
|
+
|
|
202
|
+
# Visual Studio Code
|
|
203
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
204
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
205
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
206
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
207
|
+
# .vscode/
|
|
208
|
+
# Temporary file for partial code execution
|
|
209
|
+
tempCodeRunnerFile.py
|
|
210
|
+
|
|
211
|
+
# Ruff stuff:
|
|
212
|
+
.ruff_cache/
|
|
213
|
+
|
|
214
|
+
# PyPI configuration file
|
|
215
|
+
.pypirc
|
|
216
|
+
|
|
217
|
+
# Marimo
|
|
218
|
+
marimo/_static/
|
|
219
|
+
marimo/_lsp/
|
|
220
|
+
__marimo__/
|
|
221
|
+
|
|
222
|
+
# Streamlit
|
|
223
|
+
.streamlit/secrets.toml
|
|
224
|
+
|
|
225
|
+
# CMake/CTest
|
|
226
|
+
Testing/
|
|
227
|
+
|
|
228
|
+
# Private files kept next to the repository, never committed
|
|
229
|
+
secret/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
FastPiPo follows semantic versioning. While the major version is 0, the API may still change.
|
|
4
|
+
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
## 0.1.0 - 2026-12-01
|
|
8
|
+
|
|
9
|
+
First release. Horizontal boxes only. Wheels for Linux (glibc 2.28 or newer) on x86_64 and aarch64,
|
|
10
|
+
Python 3.10 to 3.14; other platforms install from the source distribution.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Merging functions that return NumPy arrays: `fpp.nms` (kept indices), `fpp.greedy_nmm`, `fpp.nmm`
|
|
15
|
+
(transitive NMM as in SAHI 0.14.1), each with IoU or IoS and class-aware or class-agnostic
|
|
16
|
+
buckets. Results carry the phase 1 groups as CSR arrays.
|
|
17
|
+
- `semantics="sahi"` (default) matches SAHI 0.14.1 exactly; `semantics="supervision"` matches
|
|
18
|
+
supervision 0.32.3 for NMS and greedy NMM.
|
|
19
|
+
- `fpp.merge_tiles`: shifts per-tile detections to full-image coordinates (SAHI's clamp, filter and
|
|
20
|
+
offset) and merges them for every method.
|
|
21
|
+
- SAHI adapters: `fpp.sahi.FastGreedyNMMPostprocess`, `FastNMMPostprocess`, `FastNMSPostprocess`,
|
|
22
|
+
array entry points `fpp.sahi.nms/nmm/greedy_nmm`, and `fpp.sahi.register()` / `unregister()` to
|
|
23
|
+
plug the classes into `get_sliced_prediction`.
|
|
24
|
+
- supervision adapter: `fpp.supervision.with_nms` and `with_nmm` for `sv.Detections`.
|
|
25
|
+
- `recheck_match=False` for `fpp.nmm`, `fpp.sahi.nmm` and `merge_tiles(method="nmm")`: the NMM
|
|
26
|
+
behavior proposed in SAHI PR #1524 (every member merges). `FastNMMPostprocess` follows the
|
|
27
|
+
installed SAHI by default; `fpp.sahi.register(nmm_recheck_match=...)` can force either behavior.
|
|
28
|
+
- Bit-exact phase 2 for the SAHI classes and `merge_tiles`: phase 1 runs on float32 copies, phase 2
|
|
29
|
+
on SAHI's float64 `ObjectPrediction` values (core `Phase2Input`). `merge_tiles(semantics="sahi")`
|
|
30
|
+
returns float64 boxes and scores. Measured cost on real VisDrone captures: 0.07 to 0.5 ms more per
|
|
31
|
+
`merge_tiles` call, 2% to 4% for the drop-in class.
|
|
32
|
+
- `merge_tiles(semantics="supervision")` reproduces `sv.InferenceSlicer`'s shift (no clamp or filter,
|
|
33
|
+
NumPy type promotion).
|
|
34
|
+
- Multi-level grid for candidate search; brute force below 64 boxes per bucket.
|
|
35
|
+
- Test suite: hand-checked cases, golden tests against SAHI (numpy and numba backends) and
|
|
36
|
+
supervision, a test that every SAHI code path is exercised, hypothesis property tests, Catch2 C++
|
|
37
|
+
tests (also run under AddressSanitizer and UndefinedBehaviorSanitizer), and a GitHub Actions
|
|
38
|
+
workflow.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- The internal `_core.greedy_nmm_f32/f64` entry points were removed; `_core.run_f32/run_f64`
|
|
43
|
+
replace them.
|
|
44
|
+
- The spike result class `GreedyNmmResult` is now `MergeResult`; the old name is kept as an alias.
|
|
45
|
+
- The grid no longer has an overflow list. On a mixed-scale set with IoU at 20,000 boxes the greedy
|
|
46
|
+
NMM kernel takes 18.5 ms instead of 54.6 ms (2.94×, just under the 3× target); other sets are within 9%.
|
|
47
|
+
|
|
48
|
+
### Fixed (from the v0.1 review)
|
|
49
|
+
|
|
50
|
+
- NMM with threshold ≤ 0 now follows SAHI's match-all shortcut when boxes tied with the top score
|
|
51
|
+
duplicate each other.
|
|
52
|
+
- A float32 threshold so small that it rounds to 0 gave different results on buckets of 64 or more
|
|
53
|
+
boxes (grid) than on smaller ones.
|
|
54
|
+
- Boxes whose extent overflows float64 made the grid loop forever.
|
|
55
|
+
- Float class ids outside the int64 range were wrapped into one class; they now raise `ValueError`.
|
|
56
|
+
- `fastpipo.supervision.with_nmm` returned float64 confidences where supervision returns float32
|
|
57
|
+
(float64 input, every group merged).
|
|
58
|
+
|
|
59
|
+
### Known limits
|
|
60
|
+
|
|
61
|
+
- No oriented boxes (planned for 0.3), masks, tile cutting, or fused preprocessing.
|
|
62
|
+
- SAHI's `NMMPostprocess` is reproduced as released in 0.14.1 by default: members that joined a
|
|
63
|
+
group only through another member can be dropped in phase 2. The PR #1524 behavior is optional and
|
|
64
|
+
is tested against SAHI's code with the PR's one-line change applied, not against a SAHI release.
|
|
65
|
+
- supervision orders equal scores with an unstable sort; FastPiPo uses the SAHI tie rule, so
|
|
66
|
+
results agree with supervision when scores are distinct.
|
|
67
|
+
- Benchmark numbers come from one machine and are labeled as such.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use FastPiPo in your work, please cite it as below."
|
|
3
|
+
title: "FastPiPo: Fast pre/post-processing for deployed vision models"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Wongdee
|
|
7
|
+
given-names: Panyapat
|
|
8
|
+
version: 0.1.0
|
|
9
|
+
date-released: 2026-12-01
|
|
10
|
+
license: MIT
|
|
11
|
+
repository-code: "https://github.com/panyapat-wongdee/fastpipo"
|
|
12
|
+
keywords:
|
|
13
|
+
- object detection
|
|
14
|
+
- tiled inference
|
|
15
|
+
- non-maximum suppression
|
|
16
|
+
- non-maximum merging
|
|
17
|
+
- SAHI
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.20)
|
|
2
|
+
project(fastpipo LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
7
|
+
|
|
8
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
9
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
10
|
+
endif()
|
|
11
|
+
|
|
12
|
+
# ---- core library (no Python dependencies) ----
|
|
13
|
+
add_library(fastpipo STATIC
|
|
14
|
+
src/core/merge.cpp
|
|
15
|
+
)
|
|
16
|
+
add_library(fastpipo::fastpipo ALIAS fastpipo)
|
|
17
|
+
target_include_directories(fastpipo PUBLIC
|
|
18
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
|
19
|
+
target_compile_features(fastpipo PUBLIC cxx_std_17)
|
|
20
|
+
set_target_properties(fastpipo PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
21
|
+
|
|
22
|
+
# Results must not depend on FMA availability: no contraction, no fast-math.
|
|
23
|
+
if(MSVC)
|
|
24
|
+
target_compile_options(fastpipo PRIVATE /fp:precise)
|
|
25
|
+
else()
|
|
26
|
+
target_compile_options(fastpipo PRIVATE -ffp-contract=off -Wall -Wextra)
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
option(FASTPIPO_BUILD_TESTS "Build the C++ unit tests (fetches Catch2)" OFF)
|
|
30
|
+
option(FASTPIPO_BUILD_PYTHON "Build the Python extension" ON)
|
|
31
|
+
|
|
32
|
+
if(FASTPIPO_BUILD_TESTS)
|
|
33
|
+
enable_testing()
|
|
34
|
+
add_subdirectory(tests/cpp)
|
|
35
|
+
endif()
|
|
36
|
+
|
|
37
|
+
if(NOT FASTPIPO_BUILD_PYTHON)
|
|
38
|
+
return()
|
|
39
|
+
endif()
|
|
40
|
+
|
|
41
|
+
# ---- Python extension ----
|
|
42
|
+
set(_fpp_py_components Interpreter Development.Module)
|
|
43
|
+
if(NOT CMAKE_VERSION VERSION_LESS 3.26)
|
|
44
|
+
list(APPEND _fpp_py_components Development.SABIModule)
|
|
45
|
+
endif()
|
|
46
|
+
find_package(Python 3.10 COMPONENTS ${_fpp_py_components} REQUIRED)
|
|
47
|
+
|
|
48
|
+
execute_process(
|
|
49
|
+
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
|
|
50
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
51
|
+
OUTPUT_VARIABLE nanobind_ROOT
|
|
52
|
+
RESULT_VARIABLE _nb_result)
|
|
53
|
+
if(NOT _nb_result EQUAL 0)
|
|
54
|
+
message(FATAL_ERROR "nanobind not found for ${Python_EXECUTABLE}")
|
|
55
|
+
endif()
|
|
56
|
+
find_package(nanobind CONFIG REQUIRED)
|
|
57
|
+
|
|
58
|
+
nanobind_add_module(_core STABLE_ABI NB_STATIC src/bindings/module.cpp)
|
|
59
|
+
target_link_libraries(_core PRIVATE fastpipo::fastpipo)
|
|
60
|
+
install(TARGETS _core LIBRARY DESTINATION fastpipo)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Contributing to FastPiPo
|
|
2
|
+
|
|
3
|
+
Thanks for your interest. FastPiPo is small and early (0.x), so issues are the best place to start:
|
|
4
|
+
please open one before a large pull request, so we can agree on the approach first.
|
|
5
|
+
|
|
6
|
+
## Reporting a problem
|
|
7
|
+
|
|
8
|
+
- **Results differ from SAHI or supervision**: use the "Result mismatch" issue form. Include the
|
|
9
|
+
library versions, the function and arguments, and the smallest input that shows the difference
|
|
10
|
+
(an `.npz` file or a few rows of boxes, scores and class ids). Exact compatibility is a core goal,
|
|
11
|
+
so these reports are especially useful.
|
|
12
|
+
- **Other bugs**: use the "Bug report" form.
|
|
13
|
+
- **Security issues**: do not open a public issue; see [SECURITY.md](SECURITY.md).
|
|
14
|
+
|
|
15
|
+
## Development setup
|
|
16
|
+
|
|
17
|
+
Needs a C++17 compiler, CMake 3.20 or newer, and Python 3.10 or newer.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install scikit-build-core nanobind cmake ninja numpy
|
|
21
|
+
pip install --no-build-isolation -e .
|
|
22
|
+
pip install -r requirements-test.txt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Tests
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pytest tests/python -q # full suite, about 8 minutes
|
|
29
|
+
pytest tests/python -q --ignore=tests/python/golden # fast tests, no SAHI or supervision needed
|
|
30
|
+
cmake -S . -B build -DFASTPIPO_BUILD_TESTS=ON -DFASTPIPO_BUILD_PYTHON=OFF
|
|
31
|
+
cmake --build build && ctest --test-dir build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
A change to merge behavior needs a test that pins it: a hand-checked case in `tests/python`, and a
|
|
35
|
+
golden test against the reference library when the behavior comes from SAHI or supervision.
|
|
36
|
+
`docs/semantics.md` is the specification of what is reproduced; update it with the code.
|
|
37
|
+
|
|
38
|
+
## Pull requests
|
|
39
|
+
|
|
40
|
+
- Keep each pull request to one change, with a short description of why.
|
|
41
|
+
- CI must pass (Python tests on x86_64 and arm64 with NumPy 1.26 and 2.x, C++ tests under
|
|
42
|
+
AddressSanitizer and UndefinedBehaviorSanitizer).
|
|
43
|
+
- Format C++ with the repository's `.clang-format`.
|
|
44
|
+
- Add a line to the unreleased section of `CHANGELOG.md` for user-visible changes.
|
|
45
|
+
- Performance claims need numbers from `benchmarks/python`, with the machine stated.
|
|
46
|
+
|
|
47
|
+
By contributing you agree that your contribution is licensed under the MIT License.
|
fastpipo-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Panyapat Wongdee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|