-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.rs
31 lines (25 loc) · 829 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use anyhow::Result;
use usls::{models::PicoDet, Annotator, 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();
// options
let options = Options::picodet_layout_1x()
// picodet_l_layout_3cls()
// picodet_l_layout_17cls()
.commit()?;
let mut model = PicoDet::new(options)?;
// load
let xs = [DataLoader::try_read("images/academic.jpg")?];
// annotator
let annotator = Annotator::default()
.with_bboxes_thickness(3)
.with_saveout(model.spec());
// run
let ys = model.forward(&xs)?;
println!("{:?}", ys);
annotator.annotate(&xs, &ys);
Ok(())
}