ashvardanian / ashvardanian/NumKong
Feature request: CPU separable 3D linear resampling for DHWC volumes
- Dominant language
- C
- Stars
- 1.9k
- Forks
- 130
- Avg merge
- 18h 28m
- Merged PRs (30d)
- 3
Description
## Request
Please consider a CPU resize or resample primitive for NumPy arrays with shape `(D, H, W, C)`. The operation should resize only the spatial axes, preserve the explicit channel axis, support `uint8` and `float32`, arbitrary channel counts, and unit-length output axes.
## Use case
Albucore performs CPU volume augmentation during model training. NumKong 7.7.0 exposes no public resize, interpolate, or resample operation, so Albucore compares pure NumPy, OpenCV packing, and Torch CPU paths instead.
## Performance context
For `64x64x80x9 -> 128x96x120x9`, `D*C=576` exceeds OpenCV's encoded channel limit. The current fallback is per-slice 2D OpenCV plus a depth pass. A NumKong separable 3D kernel could process the volume directly and avoid packing and Python slice-loop overhead.
## Useful initial scope
Half-pixel linear interpolation on CPU with float32 accumulation would cover the immediate use case. A documented uint8 final rounding rule would allow image volumes. Nearest interpolation, batch layouts, antialiasing, and GPU execution can be separate decisions.
Contributor guide
Research direction
Start from the requested DHWC shape, half-pixel linear interpolation, float32 accumulation, uint8 support, and unit-length output axes. Review NumKong's existing public CPU primitives and test structure before deciding the API and kernel boundaries; done means direct 3D resampling meets these requirements without packing or Python slice loops.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, numpy, python
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100