Skip to content

Commit

Permalink
⬆️ upgrades dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
chriamue committed Dec 26, 2023
1 parent 2756b2f commit ac40a5e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ wasm = [
]

[dependencies]
base64 = "0.13.0"
base64 = "0.21.5"
bincode = "1.3.3"
brief-rs = { git = "https://github.com/chriamue/brief-rs", optional = true }
bytes = "1.2.1"
Expand All @@ -40,13 +40,13 @@ image = { version = "0.24.3", default-features = false, features = [
"jpeg",
] }
imageproc = { version = "0.23.0", default-features = false }
image-label-tool = { git = "https://github.com/chriamue/image-label-tool" }
image-label-tool = { git = "https://github.com/chriamue/image-label-tool", version = "0.1.2" }
instant = { version = "0.1", features = ["wasm-bindgen", "inaccurate"] }
linfa = "0.6.1"
linfa = "0.7.0"
mnist = { version = "0.5.0", features = ["download"], optional = true }
ndarray = "0.15.6"
num-traits = "0.2.15"
object-detector-rust = { version = "0.1.2", git="https://github.com/chriamue/object-detector-rust" }
object-detector-rust = { version = "0.1.3", git="https://github.com/chriamue/object-detector-rust" }
rand = "0.8.5"
reqwest = { version = "0.11", features = ["blocking", "json"], optional = true }
rusttype = "0.9.3"
Expand All @@ -56,7 +56,7 @@ smartcore = { version = "0.3.0", features = [
"ndarray-bindings",
"serde",
], default-features = false, git = "https://github.com/smartcorelib/smartcore", branch = "fix-245" }
zip = { version = "0.6.3", default-features = false, features = [
zip = { version = "0.6.6", default-features = false, features = [
"deflate",
], optional = true }

Expand All @@ -75,13 +75,13 @@ web-sys = { version = "0.3.59", features = [
"ImageData",
], optional = true }
js-sys = { version = "0.3.55", optional = true }
yew = { version = "0.20.0", features = ["csr", "ssr"], optional = true }
yew = { version = "0.21.0", features = ["csr", "ssr"], optional = true }

[profile.release]
debug = true

[dev-dependencies]
criterion = { version = "0.4", default-features = false }
criterion = { version = "0.5", default-features = false }

[[bench]]
name = "benchmark"
Expand Down
6 changes: 4 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use base64::engine::general_purpose;
use base64::Engine;
use image::{imageops::FilterType, DynamicImage, GenericImageView, ImageOutputFormat};
use std::io::Cursor;

Expand All @@ -6,14 +8,14 @@ pub fn image_to_base64_image(img: &DynamicImage) -> String {
let mut image_data: Vec<u8> = Vec::new();
img.write_to(&mut Cursor::new(&mut image_data), ImageOutputFormat::Png)
.unwrap();
let res_base64 = base64::encode(image_data);
let res_base64 = general_purpose::STANDARD.encode(image_data);
format!("data:image/png;base64,{}", res_base64)
}

/// decodes base64 encoded image to dynamic image
pub fn base64_image_to_image(b64img: &str) -> DynamicImage {
let b64img = b64img.replace("data:image/png;base64,", "");
let data = base64::decode(b64img).unwrap();
let data = general_purpose::STANDARD.decode(b64img).unwrap();
image::load_from_memory(&data).unwrap()
}

Expand Down
6 changes: 3 additions & 3 deletions src/wasm/trainer/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use object_detector_rust::{
/// creates a memory database from images in label tool
pub fn create_dataset(label_tool: &LabelTool) -> MemoryDataSet {
// get all images from label tool
let images = label_tool.annotated_images().lock().unwrap().clone();
let images = label_tool.annotated_images().lock().unwrap().clone().images;
// create memory dataset
let mut dataset = MemoryDataSet::default();
for image in images.iter() {
let img = image.get_image();
for image in images.borrow().iter() {
let img = image.get_image().clone();
let annotations: Vec<(BBox, u32)> = image
.get_annotations()
.iter()
Expand Down

0 comments on commit ac40a5e

Please sign in to comment.