Bump the version to 0.0.12

* Add sapiens-seg model
This commit is contained in:
Jamjamjon
2024-08-31 17:10:36 +08:00
committed by GitHub
parent f25f5cf2b5
commit f6755a8be4
23 changed files with 340 additions and 31 deletions

30
examples/sapiens/main.rs Normal file
View File

@@ -0,0 +1,30 @@
use usls::{
models::{Sapiens, SapiensTask},
Annotator, DataLoader, Options, BODY_PARTS_28,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// build
let options = Options::default()
.with_model("sapiens-seg-0.3b-dyn.onnx")?
.with_sapiens_task(SapiensTask::Seg)
.with_names(&BODY_PARTS_28)
.with_profile(false)
.with_i00((1, 1, 8).into());
let mut model = Sapiens::new(options)?;
// load
let x = [DataLoader::try_read("./assets/paul-george.jpg")?];
// run
let y = model.run(&x)?;
// annotate
let annotator = Annotator::default()
.without_masks(true)
.with_polygons_name(false)
.with_saveout("Sapiens");
annotator.annotate(&x, &y);
Ok(())
}