Update README.md

This commit is contained in:
Jamjamjon 2024-09-28 10:10:05 +08:00 committed by GitHub
parent 6ace97f09f
commit f2c4593672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 86 additions and 59 deletions

View File

@ -3,7 +3,7 @@
</p>
<p align="center">
| <a href="https://docs.rs/usls"><strong>Documentation</strong></a> |
<a href="https://docs.rs/usls"><strong>Documentation</strong></a>
<br>
<br>
<a href='https://github.com/microsoft/onnxruntime/releases'>
@ -123,8 +123,13 @@ cargo run -r --example yolo # blip, clip, yolop, svtr, db, ...
- Build model with the provided `models` and `Options`
- Load images, video and stream with `DataLoader`
- Do inference
- Annotate inference results with `Annotator`
- Retrieve inference results from `Vec<Y>`
- Annotate inference results with `Annotator`
- Display images and write them to video with `Viewer`
<br/>
<details>
<summary>example code</summary>
```rust
use usls::{models::YOLO, Annotator, DataLoader, Nms, Options, Vision, YOLOTask, YOLOVersion};
@ -136,9 +141,9 @@ cargo run -r --example yolo # blip, clip, yolop, svtr, db, ...
.with_model("yolo/v8-m-dyn.onnx")?
.with_yolo_version(YOLOVersion::V8) // YOLOVersion: V5, V6, V7, V8, V9, V10, RTDETR
.with_yolo_task(YOLOTask::Detect) // YOLOTask: Classify, Detect, Pose, Segment, Obb
.with_i00((1, 2, 4).into())
.with_i02((0, 640, 640).into())
.with_i03((0, 640, 640).into())
.with_ixx(0, 0, (1, 2, 4).into())
.with_ixx(0, 2, (0, 640, 640).into())
.with_ixx(0, 3, (0, 640, 640).into())
.with_confs(&[0.2]);
let mut model = YOLO::new(options)?;
@ -159,10 +164,25 @@ cargo run -r --example yolo # blip, clip, yolop, svtr, db, ...
.with_bboxes_thickness(4)
.with_saveout("YOLO-DataLoader");
// Build viewer
let mut viewer = Viewer::new().with_delay(10).with_scale(1.).resizable(true);
// Run and annotate results
for (xs, _) in dl {
let ys = model.forward(&xs, false)?;
annotator.annotate(&xs, &ys);
// annotator.annotate(&xs, &ys);
let images_plotted = annotator.plot(&xs, &ys, false)?;
// show image
viewer.imshow(&images_plotted)?;
// check out window and key event
if !viewer.is_open() || viewer.is_key_pressed(usls::Key::Escape) {
break;
}
// write video
viewer.write_batch(&images_plotted)?;
// Retrieve inference results
for y in ys {
@ -183,10 +203,17 @@ cargo run -r --example yolo # blip, clip, yolop, svtr, db, ...
}
}
// finish video write
viewer.finish_write()?;
Ok(())
}
```
</details>
</br>
## 📌 License
This project is licensed under [LICENSE](LICENSE).