-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,47 +28,39 @@ fn main() -> anyhow::Result<()> { | |
// "images/bus.jpg", // remote image | ||
// "../images", // image folder | ||
// "../demo.mp4", // local video | ||
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", // remote video | ||
// "rtsp://admin:[email protected]:554/h265/ch1/", // rtsp h264 stream | ||
// "./assets/bus.jpg", // local image | ||
// "/home/qweasd/Desktop/SourceVideos/3.mp4", | ||
// "../hall.mp4", | ||
// "../000020489.jpg", | ||
// "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", // remote video | ||
// "rtsp://admin:[email protected]:554/h265/ch1/", // rtsp h264 stream | ||
// "./assets/bus.jpg", // local image | ||
"../SourceVideos/3.mp4", | ||
)? | ||
.with_batch(1) | ||
.build()?; | ||
|
||
let mut viewer = Viewer::new(); | ||
let mut viewer = Viewer::new().with_delay(100).with_scale(1.).resizable(true); | ||
|
||
// run | ||
// iteration | ||
for (xs, _) in dl { | ||
// std::thread::sleep(std::time::Duration::from_millis(100)); | ||
let ys = model.forward(&xs, false)?; | ||
// annotator.annotate(&xs, &ys); | ||
// inference & annotate | ||
let ys = model.run(&xs)?; | ||
let images_plotted = annotator.plot(&xs, &ys, false)?; | ||
|
||
// TODO: option for saving | ||
let images_plotted = annotator.plot(&xs, &ys)?; | ||
// show image | ||
viewer.imshow(&images_plotted)?; | ||
|
||
// RgbaImage -> DynamicImage | ||
let frames: Vec<image::DynamicImage> = images_plotted | ||
.iter() | ||
.map(|x| image::DynamicImage::from(x.to_owned())) | ||
.collect(); | ||
// write video | ||
viewer.write_batch(&images_plotted)?; | ||
|
||
// imshow | ||
viewer.imshow(&frames)?; | ||
// check out window and key event | ||
if !viewer.is_open() || viewer.is_key_pressed(Key::Escape) { | ||
break; | ||
} | ||
|
||
// write video | ||
viewer.write_batch(&frames, 30)?; // fps | ||
} | ||
|
||
// finish video write | ||
viewer.finish_write()?; | ||
|
||
// images -> video | ||
// DataLoader::is2v("runs/YOLO-DataLoader", &["runs", "is2v"], 24)?; | ||
|
||
viewer.finish_write()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters