1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Native Rust/tch `LoFTR` feature matching.
//!
//! This crate exposes a small, high-level API for constructing a `LoFTR` model,
//! loading compatible weights, and matching a pair of images.
//!
//! Typical usage:
//!
//! 1. Build a [`LoftrModel`] with a preset [`LoftrConfig`].
//! 2. Load exported weights with [`LoftrModel::load_weights`].
//! 3. Run [`LoftrModel::forward`] or [`LoftrModel::forward_debug`].
//!
//! The published docs are built with the `doc-only` feature so they can render
//! on docs.rs without linking libtorch. For local runs, either point `tch` at
//! an existing libtorch install or enable the `download-libtorch` feature.
//!
//! # Example
//!
//! ```no_run
//! use loftr::{LoftrConfig, LoftrModel};
//! use tch::{Device, Kind, Tensor};
//!
//! let mut model = LoftrModel::new(Device::Cpu, LoftrConfig::outdoor())?;
//! model.load_weights("artifacts/weights/loftr_outdoor_state_dict.safetensors")?;
//!
//! let image0 = Tensor::rand([1, 1, 128, 128], (Kind::Float, Device::Cpu));
//! let image1 = Tensor::rand([1, 1, 128, 128], (Kind::Float, Device::Cpu));
//! let matches = model.forward(&image0, &image1)?;
//!
//! println!("match count = {}", matches.confidence.size()[0]);
//! # Ok::<(), loftr::LoftrError>(())
//! ```
pub use crateLoftrError;
pub use crate;
pub use crate;
pub use crate;