mirror of
https://github.com/mii443/usls.git
synced 2025-12-03 02:58:22 +00:00
Bump the version to 0.0.12
* Add sapiens-seg model
This commit is contained in:
30
examples/sapiens/main.rs
Normal file
30
examples/sapiens/main.rs
Normal 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(())
|
||||
}
|
||||
Reference in New Issue
Block a user