Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Yuan <[email protected]>
  • Loading branch information
juntao authored Jul 20, 2022
1 parent 9ea8c6e commit 5e887af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions example_js/tensorflow_lite_demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {Image} from 'image';
import * as std from 'std';
import {TensorflowLiteSession} from 'tensorflow_lite';

let img = new Image('food.jpg');
let img = new Image(__dirname + '/food.jpg');
let img_rgb = img.to_rgb().resize(192, 192);
let rgb_pix = img_rgb.pixels();

let session = new TensorflowLiteSession(
'lite-model_aiy_vision_classifier_food_V1_1.tflite');
__dirname + '/lite-model_aiy_vision_classifier_food_V1_1.tflite');
session.add_input('input', rgb_pix);
session.run();
let output = session.get_output('MobilenetV1/Predictions/Softmax');
Expand All @@ -21,7 +21,7 @@ for (var i in output_view) {
max_idx = i;
}
}
let label_file = std.open('aiy_food_V1_labelmap.txt', 'r');
let label_file = std.open(__dirname + '/aiy_food_V1_labelmap.txt', 'r');
let label = '';
for (var i = 0; i <= max_idx; i++) {
label = label_file.getline();
Expand Down

0 comments on commit 5e887af

Please sign in to comment.