Commit:
b5b5a56Parent:
46c05e5Dump raw ALIKED output range to verify the [-1,1] normalization assumption
Matched coordinates were landing outside image bounds entirely, which points at the denormalization formula rather than noisy matching -- it assumes ALIKED's raw ONNX output is normalized to [-1,1] over the padded canvas (derived by reading the reference Python's postprocess step, never verified against actual model output). Print the real min/max range for the first image so that assumption can be checked directly instead of re-derived from source reading. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src/feature_extractor.rs
+19
-1
diff --git a/src/feature_extractor.rs b/src/feature_extractor.rs
index 9dd08e3..8850730 100644
@@ -120,7 +120,7 @@ pub fn run(cfg: FeatureExtractorConfig) -> Result<()> {
println!("Found {} images under {}", paths.len(), cfg.image_path.display());
let pb = progress::new(paths.len() as u64, "images");
for path in &paths {
for (idx, path) in paths.iter().enumerate() {
let rel_name = path
.strip_prefix(&cfg.image_path)
.unwrap_or(path)
@@ -133,6 +133,24 @@ pub fn run(cfg: FeatureExtractorConfig) -> Result<()> {
let (keypoints, descriptors_flat, scores) = run_aliked(&mut session, &pre.tensor)?;
let n = keypoints.len();
if idx == 0 && n > 0 {
// Diagnostic: the denormalization formula below assumes ALIKED's raw output is
// normalized to [-1, 1] over the padded square canvas. Print the actual raw
// range so that assumption can be checked directly against real model output.
let (mut x_min, mut x_max) = (f32::INFINITY, f32::NEG_INFINITY);
let (mut y_min, mut y_max) = (f32::INFINITY, f32::NEG_INFINITY);
for &[x, y] in &keypoints {
x_min = x_min.min(x);
x_max = x_max.max(x);
y_min = y_min.min(y);
y_max = y_max.max(y);
}
eprintln!(
"[diag] {rel_name}: raw ALIKED output range -- x: [{x_min:.4}, {x_max:.4}], y: [{y_min:.4}, {y_max:.4}] (n={n}); image size: {}x{}",
pre.orig_width, pre.orig_height
);
}
let desc_dim = if n == 0 {
128
} else if descriptors_flat.len() % n == 0 {