staysift 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.
staysift-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sivakumar
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.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: staysift
3
+ Version: 0.1.0
4
+ Summary: GPU-resident SIFT with zero-copy DLPack handoff -- pure Python, OpenCV-accurate, faster end-to-end
5
+ Author-email: Sivakumar <ce22s018@smail.iitm.ac.in>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/SivaIITM/PySIFT
8
+ Project-URL: Repository, https://github.com/SivaIITM/PySIFT
9
+ Keywords: sift,gpu,cuda,feature-extraction,image-stitching,computer-vision
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy
23
+ Requires-Dist: opencv-python>=4.5
24
+ Requires-Dist: torch>=2.0
25
+ Requires-Dist: numba>=0.57
26
+ Provides-Extra: cuda11
27
+ Requires-Dist: cupy-cuda11x; extra == "cuda11"
28
+ Provides-Extra: cuda12
29
+ Requires-Dist: cupy-cuda12x; extra == "cuda12"
30
+ Provides-Extra: learned
31
+ Requires-Dist: kornia>=0.7; extra == "learned"
32
+ Provides-Extra: lightglue
33
+ Requires-Dist: kornia>=0.7; extra == "lightglue"
34
+ Provides-Extra: depth
35
+ Requires-Dist: timm>=0.9; extra == "depth"
36
+ Provides-Extra: config
37
+ Requires-Dist: pyyaml; extra == "config"
38
+ Provides-Extra: all
39
+ Requires-Dist: kornia>=0.7; extra == "all"
40
+ Requires-Dist: timm>=0.9; extra == "all"
41
+ Requires-Dist: pyyaml; extra == "all"
42
+ Dynamic: license-file
43
+
44
+ # PySIFT
45
+
46
+ **GPU-Resident Deterministic SIFT for Deep Learning Vision Pipelines**
47
+
48
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
49
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
50
+ [![CUDA](https://img.shields.io/badge/CUDA-11.x%20%7C%2012.x-76B900.svg)](https://developer.nvidia.com/cuda-toolkit)
51
+
52
+ A pure-Python, GPU-resident SIFT implementation that matches OpenCV SIFT accuracy while running **26% faster end-to-end** with **4x matching speedup**. Zero-copy DLPack interop keeps tensors on the GPU across the full pipeline -- no PCIe round-trips.
53
+
54
+ ## Architecture
55
+
56
+ <p align="center">
57
+ <img src="docs/images/fig_architecture.png" alt="PySIFT Architecture" width="800"/>
58
+ </p>
59
+
60
+ ## Key Features
61
+
62
+ - **GPU-resident pipeline** -- Detection, description, matching, RANSAC, and blending all execute on the GPU via CuPy + Numba CUDA kernels
63
+ - **Zero-copy DLPack handoff** -- CuPy arrays pass to PyTorch tensors without memory copies, enabling seamless integration with deep learning pipelines
64
+ - **OpenCV-accurate** -- Numerically equivalent to OpenCV SIFT (Lowe 2004), verified across HPatches, Oxford 5K, IMC Phototourism, and MegaDepth-1500
65
+ - **Modular descriptor/matcher backends** -- Swap in HardNet, HyNet (learned descriptors) or LightGlue (learned matching) with a single config flag
66
+ - **Deterministic** -- Bitwise reproducible results via warp-shuffle reductions (no atomicAdd non-determinism)
67
+
68
+ ## Qualitative Results
69
+
70
+ <p align="center">
71
+ <img src="docs/images/fig_qualitative.png" alt="Stitching Results" width="800"/>
72
+ </p>
73
+
74
+ ## Installation
75
+
76
+ ### Prerequisites: CUDA dependencies
77
+
78
+ PySIFT requires an NVIDIA GPU with CUDA. Two dependencies must be installed manually because they are CUDA-version-specific:
79
+
80
+ ```bash
81
+ # Check your CUDA version
82
+ nvcc --version
83
+
84
+ # 1. Install CuPy (pick ONE matching your CUDA version)
85
+ pip install cupy-cuda12x # CUDA 12.x
86
+ pip install cupy-cuda11x # CUDA 11.x
87
+
88
+ # 2. Install PyTorch with CUDA (default pip installs CPU-only!)
89
+ pip install torch --index-url https://download.pytorch.org/whl/cu124 # CUDA 12.4
90
+ pip install torch --index-url https://download.pytorch.org/whl/cu121 # CUDA 12.1
91
+ pip install torch --index-url https://download.pytorch.org/whl/cu118 # CUDA 11.8
92
+ ```
93
+
94
+ > **Important:** Both CuPy and PyTorch-CUDA are required runtime dependencies but cannot be auto-installed by pip because the correct package varies by CUDA version. Install them before installing PySIFT.
95
+
96
+ ### Install PySIFT
97
+
98
+ ```bash
99
+ # From GitHub
100
+ pip install git+https://github.com/SivaIITM/PySIFT.git
101
+
102
+ # Or from source
103
+ git clone https://github.com/SivaIITM/PySIFT.git
104
+ cd PySIFT
105
+ pip install -e .
106
+ ```
107
+
108
+ ### Full install (all dependencies at once)
109
+
110
+ ```bash
111
+ pip install cupy-cuda12x # or cupy-cuda11x
112
+ pip install -r requirements.txt
113
+ pip install git+https://github.com/SivaIITM/PySIFT.git
114
+ ```
115
+
116
+ ### Recommended: depth-aware stitching
117
+
118
+ PySIFT uses MiDaS monocular depth estimation to split inliers into depth bands, giving each band its own homography. This significantly improves stitching quality for scenes with foreground/background parallax. Without `timm`, stitching falls back to a single global homography.
119
+
120
+ ```bash
121
+ pip install timm>=0.9
122
+ ```
123
+
124
+ ### Optional dependencies
125
+
126
+ ```bash
127
+ # Learned descriptors (HardNet, HyNet, OriNet)
128
+ pip install kornia
129
+
130
+ # YAML config file support
131
+ pip install pyyaml
132
+
133
+ # Or install all optional deps at once
134
+ pip install -e ".[all]"
135
+ ```
136
+
137
+ ## Quick Start
138
+
139
+ ### Python API
140
+
141
+ ```python
142
+ from pysift import PySIFT, GPUPyStitch
143
+
144
+ # Feature extraction
145
+ sift = PySIFT()
146
+ keypoints, descriptors = sift.detectAndCompute(gray_image)
147
+
148
+ # Panoramic stitching (2 or 3 images)
149
+ stitcher = GPUPyStitch()
150
+ panorama = stitcher.stitch(img_left, img_right)
151
+ ```
152
+
153
+ ### CLI
154
+
155
+ ```bash
156
+ # Basic stitching
157
+ pysift-stitch left.jpg right.jpg
158
+
159
+ # 3-image panorama with output directory
160
+ pysift-stitch left.jpg center.jpg right.jpg -o results/
161
+
162
+ # With config file
163
+ pysift-stitch left.jpg right.jpg --config config.yaml
164
+
165
+ # Learned pipeline
166
+ pysift-stitch left.jpg right.jpg --descriptor hardnet --matcher lightglue
167
+ ```
168
+
169
+ ## Configuration Presets
170
+
171
+ | Preset | Orientation | Descriptor | Matcher | Use Case |
172
+ |--------|-------------|------------|---------|----------|
173
+ | **Classic** | histogram | sift | ratio | Fastest. Full Lowe 2004 pipeline |
174
+ | **Modern** | histogram | sift | lightglue | Best accuracy with proven detection |
175
+ | **Learned** | orinet | hardnet | lightglue | Fully modern pipeline |
176
+ | **Mobile** | histogram | sift | ratio | Large phone images (auto-resize + denoise) |
177
+
178
+ See [`config.yaml`](config.yaml) for all parameters and presets.
179
+
180
+ ## Requirements
181
+
182
+ ### Hardware
183
+ - NVIDIA GPU with CUDA support (tested on RTX 3050 4GB and above)
184
+ - CUDA Toolkit 11.x or 12.x
185
+
186
+ ### Software
187
+
188
+ | Package | Version | Purpose |
189
+ |---------|---------|---------|
190
+ | Python | >= 3.9 | Runtime |
191
+ | PyTorch | >= 2.0 | Tensor ops, SVD, CUDA graphs |
192
+ | CuPy | >= 12.0 | GPU arrays, CUDA kernels |
193
+ | Numba | >= 0.57 | JIT-compiled CUDA kernels |
194
+ | NumPy | >= 1.22 | CPU array operations |
195
+ | OpenCV | >= 4.5 | Image I/O, CLAHE |
196
+ | kornia | >= 0.7 | *Optional:* HardNet, HyNet, OriNet |
197
+ | timm | >= 0.9 | *Optional:* MiDaS depth estimation |
198
+ | PyYAML | any | *Optional:* config file support |
199
+
200
+ ## Citation
201
+
202
+ ```bibtex
203
+ @article{sivakumar2026pysift,
204
+ title = {PySIFT: GPU-Resident Deterministic SIFT for Deep Learning Vision Pipelines},
205
+ author = {Sivakumar, K.S.},
206
+ journal = {arXiv preprint},
207
+ year = {2026}
208
+ }
209
+ ```
210
+
211
+ ## License
212
+
213
+ This project is licensed under the MIT License -- see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,170 @@
1
+ # PySIFT
2
+
3
+ **GPU-Resident Deterministic SIFT for Deep Learning Vision Pipelines**
4
+
5
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
+ [![CUDA](https://img.shields.io/badge/CUDA-11.x%20%7C%2012.x-76B900.svg)](https://developer.nvidia.com/cuda-toolkit)
8
+
9
+ A pure-Python, GPU-resident SIFT implementation that matches OpenCV SIFT accuracy while running **26% faster end-to-end** with **4x matching speedup**. Zero-copy DLPack interop keeps tensors on the GPU across the full pipeline -- no PCIe round-trips.
10
+
11
+ ## Architecture
12
+
13
+ <p align="center">
14
+ <img src="docs/images/fig_architecture.png" alt="PySIFT Architecture" width="800"/>
15
+ </p>
16
+
17
+ ## Key Features
18
+
19
+ - **GPU-resident pipeline** -- Detection, description, matching, RANSAC, and blending all execute on the GPU via CuPy + Numba CUDA kernels
20
+ - **Zero-copy DLPack handoff** -- CuPy arrays pass to PyTorch tensors without memory copies, enabling seamless integration with deep learning pipelines
21
+ - **OpenCV-accurate** -- Numerically equivalent to OpenCV SIFT (Lowe 2004), verified across HPatches, Oxford 5K, IMC Phototourism, and MegaDepth-1500
22
+ - **Modular descriptor/matcher backends** -- Swap in HardNet, HyNet (learned descriptors) or LightGlue (learned matching) with a single config flag
23
+ - **Deterministic** -- Bitwise reproducible results via warp-shuffle reductions (no atomicAdd non-determinism)
24
+
25
+ ## Qualitative Results
26
+
27
+ <p align="center">
28
+ <img src="docs/images/fig_qualitative.png" alt="Stitching Results" width="800"/>
29
+ </p>
30
+
31
+ ## Installation
32
+
33
+ ### Prerequisites: CUDA dependencies
34
+
35
+ PySIFT requires an NVIDIA GPU with CUDA. Two dependencies must be installed manually because they are CUDA-version-specific:
36
+
37
+ ```bash
38
+ # Check your CUDA version
39
+ nvcc --version
40
+
41
+ # 1. Install CuPy (pick ONE matching your CUDA version)
42
+ pip install cupy-cuda12x # CUDA 12.x
43
+ pip install cupy-cuda11x # CUDA 11.x
44
+
45
+ # 2. Install PyTorch with CUDA (default pip installs CPU-only!)
46
+ pip install torch --index-url https://download.pytorch.org/whl/cu124 # CUDA 12.4
47
+ pip install torch --index-url https://download.pytorch.org/whl/cu121 # CUDA 12.1
48
+ pip install torch --index-url https://download.pytorch.org/whl/cu118 # CUDA 11.8
49
+ ```
50
+
51
+ > **Important:** Both CuPy and PyTorch-CUDA are required runtime dependencies but cannot be auto-installed by pip because the correct package varies by CUDA version. Install them before installing PySIFT.
52
+
53
+ ### Install PySIFT
54
+
55
+ ```bash
56
+ # From GitHub
57
+ pip install git+https://github.com/SivaIITM/PySIFT.git
58
+
59
+ # Or from source
60
+ git clone https://github.com/SivaIITM/PySIFT.git
61
+ cd PySIFT
62
+ pip install -e .
63
+ ```
64
+
65
+ ### Full install (all dependencies at once)
66
+
67
+ ```bash
68
+ pip install cupy-cuda12x # or cupy-cuda11x
69
+ pip install -r requirements.txt
70
+ pip install git+https://github.com/SivaIITM/PySIFT.git
71
+ ```
72
+
73
+ ### Recommended: depth-aware stitching
74
+
75
+ PySIFT uses MiDaS monocular depth estimation to split inliers into depth bands, giving each band its own homography. This significantly improves stitching quality for scenes with foreground/background parallax. Without `timm`, stitching falls back to a single global homography.
76
+
77
+ ```bash
78
+ pip install timm>=0.9
79
+ ```
80
+
81
+ ### Optional dependencies
82
+
83
+ ```bash
84
+ # Learned descriptors (HardNet, HyNet, OriNet)
85
+ pip install kornia
86
+
87
+ # YAML config file support
88
+ pip install pyyaml
89
+
90
+ # Or install all optional deps at once
91
+ pip install -e ".[all]"
92
+ ```
93
+
94
+ ## Quick Start
95
+
96
+ ### Python API
97
+
98
+ ```python
99
+ from pysift import PySIFT, GPUPyStitch
100
+
101
+ # Feature extraction
102
+ sift = PySIFT()
103
+ keypoints, descriptors = sift.detectAndCompute(gray_image)
104
+
105
+ # Panoramic stitching (2 or 3 images)
106
+ stitcher = GPUPyStitch()
107
+ panorama = stitcher.stitch(img_left, img_right)
108
+ ```
109
+
110
+ ### CLI
111
+
112
+ ```bash
113
+ # Basic stitching
114
+ pysift-stitch left.jpg right.jpg
115
+
116
+ # 3-image panorama with output directory
117
+ pysift-stitch left.jpg center.jpg right.jpg -o results/
118
+
119
+ # With config file
120
+ pysift-stitch left.jpg right.jpg --config config.yaml
121
+
122
+ # Learned pipeline
123
+ pysift-stitch left.jpg right.jpg --descriptor hardnet --matcher lightglue
124
+ ```
125
+
126
+ ## Configuration Presets
127
+
128
+ | Preset | Orientation | Descriptor | Matcher | Use Case |
129
+ |--------|-------------|------------|---------|----------|
130
+ | **Classic** | histogram | sift | ratio | Fastest. Full Lowe 2004 pipeline |
131
+ | **Modern** | histogram | sift | lightglue | Best accuracy with proven detection |
132
+ | **Learned** | orinet | hardnet | lightglue | Fully modern pipeline |
133
+ | **Mobile** | histogram | sift | ratio | Large phone images (auto-resize + denoise) |
134
+
135
+ See [`config.yaml`](config.yaml) for all parameters and presets.
136
+
137
+ ## Requirements
138
+
139
+ ### Hardware
140
+ - NVIDIA GPU with CUDA support (tested on RTX 3050 4GB and above)
141
+ - CUDA Toolkit 11.x or 12.x
142
+
143
+ ### Software
144
+
145
+ | Package | Version | Purpose |
146
+ |---------|---------|---------|
147
+ | Python | >= 3.9 | Runtime |
148
+ | PyTorch | >= 2.0 | Tensor ops, SVD, CUDA graphs |
149
+ | CuPy | >= 12.0 | GPU arrays, CUDA kernels |
150
+ | Numba | >= 0.57 | JIT-compiled CUDA kernels |
151
+ | NumPy | >= 1.22 | CPU array operations |
152
+ | OpenCV | >= 4.5 | Image I/O, CLAHE |
153
+ | kornia | >= 0.7 | *Optional:* HardNet, HyNet, OriNet |
154
+ | timm | >= 0.9 | *Optional:* MiDaS depth estimation |
155
+ | PyYAML | any | *Optional:* config file support |
156
+
157
+ ## Citation
158
+
159
+ ```bibtex
160
+ @article{sivakumar2026pysift,
161
+ title = {PySIFT: GPU-Resident Deterministic SIFT for Deep Learning Vision Pipelines},
162
+ author = {Sivakumar, K.S.},
163
+ journal = {arXiv preprint},
164
+ year = {2026}
165
+ }
166
+ ```
167
+
168
+ ## License
169
+
170
+ This project is licensed under the MIT License -- see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "staysift"
7
+ version = "0.1.0"
8
+ description = "GPU-resident SIFT with zero-copy DLPack handoff -- pure Python, OpenCV-accurate, faster end-to-end"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ { name = "Sivakumar", email = "ce22s018@smail.iitm.ac.in" },
14
+ ]
15
+ keywords = ["sift", "gpu", "cuda", "feature-extraction", "image-stitching", "computer-vision"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Science/Research",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Scientific/Engineering :: Image Processing",
25
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
26
+ ]
27
+
28
+ dependencies = [
29
+ "numpy",
30
+ "opencv-python>=4.5",
31
+ "torch>=2.0",
32
+ "numba>=0.57",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ cuda11 = ["cupy-cuda11x"]
37
+ cuda12 = ["cupy-cuda12x"]
38
+ learned = ["kornia>=0.7"]
39
+ lightglue = ["kornia>=0.7"]
40
+ depth = ["timm>=0.9"]
41
+ config = ["pyyaml"]
42
+ all = ["kornia>=0.7", "timm>=0.9", "pyyaml"]
43
+
44
+ [project.scripts]
45
+ pysift-stitch = "pysift.core:main"
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/SivaIITM/PySIFT"
49
+ Repository = "https://github.com/SivaIITM/PySIFT"
50
+
51
+ [tool.setuptools.packages.find]
52
+ include = ["pysift*"]
@@ -0,0 +1,7 @@
1
+ """PySIFT -- GPU-resident SIFT with zero-copy DLPack handoff."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from .core import PySIFT, GPUPyStitch, DepthEstimator, SmartLauncher
6
+
7
+ __all__ = ["PySIFT", "GPUPyStitch", "DepthEstimator", "SmartLauncher"]