Skip to content

Commit

Permalink
Adjust progress_bar's format
Browse files Browse the repository at this point in the history
  • Loading branch information
jamjamjon committed Sep 14, 2024
1 parent af8e8a3 commit 97af971
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions examples/dl/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use usls::{models::YOLO, Annotator, DataLoader, Options, Vision, YOLOTask, YOLOV

fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.with_max_level(tracing::Level::ERROR)
.init();

let options = Options::new()
Expand All @@ -21,11 +21,11 @@ fn main() -> anyhow::Result<()> {
// "rtsp://admin:[email protected]:554/h265/ch1/",
// "rtsp://admin:[email protected]:554/h264/ch1/",
// "../hall.mp4",
// "./assets/bus.jpg",
"./assets/bus.jpg",
// "images/car.jpg",
// "../set-negs",
// "/home/qweasd/Desktop/coco/val2017/images/test",
"/home/qweasd/Desktop/SourceVideos/3.mp4",
// "/home/qweasd/Desktop/SourceVideos/3.mp4",
// "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
)?
.with_batch(1)
Expand Down
7 changes: 2 additions & 5 deletions src/core/dataloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ impl Iterator for DataLoaderIterator {
Some(progress_bar) => {
progress_bar.inc(1);
match self.receiver.recv().ok() {
Some(item) => {
// progress_bar.inc(1);
Some(item)
}
Some(item) => Some(item),
None => {
progress_bar.set_prefix(" Iterated");
progress_bar.finish();
Expand All @@ -55,7 +52,7 @@ impl IntoIterator for DataLoader {
self.nf / self.batch_size as u64,
" Iterating",
Some(&format!("{:?}", self.media_type)),
"{prefix:.green.bold} {msg} {human_pos}/{human_len} |{bar}| {elapsed_precise}",
"{prefix:.green.bold} {human_pos}/{human_len} |{bar}| {elapsed_precise} | {msg} ",
)
.ok()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/core/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Default for Options {
onnx_path: String::new(),
device: Device::Cuda(0),
profile: false,
num_dry_run: 5,
num_dry_run: 3,
i00: None,
i01: None,
i02: None,
Expand Down
4 changes: 3 additions & 1 deletion src/core/ort_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl OrtEngine {
self.num_dry_run as u64,
" DryRun",
None,
"{prefix:.cyan.bold} {msg:.dim} {human_pos}/{human_len} |{bar}| {elapsed_precise}",
"{prefix:.green.bold} {human_pos}/{human_len} |{bar}| {elapsed_precise} | {msg}",
)?;

// dummy inputs
Expand All @@ -310,6 +310,8 @@ impl OrtEngine {
}
self.ts.clear();

// update
pb.set_message(format!("{:?}", self.device));
pb.finish();
}
Ok(())
Expand Down

0 comments on commit 97af971

Please sign in to comment.