mirror of
https://github.com/mii443/usls.git
synced 2025-08-22 15:45:41 +00:00
26 lines
690 B
Rust
26 lines
690 B
Rust
use anyhow::Result;
|
|
use usls::{models::DINOv2, DataLoader, Options};
|
|
|
|
fn main() -> Result<()> {
|
|
tracing_subscriber::fmt()
|
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
|
.with_timer(tracing_subscriber::fmt::time::ChronoLocal::rfc_3339())
|
|
.init();
|
|
|
|
// images
|
|
let xs = [
|
|
DataLoader::try_read("./assets/bus.jpg")?,
|
|
DataLoader::try_read("./assets/bus.jpg")?,
|
|
];
|
|
|
|
// model
|
|
let options = Options::dinov2_small().with_batch_size(xs.len()).commit()?;
|
|
let mut model = DINOv2::new(options)?;
|
|
|
|
// encode images
|
|
let y = model.encode_images(&xs)?;
|
|
println!("Feat shape: {:?}", y.shape());
|
|
|
|
Ok(())
|
|
}
|