Update README.md

This commit is contained in:
Jamjamjon
2024-09-28 10:10:05 +08:00
committed by GitHub
parent 6ace97f09f
commit f2c4593672

View File

@@ -3,7 +3,7 @@
</p> </p>
<p align="center"> <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>
<br> <br>
<a href='https://github.com/microsoft/onnxruntime/releases'> <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` - Build model with the provided `models` and `Options`
- Load images, video and stream with `DataLoader` - Load images, video and stream with `DataLoader`
- Do inference - Do inference
- Annotate inference results with `Annotator`
- Retrieve inference results from `Vec<Y>` - 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 ```rust
use usls::{models::YOLO, Annotator, DataLoader, Nms, Options, Vision, YOLOTask, YOLOVersion}; 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_model("yolo/v8-m-dyn.onnx")?
.with_yolo_version(YOLOVersion::V8) // YOLOVersion: V5, V6, V7, V8, V9, V10, RTDETR .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_yolo_task(YOLOTask::Detect) // YOLOTask: Classify, Detect, Pose, Segment, Obb
.with_i00((1, 2, 4).into()) .with_ixx(0, 0, (1, 2, 4).into())
.with_i02((0, 640, 640).into()) .with_ixx(0, 2, (0, 640, 640).into())
.with_i03((0, 640, 640).into()) .with_ixx(0, 3, (0, 640, 640).into())
.with_confs(&[0.2]); .with_confs(&[0.2]);
let mut model = YOLO::new(options)?; 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_bboxes_thickness(4)
.with_saveout("YOLO-DataLoader"); .with_saveout("YOLO-DataLoader");
// Build viewer
let mut viewer = Viewer::new().with_delay(10).with_scale(1.).resizable(true);
// Run and annotate results // Run and annotate results
for (xs, _) in dl { for (xs, _) in dl {
let ys = model.forward(&xs, false)?; 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 // Retrieve inference results
for y in ys { 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(()) Ok(())
} }
``` ```
</details>
</br>
## 📌 License ## 📌 License
This project is licensed under [LICENSE](LICENSE). This project is licensed under [LICENSE](LICENSE).