0.0.14: DataLoader now support video and streaming

- Added `Hub` for resource management
- Updated `DataLoader` to support video and streaming
- Updated `CI`
- Replaced `println!` with `tracing` for logging
This commit is contained in:
Jamjamjon
2024-09-16 10:41:16 +08:00
committed by GitHub
parent 826da4037e
commit 0adddd3bbd
82 changed files with 1739 additions and 583 deletions

View File

@@ -6,12 +6,6 @@ This demo showcases how to use [CLIP](https://github.com/openai/CLIP) to compute
cargo run -r --example clip
```
## CLIP ONNX Model
- [clip-b32-visual](https://github.com/jamjamjon/assets/releases/download/v0.0.1/clip-b32-visual.onnx)
- [clip-b32-textual](https://github.com/jamjamjon/assets/releases/download/v0.0.1/clip-b32-textual.onnx)
## Results
```shell

View File

@@ -3,14 +3,14 @@ use usls::{models::Clip, DataLoader, Options};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// visual
let options_visual = Options::default()
.with_model("clip-b32-visual-dyn.onnx")?
.with_model("clip/visual-base-dyn.onnx")?
.with_i00((1, 1, 4).into())
.with_profile(false);
// textual
let options_textual = Options::default()
.with_model("clip-b32-textual-dyn.onnx")?
// .with_tokenizer("tokenizer-clip.json")?
.with_model("clip/textual-base-dyn.onnx")?
.with_tokenizer("clip/tokenizer.json")?
.with_i00((1, 1, 4).into())
.with_profile(false);
@@ -30,9 +30,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let feats_text = model.encode_texts(&texts)?; // [n, ndim]
// load image
let dl = DataLoader::default()
.with_batch(model.batch_visual())
.load("./examples/clip/images")?;
let dl = DataLoader::new("./examples/clip/images")?.build()?;
// loop
for (images, paths) in dl {