From e136417e4a301c13d5650b09d97836cebbbbf43d Mon Sep 17 00:00:00 2001 From: ahirner Date: Sun, 15 Oct 2023 08:55:05 +0200 Subject: [PATCH 1/2] centralize workspace deps --- Cargo.toml | 22 ++++++++++++++++++++++ ff-video/Cargo.toml | 11 +++++------ image-ext/Cargo.toml | 6 +++--- infur-test-gen/Cargo.toml | 4 ++-- infur/Cargo.toml | 30 +++++++++++------------------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fe97fd3..b12237d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,29 @@ [workspace] members = ["infur", "infur-test-gen", "ff-video", "image-ext"] +default-members = ["infur"] resolver = "2" +[workspace.package] +version = "0.2.0" +edition = "2021" +description = "ONNX model inference on video and images" +authors = ["Alexander Hirner"] +license = "MIT" +keywords = ["ONNX", "Neural Networks", "Inference", "Segmentation", "GUI", "Prediction", "Video"] +readme = "README.md" +repository = "https://github.com/ahirner/infur" +homepage = "https://github.com/ahirner/infur" + +[workspace.dependencies] +image = "0.24" +fast_image_resize = { version = "1" } +# need onnxruntime .14 for 0-dim input tolerance (not in .13), +# then furthermore need master to resolve ndarray with tract-core +onnxruntime = { git = "https://github.com/nbigaouette/onnxruntime-rs" } +serde = { version = "1", features = ["derive"] } +thiserror = "1" +tracing = "0.1" + [profile.dev.package] image-ext = { opt-level = 3 } backtrace = { opt-level = 3 } diff --git a/ff-video/Cargo.toml b/ff-video/Cargo.toml index 98aac9a..1694043 100644 --- a/ff-video/Cargo.toml +++ b/ff-video/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "ff-video" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "Slim image decoding with ffmpeg." +version.workspace = true +edition.workspace = true [dependencies] image-ext = { path = "../image-ext" } -thiserror = "1" -tracing = "0.1" +thiserror.workspace = true +tracing.workspace = true diff --git a/image-ext/Cargo.toml b/image-ext/Cargo.toml index 3555fb2..5850e4d 100644 --- a/image-ext/Cargo.toml +++ b/image-ext/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "image-ext" -version = "0.1.0" -edition = "2021" description = "Extend image crate with BGR pixel type" +version.workspace = true +edition.workspace = true [dependencies] -image = "0.24" +image.workspace = true diff --git a/infur-test-gen/Cargo.toml b/infur-test-gen/Cargo.toml index 130ca51..bc5b160 100644 --- a/infur-test-gen/Cargo.toml +++ b/infur-test-gen/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "infur-test-gen" -version = "0.1.0" -edition = "2021" description = "generate synthetic test media" +version.workspace = true +edition.workspace = true [build-dependencies] ureq = "2" diff --git a/infur/Cargo.toml b/infur/Cargo.toml index 64131ce..52c11c0 100644 --- a/infur/Cargo.toml +++ b/infur/Cargo.toml @@ -1,31 +1,23 @@ [package] -authors = ["Alexander Hirner "] -license = "MIT" name = "infur" -version = "0.1.0" -edition = "2021" -description = "ONNX model inference on video and images" -keywords = ["ONNX", "Neural Networks", "Inference", "Segmentation", "GUI", "Prediction", "Video"] -repository = "https://github.com/ahirner/infur" -readme = "README.md" -homepage = "https://github.com/ahirner/infur" +description.workspace = true +version.workspace = true +edition.workspace = true [features] default = ["persistence"] persistence = ["eframe/persistence"] [dependencies] -thiserror = "1" -stable-eyre = "0.2" -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "fmt"], default-features = false } -eframe = { version = "0.19", features = ["wgpu", "default_fonts"], default-features = false} -serde = { version = "1", features = ["derive"] } -fast_image_resize = { version = "1" } -# need onnxruntime .14 for 0-dim input tolerance (not in .13), -# then furhtermore need master to resolve ndarray with tract-core... -onnxruntime = { git = "https://github.com/nbigaouette/onnxruntime-rs" } +fast_image_resize.workspace = true +onnxruntime.workspace = true +thiserror.workspace = true +tracing.workspace = true +serde.workspace = true once_cell = "1" +eframe = { version = "0.19", features = ["wgpu", "default_fonts"], default-features = false } +tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "fmt"], default-features = false } +stable-eyre = "0.2" image-ext = { path = "../image-ext" } ff-video = { path = "../ff-video" } From 1fbe2ae41afc7e52639cae52adf98192eb56c47f Mon Sep 17 00:00:00 2001 From: ahirner Date: Sun, 15 Oct 2023 08:57:48 +0200 Subject: [PATCH 2/2] unneccessary cast --- infur/src/gui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infur/src/gui.rs b/infur/src/gui.rs index 0cd1e80..d55250d 100644 --- a/infur/src/gui.rs +++ b/infur/src/gui.rs @@ -319,7 +319,7 @@ impl eframe::App for InFur { // occupy max width with constant aspect ratio let max_width = ui.available_width(); let [w, h] = tex_frame.handle.size(); - let w_scale = max_width as f32 / w as f32; + let w_scale = max_width / w as f32; let (w, h) = (w as f32 * w_scale, h as f32 * w_scale); ui.image(&tex_frame.handle, [w, h]); // prop decoded image underneath