just-keypoints 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.
- just_keypoints-0.1.0/.gitignore +8 -0
- just_keypoints-0.1.0/CMakeLists.txt +332 -0
- just_keypoints-0.1.0/LICENSE +202 -0
- just_keypoints-0.1.0/PKG-INFO +77 -0
- just_keypoints-0.1.0/PLAN.md +745 -0
- just_keypoints-0.1.0/README.md +204 -0
- just_keypoints-0.1.0/bindings/python/CMakeLists.txt +61 -0
- just_keypoints-0.1.0/bindings/python/README.md +52 -0
- just_keypoints-0.1.0/bindings/python/build_info.py.in +6 -0
- just_keypoints-0.1.0/bindings/python/just_keypoints/__init__.py +38 -0
- just_keypoints-0.1.0/bindings/python/just_keypoints/py.typed +0 -0
- just_keypoints-0.1.0/bindings/python/requirements.txt +3 -0
- just_keypoints-0.1.0/bindings/python/src/module.cpp +243 -0
- just_keypoints-0.1.0/bindings/python/tests/test_bindings.py +148 -0
- just_keypoints-0.1.0/cli/main.cpp +163 -0
- just_keypoints-0.1.0/cli/stb_image.h +7798 -0
- just_keypoints-0.1.0/cmake/embed.cmake +18 -0
- just_keypoints-0.1.0/cmake/embed_text.cmake +9 -0
- just_keypoints-0.1.0/include/jkp/jkp.h +102 -0
- just_keypoints-0.1.0/packaging/fetch_cuda.py +102 -0
- just_keypoints-0.1.0/packaging/variant.py +63 -0
- just_keypoints-0.1.0/packaging/version.py +98 -0
- just_keypoints-0.1.0/pyproject.toml +80 -0
- just_keypoints-0.1.0/src/backend/cpu/cpu_ops.cpp +596 -0
- just_keypoints-0.1.0/src/backend/cuda/cuda_ops.cu +1720 -0
- just_keypoints-0.1.0/src/backend/metal/kernels.metal +1035 -0
- just_keypoints-0.1.0/src/backend/metal/metal_ops.mm +935 -0
- just_keypoints-0.1.0/src/backend/webgpu/kernels.wgsl +1364 -0
- just_keypoints-0.1.0/src/backend/webgpu/webgpu_ops.cpp +1209 -0
- just_keypoints-0.1.0/src/core/api.cpp +154 -0
- just_keypoints-0.1.0/src/core/features.h +17 -0
- just_keypoints-0.1.0/src/core/half.h +50 -0
- just_keypoints-0.1.0/src/core/ops.cpp +18 -0
- just_keypoints-0.1.0/src/core/ops.h +127 -0
- just_keypoints-0.1.0/src/core/weights.cpp +152 -0
- just_keypoints-0.1.0/src/core/weights.h +52 -0
- just_keypoints-0.1.0/src/models/aliked/aliked.cpp +121 -0
- just_keypoints-0.1.0/src/models/aliked/aliked.h +53 -0
- just_keypoints-0.1.0/src/models/raco/raco.cpp +131 -0
- just_keypoints-0.1.0/src/models/raco/raco.h +54 -0
- just_keypoints-0.1.0/tests/backend_test.cpp +248 -0
- just_keypoints-0.1.0/tests/golden_test.cpp +77 -0
- just_keypoints-0.1.0/tests/ops_test.cpp +287 -0
- just_keypoints-0.1.0/tests/precision_test.cpp +135 -0
- just_keypoints-0.1.0/tests/raco_golden_test.cpp +120 -0
- just_keypoints-0.1.0/tests/test_backends.h +28 -0
- just_keypoints-0.1.0/tests/test_picture.h +42 -0
- just_keypoints-0.1.0/tests/webgpu_shared_test.cpp +116 -0
- just_keypoints-0.1.0/weights/LICENSE-ALIKED +29 -0
- just_keypoints-0.1.0/weights/LICENSE-RACO +201 -0
- just_keypoints-0.1.0/weights/aliked-n16.jkpw +0 -0
- just_keypoints-0.1.0/weights/raco.jkpw +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16...3.31)
|
|
2
|
+
project(just_keypoints VERSION 0.1.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
option(JKP_EMBED_WEIGHTS "Compile the model weights into the library" ON)
|
|
5
|
+
option(JKP_BUILD_CLI "Build the jkp command line tool" ON)
|
|
6
|
+
option(JKP_BUILD_TESTS "Build tests" ON)
|
|
7
|
+
option(JKP_BUILD_WASM "Emscripten: build the WebAssembly module, JS wrapper and test page (web/)" ON)
|
|
8
|
+
option(JKP_BUILD_PYTHON "Build the Python package just_keypoints (needs nanobind; bindings/python)" OFF)
|
|
9
|
+
set(JKP_CUDA "AUTO" CACHE STRING "CUDA backend: AUTO (build it when a CUDA compiler is found), ON or OFF")
|
|
10
|
+
set_property(CACHE JKP_CUDA PROPERTY STRINGS AUTO ON OFF)
|
|
11
|
+
set(JKP_METAL "AUTO" CACHE STRING "Metal backend (Apple platforms): AUTO (build it when Metal.framework is found), ON or OFF")
|
|
12
|
+
set_property(CACHE JKP_METAL PROPERTY STRINGS AUTO ON OFF)
|
|
13
|
+
set(JKP_WEBGPU "AUTO" CACHE STRING "WebGPU backend: AUTO (build it when Dawn, or under Emscripten emdawnwebgpu, is found), ON or OFF")
|
|
14
|
+
set_property(CACHE JKP_WEBGPU PROPERTY STRINGS AUTO ON OFF)
|
|
15
|
+
set(JKP_EMBED_MODELS "aliked-n16;raco" CACHE STRING "Models to embed when JKP_EMBED_WEIGHTS is ON (names in weights/)")
|
|
16
|
+
|
|
17
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
18
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
19
|
+
endif()
|
|
20
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
21
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
22
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
23
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
24
|
+
if(EMSCRIPTEN)
|
|
25
|
+
# Native wasm exceptions, as just-ba's module: the library reports errors with exceptions, and an app
|
|
26
|
+
# links all its libraries into one module with the same setting (PLAN.md, phase 5).
|
|
27
|
+
add_compile_options(-fwasm-exceptions)
|
|
28
|
+
add_link_options(-fwasm-exceptions)
|
|
29
|
+
endif()
|
|
30
|
+
|
|
31
|
+
# CUDA backend: needs only the CUDA toolkit (nvcc and its runtime library).
|
|
32
|
+
if(NOT JKP_CUDA STREQUAL "OFF")
|
|
33
|
+
if(NOT CMAKE_CUDA_COMPILER AND NOT DEFINED ENV{CUDACXX})
|
|
34
|
+
# Toolkit installed but not on PATH (common outside login shells).
|
|
35
|
+
find_program(JKP_NVCC nvcc HINTS ENV CUDA_PATH PATHS /opt/cuda /usr/local/cuda PATH_SUFFIXES bin)
|
|
36
|
+
if(JKP_NVCC)
|
|
37
|
+
set(CMAKE_CUDA_COMPILER "${JKP_NVCC}")
|
|
38
|
+
endif()
|
|
39
|
+
endif()
|
|
40
|
+
include(CheckLanguage)
|
|
41
|
+
check_language(CUDA)
|
|
42
|
+
if(CMAKE_CUDA_COMPILER)
|
|
43
|
+
enable_language(CUDA)
|
|
44
|
+
set(JKP_HAVE_CUDA ON)
|
|
45
|
+
elseif(JKP_CUDA STREQUAL "ON")
|
|
46
|
+
message(FATAL_ERROR "JKP_CUDA=ON but no CUDA compiler was found (set CUDACXX or CMAKE_CUDA_COMPILER)")
|
|
47
|
+
endif()
|
|
48
|
+
endif()
|
|
49
|
+
|
|
50
|
+
# Metal backend: needs only Metal.framework and Foundation. Shaders are compiled at run time, so no
|
|
51
|
+
# Metal toolchain is needed to build.
|
|
52
|
+
if(NOT JKP_METAL STREQUAL "OFF")
|
|
53
|
+
if(APPLE)
|
|
54
|
+
find_library(JKP_METAL_FRAMEWORK Metal)
|
|
55
|
+
find_library(JKP_FOUNDATION_FRAMEWORK Foundation)
|
|
56
|
+
endif()
|
|
57
|
+
if(JKP_METAL_FRAMEWORK AND JKP_FOUNDATION_FRAMEWORK)
|
|
58
|
+
enable_language(OBJCXX)
|
|
59
|
+
set(JKP_HAVE_METAL ON)
|
|
60
|
+
elseif(JKP_METAL STREQUAL "ON")
|
|
61
|
+
message(FATAL_ERROR "JKP_METAL=ON but Metal.framework was not found (Apple platforms only)")
|
|
62
|
+
endif()
|
|
63
|
+
endif()
|
|
64
|
+
|
|
65
|
+
# WebGPU backend: natively against Dawn's prebuilt release, under Emscripten against emdawnwebgpu from the
|
|
66
|
+
# same release (PLAN.md, phase 5). Neither is committed: unpack them under third_party/webgpu, or point
|
|
67
|
+
# JKP_DAWN_DIR / JKP_EMDAWNWEBGPU_DIR elsewhere. Kernels are WGSL, compiled at run time.
|
|
68
|
+
if(NOT JKP_WEBGPU STREQUAL "OFF")
|
|
69
|
+
if(EMSCRIPTEN)
|
|
70
|
+
set(JKP_EMDAWNWEBGPU_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/webgpu/emdawnwebgpu/emdawnwebgpu_pkg"
|
|
71
|
+
CACHE PATH "The unpacked emdawnwebgpu_pkg of a Dawn release")
|
|
72
|
+
if(EXISTS "${JKP_EMDAWNWEBGPU_DIR}/emdawnwebgpu.port.py")
|
|
73
|
+
set(JKP_HAVE_WEBGPU ON)
|
|
74
|
+
endif()
|
|
75
|
+
else()
|
|
76
|
+
file(GLOB jkp_dawn_default "${CMAKE_CURRENT_SOURCE_DIR}/third_party/webgpu/dawn/Dawn-*")
|
|
77
|
+
set(JKP_DAWN_DIR "${jkp_dawn_default}" CACHE PATH "The unpacked Dawn release (with lib/cmake/Dawn)")
|
|
78
|
+
# Dawn's Linux release installs into lib64/, macOS's into lib/.
|
|
79
|
+
find_package(Dawn CONFIG QUIET PATHS "${JKP_DAWN_DIR}/lib/cmake/Dawn" "${JKP_DAWN_DIR}/lib64/cmake/Dawn"
|
|
80
|
+
NO_DEFAULT_PATH)
|
|
81
|
+
if(Dawn_FOUND)
|
|
82
|
+
set(JKP_HAVE_WEBGPU ON)
|
|
83
|
+
endif()
|
|
84
|
+
endif()
|
|
85
|
+
if(NOT JKP_HAVE_WEBGPU AND JKP_WEBGPU STREQUAL "ON")
|
|
86
|
+
message(FATAL_ERROR "JKP_WEBGPU=ON but neither Dawn (JKP_DAWN_DIR) nor, under Emscripten, emdawnwebgpu "
|
|
87
|
+
"(JKP_EMDAWNWEBGPU_DIR) was found")
|
|
88
|
+
endif()
|
|
89
|
+
endif()
|
|
90
|
+
|
|
91
|
+
# Weights: either compiled in, or left out (then a path or memory blob must be given at run time).
|
|
92
|
+
set(embed_models "")
|
|
93
|
+
if(JKP_EMBED_WEIGHTS)
|
|
94
|
+
foreach(model IN LISTS JKP_EMBED_MODELS)
|
|
95
|
+
list(APPEND embed_models "${model}=${CMAKE_CURRENT_SOURCE_DIR}/weights/${model}.jkpw")
|
|
96
|
+
list(APPEND embed_deps "${CMAKE_CURRENT_SOURCE_DIR}/weights/${model}.jkpw")
|
|
97
|
+
endforeach()
|
|
98
|
+
endif()
|
|
99
|
+
set(embed_cpp "${CMAKE_CURRENT_BINARY_DIR}/embedded_weights.cpp")
|
|
100
|
+
string(REPLACE ";" "|" embed_models_arg "${embed_models}") # a list does not survive the command line
|
|
101
|
+
add_custom_command(
|
|
102
|
+
OUTPUT "${embed_cpp}"
|
|
103
|
+
COMMAND ${CMAKE_COMMAND} "-DOUT=${embed_cpp}" "-DMODELS=${embed_models_arg}" -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed.cmake"
|
|
104
|
+
DEPENDS ${embed_deps} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed.cmake"
|
|
105
|
+
VERBATIM)
|
|
106
|
+
|
|
107
|
+
add_library(jkp
|
|
108
|
+
src/core/api.cpp
|
|
109
|
+
src/core/ops.cpp
|
|
110
|
+
src/core/weights.cpp
|
|
111
|
+
src/models/aliked/aliked.cpp
|
|
112
|
+
src/models/raco/raco.cpp
|
|
113
|
+
src/backend/cpu/cpu_ops.cpp
|
|
114
|
+
"${embed_cpp}")
|
|
115
|
+
target_include_directories(jkp PUBLIC include PRIVATE src)
|
|
116
|
+
find_package(Threads REQUIRED)
|
|
117
|
+
target_link_libraries(jkp PRIVATE Threads::Threads)
|
|
118
|
+
if(NOT MSVC)
|
|
119
|
+
# -ffp-contract=off: keep float32 results independent of FMA availability (see PLAN.md, notes from M1).
|
|
120
|
+
target_compile_options(jkp PRIVATE $<$<COMPILE_LANGUAGE:CXX,OBJCXX>:-Wall;-Wextra;-ffp-contract=off>)
|
|
121
|
+
endif()
|
|
122
|
+
|
|
123
|
+
if(JKP_HAVE_CUDA)
|
|
124
|
+
target_sources(jkp PRIVATE src/backend/cuda/cuda_ops.cu)
|
|
125
|
+
target_compile_definitions(jkp PRIVATE JKP_HAVE_CUDA)
|
|
126
|
+
set_target_properties(jkp PROPERTIES CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON)
|
|
127
|
+
# --fmad=false: no fused multiply-add in kernels, so they compute what the CPU backend computes.
|
|
128
|
+
target_compile_options(jkp PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--fmad=false>)
|
|
129
|
+
endif()
|
|
130
|
+
|
|
131
|
+
if(JKP_HAVE_METAL)
|
|
132
|
+
set(metal_src "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/metal/kernels.metal")
|
|
133
|
+
set(metal_cpp "${CMAKE_CURRENT_BINARY_DIR}/metal_kernels.cpp")
|
|
134
|
+
add_custom_command(
|
|
135
|
+
OUTPUT "${metal_cpp}"
|
|
136
|
+
COMMAND ${CMAKE_COMMAND} "-DIN=${metal_src}" "-DOUT=${metal_cpp}" -DNAME=kJkpMetalSource
|
|
137
|
+
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed_text.cmake"
|
|
138
|
+
DEPENDS "${metal_src}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed_text.cmake"
|
|
139
|
+
VERBATIM)
|
|
140
|
+
target_sources(jkp PRIVATE src/backend/metal/metal_ops.mm "${metal_cpp}")
|
|
141
|
+
target_compile_definitions(jkp PRIVATE JKP_HAVE_METAL)
|
|
142
|
+
target_compile_options(jkp PRIVATE $<$<COMPILE_LANGUAGE:OBJCXX>:-fobjc-arc>)
|
|
143
|
+
target_link_libraries(jkp PRIVATE "${JKP_METAL_FRAMEWORK}" "${JKP_FOUNDATION_FRAMEWORK}")
|
|
144
|
+
endif()
|
|
145
|
+
|
|
146
|
+
if(JKP_HAVE_WEBGPU)
|
|
147
|
+
set(wgsl_src "${CMAKE_CURRENT_SOURCE_DIR}/src/backend/webgpu/kernels.wgsl")
|
|
148
|
+
set(wgsl_cpp "${CMAKE_CURRENT_BINARY_DIR}/webgpu_kernels.cpp")
|
|
149
|
+
add_custom_command(
|
|
150
|
+
OUTPUT "${wgsl_cpp}"
|
|
151
|
+
COMMAND ${CMAKE_COMMAND} "-DIN=${wgsl_src}" "-DOUT=${wgsl_cpp}" -DNAME=kJkpWgslSource
|
|
152
|
+
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed_text.cmake"
|
|
153
|
+
DEPENDS "${wgsl_src}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/embed_text.cmake"
|
|
154
|
+
VERBATIM)
|
|
155
|
+
target_sources(jkp PRIVATE src/backend/webgpu/webgpu_ops.cpp "${wgsl_cpp}")
|
|
156
|
+
target_compile_definitions(jkp PRIVATE JKP_HAVE_WEBGPU)
|
|
157
|
+
if(EMSCRIPTEN)
|
|
158
|
+
# PUBLIC: whatever links jkp into a module needs the port's JavaScript library too.
|
|
159
|
+
target_compile_options(jkp PUBLIC "--use-port=${JKP_EMDAWNWEBGPU_DIR}/emdawnwebgpu.port.py")
|
|
160
|
+
target_link_options(jkp PUBLIC "--use-port=${JKP_EMDAWNWEBGPU_DIR}/emdawnwebgpu.port.py")
|
|
161
|
+
else()
|
|
162
|
+
target_link_libraries(jkp PUBLIC dawn::webgpu_dawn)
|
|
163
|
+
endif()
|
|
164
|
+
endif()
|
|
165
|
+
|
|
166
|
+
set(jkp_backends cpu)
|
|
167
|
+
if(JKP_HAVE_CUDA)
|
|
168
|
+
list(APPEND jkp_backends cuda)
|
|
169
|
+
endif()
|
|
170
|
+
if(JKP_HAVE_METAL)
|
|
171
|
+
list(APPEND jkp_backends metal)
|
|
172
|
+
endif()
|
|
173
|
+
if(JKP_HAVE_WEBGPU)
|
|
174
|
+
list(APPEND jkp_backends webgpu)
|
|
175
|
+
endif()
|
|
176
|
+
string(REPLACE ";" ", " jkp_backends_text "${jkp_backends}")
|
|
177
|
+
message(STATUS "jkp backends: ${jkp_backends_text}")
|
|
178
|
+
|
|
179
|
+
# The WebAssembly module (jkp_wasm.js + .wasm) with web/jkp.js and the test page, side by side in
|
|
180
|
+
# <build>/web, ready to serve. Single-threaded; waits for the GPU through JSPI (PLAN.md, phase 5).
|
|
181
|
+
if(EMSCRIPTEN AND JKP_BUILD_WASM)
|
|
182
|
+
add_executable(jkp_wasm web/jkp_wasm.cpp)
|
|
183
|
+
target_link_libraries(jkp_wasm PRIVATE jkp)
|
|
184
|
+
set_target_properties(jkp_wasm PROPERTIES SUFFIX ".js" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/web")
|
|
185
|
+
target_link_options(jkp_wasm PRIVATE
|
|
186
|
+
-sJSPI
|
|
187
|
+
"-sJSPI_EXPORTS=jkpw_create,jkpw_extract"
|
|
188
|
+
"-sEXPORTED_FUNCTIONS=_malloc,_free,_jkpw_backend_available,_jkpw_create,_jkpw_extract,_jkpw_dim,_jkpw_xy,_jkpw_score,_jkpw_desc,_jkpw_rank,_jkpw_cov,_jkpw_error,_jkpw_destroy"
|
|
189
|
+
"-sEXPORTED_RUNTIME_METHODS=HEAPU8,HEAPF32,UTF8ToString"
|
|
190
|
+
-sMODULARIZE
|
|
191
|
+
-sEXPORT_ES6
|
|
192
|
+
-sEXPORT_NAME=createJkp
|
|
193
|
+
-sENVIRONMENT=web
|
|
194
|
+
-sALLOW_MEMORY_GROWTH
|
|
195
|
+
-sMAXIMUM_MEMORY=4GB
|
|
196
|
+
-sSTACK_SIZE=1MB)
|
|
197
|
+
foreach(f jkp.js test.html)
|
|
198
|
+
add_custom_command(TARGET jkp_wasm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
199
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/web/${f}" "${CMAKE_CURRENT_BINARY_DIR}/web/${f}")
|
|
200
|
+
endforeach()
|
|
201
|
+
foreach(f aliked-n16.jkpw raco.jkpw)
|
|
202
|
+
add_custom_command(TARGET jkp_wasm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
203
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/weights/${f}" "${CMAKE_CURRENT_BINARY_DIR}/web/${f}")
|
|
204
|
+
endforeach()
|
|
205
|
+
endif()
|
|
206
|
+
|
|
207
|
+
if(JKP_BUILD_CLI)
|
|
208
|
+
add_executable(jkp_cli cli/main.cpp)
|
|
209
|
+
set_target_properties(jkp_cli PROPERTIES OUTPUT_NAME jkp)
|
|
210
|
+
target_include_directories(jkp_cli PRIVATE src)
|
|
211
|
+
target_link_libraries(jkp_cli PRIVATE jkp)
|
|
212
|
+
endif()
|
|
213
|
+
|
|
214
|
+
if(JKP_BUILD_TESTS)
|
|
215
|
+
enable_testing()
|
|
216
|
+
add_executable(golden_test tests/golden_test.cpp)
|
|
217
|
+
target_include_directories(golden_test PRIVATE src)
|
|
218
|
+
target_link_libraries(golden_test PRIVATE jkp)
|
|
219
|
+
# Golden files are generated locally: python tools/dump_golden.py <images>
|
|
220
|
+
file(GLOB golden_files "${CMAKE_CURRENT_SOURCE_DIR}/build/golden/*.jkpt")
|
|
221
|
+
set(test_backends ${jkp_backends})
|
|
222
|
+
# Backends with the RaCo operations (PLAN.md, RaCo track); the others throw from Ops::normalize.
|
|
223
|
+
set(raco_backends cpu)
|
|
224
|
+
if(JKP_HAVE_CUDA)
|
|
225
|
+
list(APPEND raco_backends cuda)
|
|
226
|
+
endif()
|
|
227
|
+
if(JKP_HAVE_METAL)
|
|
228
|
+
list(APPEND raco_backends metal)
|
|
229
|
+
endif()
|
|
230
|
+
if(JKP_HAVE_WEBGPU)
|
|
231
|
+
list(APPEND raco_backends webgpu)
|
|
232
|
+
endif()
|
|
233
|
+
if(JKP_HAVE_CUDA)
|
|
234
|
+
target_compile_definitions(golden_test PRIVATE JKP_TEST_CUDA)
|
|
235
|
+
endif()
|
|
236
|
+
if(JKP_HAVE_METAL)
|
|
237
|
+
target_compile_definitions(golden_test PRIVATE JKP_TEST_METAL)
|
|
238
|
+
endif()
|
|
239
|
+
if(JKP_HAVE_WEBGPU)
|
|
240
|
+
target_compile_definitions(golden_test PRIVATE JKP_TEST_WEBGPU)
|
|
241
|
+
endif()
|
|
242
|
+
# Each GPU backend against the CPU backend on generated images; needs no golden files.
|
|
243
|
+
set(gpu_backends ${jkp_backends})
|
|
244
|
+
list(REMOVE_ITEM gpu_backends cpu)
|
|
245
|
+
if(gpu_backends)
|
|
246
|
+
add_executable(backend_test tests/backend_test.cpp)
|
|
247
|
+
target_include_directories(backend_test PRIVATE src)
|
|
248
|
+
target_link_libraries(backend_test PRIVATE jkp)
|
|
249
|
+
if(JKP_HAVE_CUDA)
|
|
250
|
+
target_compile_definitions(backend_test PRIVATE JKP_TEST_CUDA)
|
|
251
|
+
endif()
|
|
252
|
+
if(JKP_HAVE_METAL)
|
|
253
|
+
target_compile_definitions(backend_test PRIVATE JKP_TEST_METAL)
|
|
254
|
+
endif()
|
|
255
|
+
if(JKP_HAVE_WEBGPU)
|
|
256
|
+
target_compile_definitions(backend_test PRIVATE JKP_TEST_WEBGPU)
|
|
257
|
+
endif()
|
|
258
|
+
# FP16 against FP32 on the same backend: generated images plus the images of the golden files.
|
|
259
|
+
add_executable(precision_test tests/precision_test.cpp)
|
|
260
|
+
target_include_directories(precision_test PRIVATE src)
|
|
261
|
+
target_link_libraries(precision_test PRIVATE jkp)
|
|
262
|
+
if(JKP_HAVE_CUDA)
|
|
263
|
+
target_compile_definitions(precision_test PRIVATE JKP_TEST_CUDA)
|
|
264
|
+
endif()
|
|
265
|
+
if(JKP_HAVE_METAL)
|
|
266
|
+
target_compile_definitions(precision_test PRIVATE JKP_TEST_METAL)
|
|
267
|
+
endif()
|
|
268
|
+
if(JKP_HAVE_WEBGPU)
|
|
269
|
+
target_compile_definitions(precision_test PRIVATE JKP_TEST_WEBGPU)
|
|
270
|
+
endif()
|
|
271
|
+
# Each operation on its own against the CPU backend.
|
|
272
|
+
add_executable(ops_test tests/ops_test.cpp)
|
|
273
|
+
target_include_directories(ops_test PRIVATE src)
|
|
274
|
+
target_link_libraries(ops_test PRIVATE jkp)
|
|
275
|
+
foreach(def JKP_TEST_CUDA JKP_TEST_METAL JKP_TEST_WEBGPU)
|
|
276
|
+
get_target_property(defs backend_test COMPILE_DEFINITIONS)
|
|
277
|
+
if(def IN_LIST defs)
|
|
278
|
+
target_compile_definitions(ops_test PRIVATE ${def})
|
|
279
|
+
endif()
|
|
280
|
+
endforeach()
|
|
281
|
+
if(JKP_HAVE_WEBGPU AND NOT EMSCRIPTEN)
|
|
282
|
+
# The WebGPU backend on a device the caller created (jkp_config.webgpu_device).
|
|
283
|
+
add_executable(webgpu_shared_test tests/webgpu_shared_test.cpp)
|
|
284
|
+
target_link_libraries(webgpu_shared_test PRIVATE jkp)
|
|
285
|
+
add_test(NAME webgpu_shared_device COMMAND webgpu_shared_test)
|
|
286
|
+
endif()
|
|
287
|
+
foreach(backend IN LISTS gpu_backends)
|
|
288
|
+
add_test(NAME ${backend}_ops COMMAND ops_test ${backend})
|
|
289
|
+
add_test(NAME ${backend}_vs_cpu
|
|
290
|
+
COMMAND backend_test "${CMAKE_CURRENT_SOURCE_DIR}/weights/aliked-n16.jkpw" ${backend})
|
|
291
|
+
add_test(NAME ${backend}_fp16_vs_fp32
|
|
292
|
+
COMMAND precision_test "${CMAKE_CURRENT_SOURCE_DIR}/weights/aliked-n16.jkpw" ${backend} ${golden_files})
|
|
293
|
+
if(backend IN_LIST raco_backends)
|
|
294
|
+
add_test(NAME ${backend}_raco_vs_cpu
|
|
295
|
+
COMMAND backend_test "${CMAKE_CURRENT_SOURCE_DIR}/weights/raco.jkpw" ${backend})
|
|
296
|
+
endif()
|
|
297
|
+
endforeach()
|
|
298
|
+
endif()
|
|
299
|
+
foreach(golden IN LISTS golden_files)
|
|
300
|
+
get_filename_component(name "${golden}" NAME_WLE)
|
|
301
|
+
foreach(backend IN LISTS test_backends)
|
|
302
|
+
add_test(NAME golden_${backend}_${name}
|
|
303
|
+
COMMAND golden_test "${CMAKE_CURRENT_SOURCE_DIR}/weights/aliked-n16.jkpw" "${golden}" ${backend})
|
|
304
|
+
endforeach()
|
|
305
|
+
endforeach()
|
|
306
|
+
|
|
307
|
+
# RaCo: python tools/dump_golden.py --model raco <images>
|
|
308
|
+
add_executable(raco_golden_test tests/raco_golden_test.cpp)
|
|
309
|
+
target_include_directories(raco_golden_test PRIVATE src)
|
|
310
|
+
target_link_libraries(raco_golden_test PRIVATE jkp)
|
|
311
|
+
if(JKP_HAVE_CUDA)
|
|
312
|
+
target_compile_definitions(raco_golden_test PRIVATE JKP_TEST_CUDA)
|
|
313
|
+
endif()
|
|
314
|
+
if(JKP_HAVE_METAL)
|
|
315
|
+
target_compile_definitions(raco_golden_test PRIVATE JKP_TEST_METAL)
|
|
316
|
+
endif()
|
|
317
|
+
if(JKP_HAVE_WEBGPU)
|
|
318
|
+
target_compile_definitions(raco_golden_test PRIVATE JKP_TEST_WEBGPU)
|
|
319
|
+
endif()
|
|
320
|
+
file(GLOB raco_golden_files "${CMAKE_CURRENT_SOURCE_DIR}/build/golden/raco/*.jkpt")
|
|
321
|
+
foreach(golden IN LISTS raco_golden_files)
|
|
322
|
+
get_filename_component(name "${golden}" NAME_WLE)
|
|
323
|
+
foreach(backend IN LISTS raco_backends)
|
|
324
|
+
add_test(NAME golden_raco_${backend}_${name}
|
|
325
|
+
COMMAND raco_golden_test "${CMAKE_CURRENT_SOURCE_DIR}/weights/raco.jkpw" "${golden}" ${backend})
|
|
326
|
+
endforeach()
|
|
327
|
+
endforeach()
|
|
328
|
+
endif()
|
|
329
|
+
|
|
330
|
+
if(JKP_BUILD_PYTHON)
|
|
331
|
+
add_subdirectory(bindings/python)
|
|
332
|
+
endif()
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: just-keypoints
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ALIKED and RaCo keypoints with minimal dependencies: CPU, Metal and CUDA backends, no PyTorch
|
|
5
|
+
Keywords: keypoints,local features,ALIKED,RaCo,structure from motion,feature matching
|
|
6
|
+
License-Expression: Apache-2.0 AND BSD-3-Clause
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: weights/LICENSE-ALIKED
|
|
9
|
+
License-File: weights/LICENSE-RACO
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Operating System :: MacOS
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: C++
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
18
|
+
Project-URL: Documentation, https://just-keypoints.pages.dev
|
|
19
|
+
Project-URL: Source, https://github.com/manlito/just-keypoints
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: numpy>=1.26
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest; extra == "test"
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# just-keypoints
|
|
27
|
+
|
|
28
|
+
Keypoints and descriptors from [ALIKED](https://github.com/Shiaoming/ALIKED) (`aliked-n16`) and keypoints with
|
|
29
|
+
ranker scores and covariances from [RaCo](https://github.com/cvg/RaCo), with minimal dependencies: hand-written
|
|
30
|
+
CPU, Metal and CUDA kernels, no PyTorch, no ONNX Runtime. In FP32 the results match the original networks.
|
|
31
|
+
|
|
32
|
+
This is a test bed for dependency-free inference, not a replacement for ALIKED or RaCo: the methods, the
|
|
33
|
+
weights and the credit are their authors'. For real work, depend on them.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
| Package | Platforms | Backends |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `pip install just-keypoints` | Linux x86_64, macOS arm64 (13 or later), Windows x86_64 | CPU; Metal on macOS |
|
|
40
|
+
| `pip install just-keypoints-cu12` | Linux x86_64, Windows x86_64 | CPU and CUDA 12 |
|
|
41
|
+
| `pip install just-keypoints-cu13` | Linux x86_64, Windows x86_64 | CPU and CUDA 13 |
|
|
42
|
+
|
|
43
|
+
Install one of them: all three provide the `just_keypoints` module. The CUDA packages link the CUDA runtime
|
|
44
|
+
statically and need only an NVIDIA driver. CUDA 12 runs on Pascal (sm_60) and later, CUDA 13 on Turing (sm_75)
|
|
45
|
+
and later. Python 3.12 or later. Both models' weights are built in.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import just_keypoints as jkp
|
|
49
|
+
print(jkp.__version__, jkp.compiled_backends())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Use
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import numpy as np
|
|
56
|
+
import just_keypoints as jkp
|
|
57
|
+
|
|
58
|
+
backend = "cuda" if jkp.backend_available("cuda") else "metal" if jkp.backend_available("metal") else "cpu"
|
|
59
|
+
extractor = jkp.Extractor(backend=backend, top_k=2000) # aliked-n16, built-in weights
|
|
60
|
+
f = extractor.extract(image) # uint8 (h, w), (h, w, 3) RGB or (h, w, 4) RGBA
|
|
61
|
+
f.xy, f.score, f.desc # (n, 2), (n,), (n, 128) float32 copies
|
|
62
|
+
|
|
63
|
+
raco = jkp.Extractor(backend=backend, model="raco", top_k=2048, descriptor="aliked-n16")
|
|
64
|
+
r = raco.extract(image)
|
|
65
|
+
r.xy, r.rank, r.cov, r.desc # (n, 2), (n,), (n, 2, 2) in pixels², (n, 128)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Pixel coordinates are x right, y down, with (0, 0) the centre of the top-left pixel. `precision="fp16"` is
|
|
69
|
+
faster on the GPU backends (ALIKED only) with slightly different results. Without `top_k`, ALIKED keeps every
|
|
70
|
+
keypoint with `score > score_threshold` (0.2), at most `max_keypoints` (5000). An `Extractor` is made once and
|
|
71
|
+
used for many images; calls from several threads are serialized. Errors (no such device, bad weights) raise
|
|
72
|
+
`RuntimeError`.
|
|
73
|
+
|
|
74
|
+
Documentation: <https://just-keypoints.pages.dev>.
|
|
75
|
+
|
|
76
|
+
Licences: the code is Apache-2.0; the built-in weights are ALIKED's (BSD-3-Clause) and RaCo's (Apache-2.0); both licence files are in
|
|
77
|
+
the package.
|