Skip to content

Commit

Permalink
fix tensorflow interface
Browse files Browse the repository at this point in the history
  • Loading branch information
alabulei1 committed Dec 17, 2021
1 parent d503aa2 commit d329eb9
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion faas/mobilenet_birds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
ssvm_tensorflow_interface = "^0.1.3"
wasmedge_tensorflow_interface = "^0.2.2"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions faas/mobilenet_birds/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use wasmedge_tensorflow_interface;
use std::str;
use std::time::{Instant};

Expand All @@ -22,7 +22,7 @@ pub fn infer(image_data: &[u8]) -> String {
let model_data: &[u8] = include_bytes!("mobilenet_v2_192res_1.0_inat_bird.pb");
let labels = include_str!("aiy_birds_V1_labelmap.txt");

let mut session = ssvm_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
let mut session = wasmedge_tensorflow_interface::Session::new(model_data, wasmedge_tensorflow_interface::ModelType::TensorFlow);
session.add_input("map/TensorArrayStack/TensorArrayGatherV3", &flat_img, &[1, 192, 192, 3])
.add_output("prediction")
.run();
Expand Down
2 changes: 1 addition & 1 deletion faas/mobilenet_food/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
ssvm_tensorflow_interface = "^0.1.3"
wasmedge_tensorflow_interface = "^0.2.2"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions faas/mobilenet_food/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use wasmedge_tensorflow_interface;
use std::str;
use std::time::{Instant};

Expand All @@ -22,7 +22,7 @@ pub fn infer(image_data: &[u8]) -> String {
let model_data: &[u8] = include_bytes!("mobilenet_v1_192res_1.0_seefood.pb");
let labels = include_str!("aiy_food_V1_labelmap.txt");

let mut session = ssvm_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
let mut session = wasmedge_tensorflow_interface::Session::new(model_data, wasmedge_tensorflow_interface::ModelType::TensorFlow);
session.add_input("input", &flat_img, &[1, 192, 192, 3])
.add_output("MobilenetV1/Predictions/Softmax")
.run();
Expand Down
2 changes: 1 addition & 1 deletion faas/mobilenet_insects/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
ssvm_tensorflow_interface = "^0.1.3"
wasmedge_tensorflow_interface = "^0.2.2"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions faas/mobilenet_insects/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use wasmedge_tensorflow_interface;
use std::str;
use std::time::{Instant};

Expand All @@ -20,7 +20,7 @@ pub fn infer(image_data: &[u8]) -> String {
let model_data: &[u8] = include_bytes!("mobilenet_v2_192res_1.0_inat_insect.pb");
let labels = include_str!("aiy_insects_V1_labelmap.txt");

let mut session = ssvm_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
let mut session = wasmedge_tensorflow_interface::Session::new(model_data, wasmedge_tensorflow_interface::ModelType::TensorFlow);
session.add_input("map/TensorArrayStack/TensorArrayGatherV3", &flat_img, &[1, 192, 192, 3])
.add_output("prediction")
.run();
Expand Down
2 changes: 1 addition & 1 deletion faas/mobilenet_plants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
ssvm_tensorflow_interface = "^0.1.3"
wasmedge_tensorflow_interface = "^0.2.2"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions faas/mobilenet_plants/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use wasmedge_tensorflow_interface;
use std::str;
use std::time::{Instant};

Expand All @@ -20,7 +20,7 @@ pub fn infer(image_data: &[u8]) -> String {
let model_data: &[u8] = include_bytes!("mobilenet_v2_192res_1.0_inat_plant.pb");
let labels = include_str!("aiy_plants_V1_labelmap.txt");

let mut session = ssvm_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
let mut session = wasmedge_tensorflow_interface::Session::new(model_data, wasmedge_tensorflow_interface::ModelType::TensorFlow);
session.add_input("map/TensorArrayStack/TensorArrayGatherV3", &flat_img, &[1, 192, 192, 3])
.add_output("prediction")
.run();
Expand Down
2 changes: 1 addition & 1 deletion faas/mtcnn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
ssvm_tensorflow_interface = "^0.1.3"
wasmedge_tensorflow_interface = "^0.2.2"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions faas/mtcnn/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use wasmedge_tensorflow_interface;
use image::{GenericImageView, Pixel};
use imageproc::drawing::draw_hollow_rect_mut;
use imageproc::rect::Rect;
Expand All @@ -20,7 +20,7 @@ pub fn infer(image_data: &[u8]) -> Vec<u8> {

let model_data: &[u8] = include_bytes!("mtcnn.pb");

let mut session = ssvm_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
let mut session = wasmedge_tensorflow_interface::Session::new(model_data, ssvm_tensorflow_interface::ModelType::TensorFlow);
session.add_input("min_size", &[20.0f32], &[])
.add_input("thresholds", &[0.6f32, 0.7f32, 0.7f32], &[3])
.add_input("factor", &[0.709f32], &[])
Expand Down

0 comments on commit d329eb9

Please sign in to comment.