Add Depth-Anything model (#10)

* Add Depth-Anything model
This commit is contained in:
Jamjamjon
2024-04-25 00:41:29 +08:00
committed by GitHub
parent beda8ef803
commit e614ca4136
11 changed files with 476 additions and 24 deletions

View File

@ -0,0 +1,23 @@
use usls::{models::DepthAnything, Annotator, DataLoader, Options};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// visual
let options = Options::default()
.with_model("../models/depth-anything-s-dyn.onnx")
.with_i00((1, 1, 8).into())
.with_i02((384, 512, 1024).into())
.with_i03((384, 512, 1024).into());
let model = DepthAnything::new(&options)?;
// load
let x = vec![DataLoader::try_read("./assets/2.jpg")?];
// run
let y = model.run(&x)?;
// annotate
let annotator = Annotator::default().with_saveout("Depth-Anything");
annotator.annotate(&x, &y);
Ok(())
}