mirror of
https://github.com/mii443/usls.git
synced 2025-12-03 02:58:22 +00:00
🐍 v0.1.0 (#53)
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
use anyhow::Result;
|
||||
use usls::{models::YOLOPv2, Annotator, DataLoader, Options};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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();
|
||||
|
||||
// build model
|
||||
let options = Options::default()
|
||||
.with_model("yolop/v2-dyn-480x800.onnx")?
|
||||
.with_confs(&[0.3]);
|
||||
let options = Options::yolop_v2_480x800().commit()?;
|
||||
let mut model = YOLOPv2::new(options)?;
|
||||
|
||||
// load image
|
||||
let x = [DataLoader::try_read("images/car.jpg")?];
|
||||
let x = [DataLoader::try_read("images/car-view.jpg")?];
|
||||
|
||||
// run
|
||||
let y = model.run(&x)?;
|
||||
let y = model.forward(&x)?;
|
||||
|
||||
// annotate
|
||||
let annotator = Annotator::default()
|
||||
.with_polygons_name(true)
|
||||
.with_saveout("YOLOPv2");
|
||||
.with_saveout(model.spec());
|
||||
annotator.annotate(&x, &y);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user