mirror of
https://github.com/mii443/usls.git
synced 2025-08-22 15:45:41 +00:00
0.1.0-beta.1 (#82)
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use usls::{models::RTMO, Annotator, DataLoader, Options, COCO_SKELETONS_16};
|
||||
use usls::{models::RTMO, Annotator, DataLoader, Options, Style, SKELETON_COCO_19};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt()
|
||||
@ -11,16 +11,31 @@ fn main() -> Result<()> {
|
||||
let mut model = RTMO::new(Options::rtmo_s().commit()?)?;
|
||||
|
||||
// load image
|
||||
let xs = [DataLoader::try_read("images/bus.jpg")?];
|
||||
let xs = DataLoader::try_read_n(&["./assets/bus.jpg"])?;
|
||||
|
||||
// run
|
||||
let ys = model.forward(&xs)?;
|
||||
println!("ys: {:?}", ys);
|
||||
|
||||
// annotate
|
||||
let annotator = Annotator::default()
|
||||
.with_saveout(model.spec())
|
||||
.with_skeletons(&COCO_SKELETONS_16);
|
||||
annotator.annotate(&xs, &ys);
|
||||
.with_hbb_style(Style::hbb().with_draw_fill(true))
|
||||
.with_keypoint_style(
|
||||
Style::keypoint()
|
||||
.with_skeleton(SKELETON_COCO_19.into())
|
||||
.show_confidence(false)
|
||||
.show_id(true)
|
||||
.show_name(false),
|
||||
);
|
||||
for (x, y) in xs.iter().zip(ys.iter()) {
|
||||
annotator.annotate(x, y)?.save(format!(
|
||||
"{}.jpg",
|
||||
usls::Dir::Current
|
||||
.base_dir_with_subs(&["runs", model.spec()])?
|
||||
.join(usls::timestamp(None))
|
||||
.display(),
|
||||
))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user