upal 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.
- upal-0.1.0/LICENSE +201 -0
- upal-0.1.0/PKG-INFO +184 -0
- upal-0.1.0/README.md +157 -0
- upal-0.1.0/pyproject.toml +48 -0
- upal-0.1.0/setup.cfg +4 -0
- upal-0.1.0/tests/test_api.py +119 -0
- upal-0.1.0/tests/test_release.py +34 -0
- upal-0.1.0/upal/__init__.py +15 -0
- upal-0.1.0/upal/demo_utils.py +50 -0
- upal-0.1.0/upal/model.py +544 -0
- upal-0.1.0/upal/postprocess.py +218 -0
- upal-0.1.0/upal.egg-info/PKG-INFO +184 -0
- upal-0.1.0/upal.egg-info/SOURCES.txt +14 -0
- upal-0.1.0/upal.egg-info/dependency_links.txt +1 -0
- upal-0.1.0/upal.egg-info/requires.txt +10 -0
- upal-0.1.0/upal.egg-info/top_level.txt +1 -0
upal-0.1.0/LICENSE
ADDED
|
@@ -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.
|
upal-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: upal
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: UPAL: unified and efficient point-line local features (ECCV 2026) — inference package
|
|
5
|
+
Author: François Costa, Raphael Kreft
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/francois141/upal
|
|
8
|
+
Project-URL: Paper, https://arxiv.org/abs/2608.19894
|
|
9
|
+
Project-URL: Hugging Face, https://huggingface.co/rkreft/upal
|
|
10
|
+
Keywords: keypoints,line-segments,local-features,image-matching,pytorch
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy>=1.24
|
|
18
|
+
Requires-Dist: opencv-python>=4.8
|
|
19
|
+
Requires-Dist: points-lsd<0.2,>=0.1.0
|
|
20
|
+
Requires-Dist: torch>=2.0
|
|
21
|
+
Requires-Dist: torchvision>=0.15
|
|
22
|
+
Requires-Dist: huggingface_hub>=0.30
|
|
23
|
+
Requires-Dist: safetensors>=0.4
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<div align="center">
|
|
29
|
+
<h1>UPAL: Unified and Efficient Point-Line Local Features - ECCV 2026</h1>
|
|
30
|
+
<p>
|
|
31
|
+
François Costa * · Raphael Kreft * · Eckhard Goedeke · Felix Möller · Hardik Shah · Ramanathan Rajaraman · Shaohui Liu · Rémi Pautrat · Marc Pollefeys
|
|
32
|
+
</p>
|
|
33
|
+
<p><small>* denotes equal contribution</small></p>
|
|
34
|
+
|
|
35
|
+
<h2><a href="https://arxiv.org/pdf/2608.19894">Paper</a></h2>
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="https://raw.githubusercontent.com/francois141/upal/main/assets/boat_demo.png" alt="UPAL inference on the boat pair" width="80%" />
|
|
38
|
+
<br />
|
|
39
|
+
<em>Red dots are learned keypoints, green segments are line detections supported by the learned distance field, and colored links are mutual-nearest descriptor matches.</em>
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
## Upal
|
|
44
|
+
|
|
45
|
+
Standalone PyTorch inference for **UPAL**, an ECCV 2026–accepted joint point-line detector. The repository contains the network architecture, trained weights, and runnable inference, point-matching, and line-matching examples on the classic `boat1` / `boat2` images. For every input image, UPAL predicts:
|
|
46
|
+
|
|
47
|
+
- sub-pixel keypoints and their confidence scores;
|
|
48
|
+
- 128-dimensional, L2-normalized local descriptors;
|
|
49
|
+
- a dense keypoint/junction heatmap;
|
|
50
|
+
- a dense line distance field.
|
|
51
|
+
|
|
52
|
+
The inference network uses an ALIKED-style multi-scale encoder, deformable convolutions in its deeper stages, a sparse deformable descriptor head, a point/junction scoring head, and a line-distance-field decoder. The demo uses the `points-lsd` detector (source bundled as a submodule), seeded from UPAL's learned keypoints, and filters its proposals with the learned distance field.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
Python 3.10 or newer.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install upal # network + point-seeded line detector
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
[`points-lsd`](https://pypi.org/project/points-lsd/) is the point-seeded line segment detector used
|
|
63
|
+
for line extraction and is installed automatically. Wheels exist for Linux, macOS and Windows
|
|
64
|
+
(CPython 3.10-3.14). On platforms without a compatible wheel, such as musl-based distributions,
|
|
65
|
+
install the pinned submodule from source as shown below.
|
|
66
|
+
The separately distributed detector includes an AGPL-3.0-or-later LSD core; see its PyPI
|
|
67
|
+
page for the complete license declaration.
|
|
68
|
+
|
|
69
|
+
To develop against this repository instead:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
73
|
+
python3 -m pip install -e .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
To build the detector from the bundled submodule instead:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git submodule update --init --recursive
|
|
80
|
+
python3 -m pip install ./third_party/points_lsd
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
For CUDA, install the matching PyTorch build from [pytorch.org](https://pytorch.org/get-started/locally/) first.
|
|
84
|
+
|
|
85
|
+
## Quick start
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import torch
|
|
89
|
+
from upal import UPAL, load_model, mutual_nearest_neighbors, match_lines_from_endpoints
|
|
90
|
+
from upal.demo_utils import load_image # reads a file into an RGB uint8 array and a 1 x 3 x H x W tensor
|
|
91
|
+
|
|
92
|
+
model = UPAL.from_pretrained("rkreft/upal") # weights from the Hugging Face Hub
|
|
93
|
+
# model = load_model("weights/upal.tar") # or the checkpoint in this repository
|
|
94
|
+
|
|
95
|
+
_, image0 = load_image("assets/boat1.png", max_size=640) # paths relative to this repository
|
|
96
|
+
_, image1 = load_image("assets/boat2.png", max_size=640)
|
|
97
|
+
feats0, feats1 = model.extract(image0), model.extract(image1)
|
|
98
|
+
|
|
99
|
+
feats0["keypoints"] # N x 2 pixel (x, y)
|
|
100
|
+
feats0["descriptors"] # N x 128, L2-normalised
|
|
101
|
+
feats0["keypoint_scores"] # N
|
|
102
|
+
feats0["keypoint_dispersity"] # N, spread of the score peak (lower = sharper)
|
|
103
|
+
feats0["keypoint_heatmap"] # H x W
|
|
104
|
+
feats0["line_distance_field"] # H x W, pixels
|
|
105
|
+
feats0["lines"] # L x 2 x 2 endpoints
|
|
106
|
+
|
|
107
|
+
point_matches = mutual_nearest_neighbors(feats0["descriptors"], feats1["descriptors"])
|
|
108
|
+
desc0, desc1 = model.describe_lines(image0, feats0["lines"]), model.describe_lines(image1, feats1["lines"])
|
|
109
|
+
line_matches, scores = match_lines_from_endpoints(desc0, desc1) # NumPy: K x 2 indices, K scores
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`extract(image, lines=True, max_lines=200, min_line_length=25.0, max_line_distance=2.0)` accepts a
|
|
113
|
+
`C x H x W` (or `1 x C x H x W`) tensor in `[0, 1]`, RGB or grayscale. Padding to a multiple of 32 is
|
|
114
|
+
handled internally and removed from every output. The keypoint budget is a model argument:
|
|
115
|
+
`UPAL.from_pretrained("rkreft/upal", max_num_keypoints=2048)` or `load_model(..., max_num_keypoints=2048)`.
|
|
116
|
+
Calling the model directly (`model(batch)`) runs the network only on a `B x C x H x W` batch and returns
|
|
117
|
+
batched tensors; see `upal/model.py`.
|
|
118
|
+
|
|
119
|
+
## Run the demos
|
|
120
|
+
|
|
121
|
+
From the repository root, run inference on one image and save its feature overlay:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python demo_inference.py
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Match learned point descriptors across an image pair:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python demo_match_points.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Match field-supported line segments across the same pair:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
python demo_match_lines.py
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The scripts write `outputs/inference.png`, `outputs/point_matches.png`, and `outputs/line_matches.png`, respectively. CPU inference is supported; CUDA is selected automatically when available. The line matcher extracts descriptors at the two endpoints of each detected segment, scores both endpoint orientations, and solves a one-to-one line assignment.
|
|
140
|
+
|
|
141
|
+
Useful options:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python demo_match_points.py \
|
|
145
|
+
--image0 path/to/first.jpg \
|
|
146
|
+
--image1 path/to/second.jpg \
|
|
147
|
+
--device cuda \
|
|
148
|
+
--max-size 800 \
|
|
149
|
+
--max-keypoints 1500 \
|
|
150
|
+
--output outputs/my_pair.png
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Hugging Face Hub
|
|
154
|
+
|
|
155
|
+
The release workflow publishes the weights as [`rkreft/upal`](https://huggingface.co/rkreft/upal)
|
|
156
|
+
(`model.safetensors` + `config.json`, loaded through `PyTorchModelHubMixin`). To generate
|
|
157
|
+
the Hub folder from `weights/upal.tar` and verify it reproduces the checkpoint:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python scripts/push_to_hub.py # writes outputs/hub/upal and checks the round trip
|
|
161
|
+
python scripts/push_to_hub.py --push --private # upload while the Hub repository is private
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Uploads verify the repository visibility before writing. The production release workflow
|
|
165
|
+
expects `rkreft/upal` to be public, so make the Hub repository public before pushing the
|
|
166
|
+
release tag.
|
|
167
|
+
|
|
168
|
+
## BibTeX
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
@misc{costa2026unifiedefficientpointlinelocal,
|
|
172
|
+
title={Unified and Efficient Point-Line Local Features},
|
|
173
|
+
author={François Costa and Raphael Kreft and Eckhard Goedeke and Felix Möller and Hardik Shah and Ramanathan Rajaraman and Shaohui Liu and Rémi Pautrat and Marc Pollefeys},
|
|
174
|
+
year={2026},
|
|
175
|
+
eprint={2608.19894},
|
|
176
|
+
archivePrefix={arXiv},
|
|
177
|
+
primaryClass={cs.CV},
|
|
178
|
+
url={https://arxiv.org/abs/2608.19894},
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Acknowledgments
|
|
183
|
+
|
|
184
|
+
Parts of this codebase reuse code from [ALIKED](https://github.com/Shiaoming/ALIKED) and [glue-factory](https://github.com/cvg/glue-factory); we thank their authors for making it available. We also thank the authors of [SuperPoint](https://github.com/magicleap/SuperPointPretrainedNetwork), [ALIKED](https://github.com/Shiaoming/ALIKED), [DaD](https://github.com/daniela-b/DaD), and [DeepLSD](https://github.com/cvg/DeepLSD) for releasing their pre-trained models, which we use as teachers.
|
upal-0.1.0/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>UPAL: Unified and Efficient Point-Line Local Features - ECCV 2026</h1>
|
|
3
|
+
<p>
|
|
4
|
+
François Costa * · Raphael Kreft * · Eckhard Goedeke · Felix Möller · Hardik Shah · Ramanathan Rajaraman · Shaohui Liu · Rémi Pautrat · Marc Pollefeys
|
|
5
|
+
</p>
|
|
6
|
+
<p><small>* denotes equal contribution</small></p>
|
|
7
|
+
|
|
8
|
+
<h2><a href="https://arxiv.org/pdf/2608.19894">Paper</a></h2>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="https://raw.githubusercontent.com/francois141/upal/main/assets/boat_demo.png" alt="UPAL inference on the boat pair" width="80%" />
|
|
11
|
+
<br />
|
|
12
|
+
<em>Red dots are learned keypoints, green segments are line detections supported by the learned distance field, and colored links are mutual-nearest descriptor matches.</em>
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## Upal
|
|
17
|
+
|
|
18
|
+
Standalone PyTorch inference for **UPAL**, an ECCV 2026–accepted joint point-line detector. The repository contains the network architecture, trained weights, and runnable inference, point-matching, and line-matching examples on the classic `boat1` / `boat2` images. For every input image, UPAL predicts:
|
|
19
|
+
|
|
20
|
+
- sub-pixel keypoints and their confidence scores;
|
|
21
|
+
- 128-dimensional, L2-normalized local descriptors;
|
|
22
|
+
- a dense keypoint/junction heatmap;
|
|
23
|
+
- a dense line distance field.
|
|
24
|
+
|
|
25
|
+
The inference network uses an ALIKED-style multi-scale encoder, deformable convolutions in its deeper stages, a sparse deformable descriptor head, a point/junction scoring head, and a line-distance-field decoder. The demo uses the `points-lsd` detector (source bundled as a submodule), seeded from UPAL's learned keypoints, and filters its proposals with the learned distance field.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Python 3.10 or newer.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install upal # network + point-seeded line detector
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
[`points-lsd`](https://pypi.org/project/points-lsd/) is the point-seeded line segment detector used
|
|
36
|
+
for line extraction and is installed automatically. Wheels exist for Linux, macOS and Windows
|
|
37
|
+
(CPython 3.10-3.14). On platforms without a compatible wheel, such as musl-based distributions,
|
|
38
|
+
install the pinned submodule from source as shown below.
|
|
39
|
+
The separately distributed detector includes an AGPL-3.0-or-later LSD core; see its PyPI
|
|
40
|
+
page for the complete license declaration.
|
|
41
|
+
|
|
42
|
+
To develop against this repository instead:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
46
|
+
python3 -m pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
To build the detector from the bundled submodule instead:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git submodule update --init --recursive
|
|
53
|
+
python3 -m pip install ./third_party/points_lsd
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For CUDA, install the matching PyTorch build from [pytorch.org](https://pytorch.org/get-started/locally/) first.
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import torch
|
|
62
|
+
from upal import UPAL, load_model, mutual_nearest_neighbors, match_lines_from_endpoints
|
|
63
|
+
from upal.demo_utils import load_image # reads a file into an RGB uint8 array and a 1 x 3 x H x W tensor
|
|
64
|
+
|
|
65
|
+
model = UPAL.from_pretrained("rkreft/upal") # weights from the Hugging Face Hub
|
|
66
|
+
# model = load_model("weights/upal.tar") # or the checkpoint in this repository
|
|
67
|
+
|
|
68
|
+
_, image0 = load_image("assets/boat1.png", max_size=640) # paths relative to this repository
|
|
69
|
+
_, image1 = load_image("assets/boat2.png", max_size=640)
|
|
70
|
+
feats0, feats1 = model.extract(image0), model.extract(image1)
|
|
71
|
+
|
|
72
|
+
feats0["keypoints"] # N x 2 pixel (x, y)
|
|
73
|
+
feats0["descriptors"] # N x 128, L2-normalised
|
|
74
|
+
feats0["keypoint_scores"] # N
|
|
75
|
+
feats0["keypoint_dispersity"] # N, spread of the score peak (lower = sharper)
|
|
76
|
+
feats0["keypoint_heatmap"] # H x W
|
|
77
|
+
feats0["line_distance_field"] # H x W, pixels
|
|
78
|
+
feats0["lines"] # L x 2 x 2 endpoints
|
|
79
|
+
|
|
80
|
+
point_matches = mutual_nearest_neighbors(feats0["descriptors"], feats1["descriptors"])
|
|
81
|
+
desc0, desc1 = model.describe_lines(image0, feats0["lines"]), model.describe_lines(image1, feats1["lines"])
|
|
82
|
+
line_matches, scores = match_lines_from_endpoints(desc0, desc1) # NumPy: K x 2 indices, K scores
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`extract(image, lines=True, max_lines=200, min_line_length=25.0, max_line_distance=2.0)` accepts a
|
|
86
|
+
`C x H x W` (or `1 x C x H x W`) tensor in `[0, 1]`, RGB or grayscale. Padding to a multiple of 32 is
|
|
87
|
+
handled internally and removed from every output. The keypoint budget is a model argument:
|
|
88
|
+
`UPAL.from_pretrained("rkreft/upal", max_num_keypoints=2048)` or `load_model(..., max_num_keypoints=2048)`.
|
|
89
|
+
Calling the model directly (`model(batch)`) runs the network only on a `B x C x H x W` batch and returns
|
|
90
|
+
batched tensors; see `upal/model.py`.
|
|
91
|
+
|
|
92
|
+
## Run the demos
|
|
93
|
+
|
|
94
|
+
From the repository root, run inference on one image and save its feature overlay:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python demo_inference.py
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Match learned point descriptors across an image pair:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python demo_match_points.py
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Match field-supported line segments across the same pair:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python demo_match_lines.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The scripts write `outputs/inference.png`, `outputs/point_matches.png`, and `outputs/line_matches.png`, respectively. CPU inference is supported; CUDA is selected automatically when available. The line matcher extracts descriptors at the two endpoints of each detected segment, scores both endpoint orientations, and solves a one-to-one line assignment.
|
|
113
|
+
|
|
114
|
+
Useful options:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
python demo_match_points.py \
|
|
118
|
+
--image0 path/to/first.jpg \
|
|
119
|
+
--image1 path/to/second.jpg \
|
|
120
|
+
--device cuda \
|
|
121
|
+
--max-size 800 \
|
|
122
|
+
--max-keypoints 1500 \
|
|
123
|
+
--output outputs/my_pair.png
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Hugging Face Hub
|
|
127
|
+
|
|
128
|
+
The release workflow publishes the weights as [`rkreft/upal`](https://huggingface.co/rkreft/upal)
|
|
129
|
+
(`model.safetensors` + `config.json`, loaded through `PyTorchModelHubMixin`). To generate
|
|
130
|
+
the Hub folder from `weights/upal.tar` and verify it reproduces the checkpoint:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python scripts/push_to_hub.py # writes outputs/hub/upal and checks the round trip
|
|
134
|
+
python scripts/push_to_hub.py --push --private # upload while the Hub repository is private
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Uploads verify the repository visibility before writing. The production release workflow
|
|
138
|
+
expects `rkreft/upal` to be public, so make the Hub repository public before pushing the
|
|
139
|
+
release tag.
|
|
140
|
+
|
|
141
|
+
## BibTeX
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
@misc{costa2026unifiedefficientpointlinelocal,
|
|
145
|
+
title={Unified and Efficient Point-Line Local Features},
|
|
146
|
+
author={François Costa and Raphael Kreft and Eckhard Goedeke and Felix Möller and Hardik Shah and Ramanathan Rajaraman and Shaohui Liu and Rémi Pautrat and Marc Pollefeys},
|
|
147
|
+
year={2026},
|
|
148
|
+
eprint={2608.19894},
|
|
149
|
+
archivePrefix={arXiv},
|
|
150
|
+
primaryClass={cs.CV},
|
|
151
|
+
url={https://arxiv.org/abs/2608.19894},
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Acknowledgments
|
|
156
|
+
|
|
157
|
+
Parts of this codebase reuse code from [ALIKED](https://github.com/Shiaoming/ALIKED) and [glue-factory](https://github.com/cvg/glue-factory); we thank their authors for making it available. We also thank the authors of [SuperPoint](https://github.com/magicleap/SuperPointPretrainedNetwork), [ALIKED](https://github.com/Shiaoming/ALIKED), [DaD](https://github.com/daniela-b/DaD), and [DeepLSD](https://github.com/cvg/DeepLSD) for releasing their pre-trained models, which we use as teachers.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "upal"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "UPAL: unified and efficient point-line local features (ECCV 2026) — inference package"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "François Costa" },
|
|
15
|
+
{ name = "Raphael Kreft" },
|
|
16
|
+
]
|
|
17
|
+
keywords = ["keypoints", "line-segments", "local-features", "image-matching", "pytorch"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Image Recognition",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"numpy>=1.24",
|
|
25
|
+
"opencv-python>=4.8",
|
|
26
|
+
"points-lsd>=0.1.0,<0.2",
|
|
27
|
+
"torch>=2.0",
|
|
28
|
+
"torchvision>=0.15",
|
|
29
|
+
"huggingface_hub>=0.30", # paper_url mixin kwarg
|
|
30
|
+
"safetensors>=0.4",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
test = ["pytest>=8"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Repository = "https://github.com/francois141/upal"
|
|
38
|
+
Paper = "https://arxiv.org/abs/2608.19894"
|
|
39
|
+
"Hugging Face" = "https://huggingface.co/rkreft/upal"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.dynamic]
|
|
42
|
+
version = { attr = "upal.__version__" }
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
include = ["upal*"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
upal-0.1.0/setup.cfg
ADDED