* Update imageproc crates

* Add top-p method for sampling

* Add SVTR for text recognition & bug fix
This commit is contained in:
Jamjamjon
2024-04-06 16:16:53 +08:00
committed by GitHub
parent ce9a416b71
commit a0d410b46d
48 changed files with 1621 additions and 990 deletions

View File

@ -1,19 +1,22 @@
use usls::{models::RTDETR, DataLoader, Options, COCO_NAMES_80};
use usls::{models::RTDETR, Annotator, DataLoader, Options, COCO_NAMES_80};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// build model
let options = Options::default()
.with_model("../models/rtdetr-l-f16.onnx")
.with_confs(&[0.4, 0.15]) // person: 0.4, others: 0.15
.with_names(&COCO_NAMES_80)
.with_saveout("RT-DETR");
.with_names(&COCO_NAMES_80);
let mut model = RTDETR::new(&options)?;
// build dataloader
let mut dl = DataLoader::default().load("./assets/bus.jpg")?;
// load image
let x = vec![DataLoader::try_read("./assets/bus.jpg")?];
// run
model.run(&dl.next().unwrap().0)?;
let y = model.run(&x)?;
// annotate
let annotator = Annotator::default().with_saveout("RT-DETR");
annotator.annotate(&x, &y);
Ok(())
}