trainingsample 0.3.0__tar.gz → 0.3.2__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 (47) hide show
  1. {trainingsample-0.3.0 → trainingsample-0.3.2}/.github/workflows/ci.yml +2 -3
  2. {trainingsample-0.3.0 → trainingsample-0.3.2}/.github/workflows/publish.yml +30 -8
  3. trainingsample-0.3.2/BENCHMARKS.md +102 -0
  4. {trainingsample-0.3.0 → trainingsample-0.3.2}/Cargo.lock +136 -119
  5. {trainingsample-0.3.0 → trainingsample-0.3.2}/Cargo.toml +4 -4
  6. {trainingsample-0.3.0 → trainingsample-0.3.2}/PKG-INFO +3 -2
  7. trainingsample-0.3.2/README.md +137 -0
  8. trainingsample-0.3.2/docs/API_COMPAT_CV2.md +162 -0
  9. trainingsample-0.3.2/docs/BUILDING_STATIC_OPENCV.md +125 -0
  10. {trainingsample-0.3.0 → trainingsample-0.3.2}/pyproject.toml +5 -4
  11. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/cv_compat.rs +88 -0
  12. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/python_bindings.rs +33 -33
  13. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/tests.rs +49 -0
  14. trainingsample-0.3.2/tests/coverage_tests.rs +427 -0
  15. {trainingsample-0.3.0 → trainingsample-0.3.2}/tests/test_python_bindings.py +18 -0
  16. trainingsample-0.3.0/BENCHMARKS.md +0 -137
  17. trainingsample-0.3.0/README.md +0 -180
  18. trainingsample-0.3.0/docs/API_COMPAT_CV2.md +0 -216
  19. trainingsample-0.3.0/docs/BUILDING_STATIC_OPENCV.md +0 -198
  20. {trainingsample-0.3.0 → trainingsample-0.3.2}/.cargo/config.toml +0 -0
  21. {trainingsample-0.3.0 → trainingsample-0.3.2}/.envrc +0 -0
  22. {trainingsample-0.3.0 → trainingsample-0.3.2}/.gitignore +0 -0
  23. {trainingsample-0.3.0 → trainingsample-0.3.2}/.pre-commit-config.yaml +0 -0
  24. {trainingsample-0.3.0 → trainingsample-0.3.2}/.rustfmt.toml +0 -0
  25. {trainingsample-0.3.0 → trainingsample-0.3.2}/Dockerfile +0 -0
  26. {trainingsample-0.3.0 → trainingsample-0.3.2}/LICENSE +0 -0
  27. {trainingsample-0.3.0 → trainingsample-0.3.2}/clippy.toml +0 -0
  28. {trainingsample-0.3.0 → trainingsample-0.3.2}/rust-toolchain.toml +0 -0
  29. {trainingsample-0.3.0 → trainingsample-0.3.2}/scripts/build-opencv-static.sh +0 -0
  30. {trainingsample-0.3.0 → trainingsample-0.3.2}/scripts/repair-wheel.sh +0 -0
  31. {trainingsample-0.3.0 → trainingsample-0.3.2}/scripts/run_competitive_benchmarks.sh +0 -0
  32. {trainingsample-0.3.0 → trainingsample-0.3.2}/setup-env.sh +0 -0
  33. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/core.rs +0 -0
  34. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/cropping.rs +0 -0
  35. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/cv_batch_ops.rs +0 -0
  36. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/cv_batch_ops_optimized.rs +0 -0
  37. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/format_conversion_simd.rs +0 -0
  38. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/lib.rs +0 -0
  39. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/loading.rs +0 -0
  40. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/luminance.rs +0 -0
  41. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/luminance_simd.rs +0 -0
  42. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/opencv_ops.rs +0 -0
  43. {trainingsample-0.3.0 → trainingsample-0.3.2}/src/true_batch_ops.rs +0 -0
  44. {trainingsample-0.3.0 → trainingsample-0.3.2}/tests/__init__.py +0 -0
  45. {trainingsample-0.3.0 → trainingsample-0.3.2}/tests/comprehensive_tests.rs +0 -0
  46. {trainingsample-0.3.0 → trainingsample-0.3.2}/tests/test_comprehensive.py +0 -0
  47. {trainingsample-0.3.0 → trainingsample-0.3.2}/tests/test_performance_benchmarks.py +0 -0
@@ -108,7 +108,7 @@ jobs:
108
108
  runs-on: ubuntu-latest
109
109
  strategy:
110
110
  matrix:
111
- python-version: ["3.11", "3.12", "3.13"]
111
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
112
112
 
113
113
  steps:
114
114
  - uses: actions/checkout@v4
@@ -387,7 +387,7 @@ jobs:
387
387
  runs-on: ubuntu-24.04-arm
388
388
  strategy:
389
389
  matrix:
390
- python: ["3.11", "3.12", "3.13"]
390
+ python: ["3.11", "3.12", "3.13", "3.14"]
391
391
 
392
392
  steps:
393
393
  - uses: actions/checkout@v4
@@ -434,7 +434,6 @@ jobs:
434
434
  container: off
435
435
  manylinux: manylinux_2_39
436
436
  env:
437
- PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
438
437
  LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
439
438
  LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
440
439
  OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
@@ -25,6 +25,10 @@ jobs:
25
25
  target: x86_64
26
26
  manylinux: manylinux_2_35
27
27
  python: '3.13'
28
+ - os: ubuntu-22.04
29
+ target: x86_64
30
+ manylinux: manylinux_2_35
31
+ python: '3.14'
28
32
  # Ubuntu 24.04 (libc 2.39)
29
33
  - os: ubuntu-24.04
30
34
  target: x86_64
@@ -38,6 +42,10 @@ jobs:
38
42
  target: x86_64
39
43
  manylinux: manylinux_2_39
40
44
  python: '3.13'
45
+ - os: ubuntu-24.04
46
+ target: x86_64
47
+ manylinux: manylinux_2_39
48
+ python: '3.14'
41
49
  steps:
42
50
  - uses: actions/checkout@v4
43
51
  - uses: actions/setup-python@v5
@@ -104,8 +112,6 @@ jobs:
104
112
  container: off
105
113
  manylinux: ${{ matrix.manylinux }}
106
114
  env:
107
- # Use stable ABI for forward compatibility
108
- PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
109
115
  # LLVM for opencv-rust bindings (from earlier install step)
110
116
  LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
111
117
  LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
@@ -135,7 +141,7 @@ jobs:
135
141
  runs-on: ubuntu-24.04-arm
136
142
  strategy:
137
143
  matrix:
138
- python: ['3.11', '3.12', '3.13']
144
+ python: ['3.11', '3.12', '3.13', '3.14']
139
145
  steps:
140
146
  - uses: actions/checkout@v4
141
147
  - uses: actions/setup-python@v5
@@ -186,8 +192,6 @@ jobs:
186
192
  container: off
187
193
  manylinux: manylinux_2_39
188
194
  env:
189
- # Use stable ABI for forward compatibility
190
- PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
191
195
  # LLVM for opencv-rust bindings (from earlier install step)
192
196
  LIBCLANG_PATH: ${{ env.LIBCLANG_PATH }}
193
197
  LLVM_CONFIG_PATH: ${{ env.LLVM_CONFIG_PATH }}
@@ -217,7 +221,7 @@ jobs:
217
221
  strategy:
218
222
  matrix:
219
223
  target: [aarch64]
220
- python: ['3.11', '3.12', '3.13']
224
+ python: ['3.11', '3.12', '3.13', '3.14']
221
225
  steps:
222
226
  - uses: actions/checkout@v4
223
227
  - uses: actions/setup-python@v5
@@ -251,8 +255,6 @@ jobs:
251
255
  args: --release --out dist -i python --no-default-features --features python-bindings,simd,opencv,metal
252
256
  sccache: 'false'
253
257
  env:
254
- # Use stable ABI for forward compatibility
255
- PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
256
258
  # OpenCV static linking configuration
257
259
  OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
258
260
  OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
@@ -306,6 +308,11 @@ jobs:
306
308
  manylinux: manylinux_2_35
307
309
  python: '3.13'
308
310
  artifact_name: wheels-ubuntu-22.04-x86_64-py3.13
311
+ - os: ubuntu-22.04
312
+ target: x86_64
313
+ manylinux: manylinux_2_35
314
+ python: '3.14'
315
+ artifact_name: wheels-ubuntu-22.04-x86_64-py3.14
309
316
  # Ubuntu 24.04 (libc 2.39)
310
317
  - os: ubuntu-24.04
311
318
  target: x86_64
@@ -322,6 +329,11 @@ jobs:
322
329
  manylinux: manylinux_2_39
323
330
  python: '3.13'
324
331
  artifact_name: wheels-ubuntu-24.04-x86_64-py3.13
332
+ - os: ubuntu-24.04
333
+ target: x86_64
334
+ manylinux: manylinux_2_39
335
+ python: '3.14'
336
+ artifact_name: wheels-ubuntu-24.04-x86_64-py3.14
325
337
  # Linux aarch64 (DGX Spark / GB10)
326
338
  - os: ubuntu-24.04-arm
327
339
  target: aarch64
@@ -338,6 +350,11 @@ jobs:
338
350
  manylinux: manylinux_2_39
339
351
  python: '3.13'
340
352
  artifact_name: wheels-linux-aarch64-py3.13
353
+ - os: ubuntu-24.04-arm
354
+ target: aarch64
355
+ manylinux: manylinux_2_39
356
+ python: '3.14'
357
+ artifact_name: wheels-linux-aarch64-py3.14
341
358
  # macOS aarch64
342
359
  - os: macos-latest
343
360
  target: aarch64
@@ -354,6 +371,11 @@ jobs:
354
371
  manylinux: ''
355
372
  python: '3.13'
356
373
  artifact_name: wheels-macos-latest-aarch64-py3.13
374
+ - os: macos-latest
375
+ target: aarch64
376
+ manylinux: ''
377
+ python: '3.14'
378
+ artifact_name: wheels-macos-latest-aarch64-py3.14
357
379
  steps:
358
380
  - uses: actions/download-artifact@v4
359
381
  with:
@@ -0,0 +1,102 @@
1
+ # Benchmarks
2
+
3
+ ## Commands
4
+
5
+ Build the current checkout before measuring:
6
+
7
+ ```bash
8
+ python -m venv .venv
9
+ .venv/bin/python -m pip install -e '.[dev]'
10
+ .venv/bin/maturin develop --release
11
+ ```
12
+
13
+ Run the performance suite:
14
+
15
+ ```bash
16
+ .venv/bin/python -m pytest tests/test_performance_benchmarks.py -q -s
17
+ ```
18
+
19
+ Run pytest-benchmark cases only:
20
+
21
+ ```bash
22
+ .venv/bin/python -m pytest \
23
+ tests/test_performance_benchmarks.py::TestDetailedBenchmarks \
24
+ --benchmark-only
25
+ ```
26
+
27
+ Save machine-readable results:
28
+
29
+ ```bash
30
+ .venv/bin/python -m pytest \
31
+ tests/test_performance_benchmarks.py::TestDetailedBenchmarks \
32
+ --benchmark-only \
33
+ --benchmark-json benchmark.json
34
+ ```
35
+
36
+ ## Measured operations
37
+
38
+ | Case | TrainingSample call | Reference |
39
+ |---|---|---|
40
+ | Crop | `batch_crop_images` | NumPy slicing |
41
+ | Resize | `batch_resize_images` | direct `cv2.resize(..., INTER_LINEAR)` loop |
42
+ | Luminance | `batch_calculate_luminance` | `cv2.cvtColor(..., COLOR_RGB2GRAY)` plus `numpy.mean` |
43
+ | Pipeline | resize, then luminance | equivalent OpenCV loop |
44
+ | Video resize | `batch_resize_videos` | no external baseline |
45
+ | Center crop | `batch_center_crop_images` | no external baseline |
46
+
47
+ ## Comparison constraints
48
+
49
+ | Topic | Constraint |
50
+ |---|---|
51
+ | Crop ownership | TrainingSample returns owned arrays; plain NumPy slicing returns views |
52
+ | Resize color order | Resize is applied directly to the same RGB byte arrays; no RGB/BGR conversion is included |
53
+ | Resize interpolation | Both resize paths use linear interpolation |
54
+ | Luminance input | Both paths interpret the input as RGB |
55
+ | Batch shape | Mixed-shape inputs are processed one image at a time by the OpenCV reference loop |
56
+ | Build mode | Measure release builds only |
57
+
58
+ NumPy view-returning crop timings do not measure the cost of producing owned,
59
+ contiguous output. Use `.copy()` when owned-output cost is the subject of the
60
+ comparison.
61
+
62
+ ## Result metadata
63
+
64
+ Record these fields with timing results:
65
+
66
+ ```text
67
+ git commit
68
+ operating system and architecture
69
+ CPU model
70
+ Python version
71
+ NumPy version
72
+ TrainingSample version
73
+ Rust OpenCV version and link mode
74
+ Python cv2 version
75
+ OpenCV thread count
76
+ input shapes and dtypes
77
+ batch size
78
+ target sizes
79
+ warm-up count
80
+ sample count
81
+ median and dispersion
82
+ ```
83
+
84
+ ## Test behavior
85
+
86
+ The performance file contains both benchmarks and assertions.
87
+
88
+ | Assertion type | Examples |
89
+ |---|---|
90
+ | Correctness | output count, shape, dtype, pixel equality, luminance tolerance |
91
+ | Resource behavior | repeated calls, concurrent calls, memory cleanup |
92
+ | Broad timing guard | completion limits and scaling bounds intended for CI |
93
+ | Statistical timing | pytest-benchmark cases in `TestDetailedBenchmarks` |
94
+
95
+ Single-run `time.perf_counter` output is diagnostic. It is not a stable result
96
+ across hosts or OpenCV builds.
97
+
98
+ ## Published numbers
99
+
100
+ This repository does not currently store benchmark artifacts keyed by commit,
101
+ host, and OpenCV configuration. Fixed timing tables are therefore not included
102
+ in this document.