I've trained my own graph model. And I want to use it on browser. Here is my code:
async function predict() {
const model = await tf.loadGraphModel('./model/model.json');
let img = document.getElementById('test');
var example = tf.browser.fromPixels(img);
example = example.expandDims(0);
const output = await model.predict(example).data();
console.log(output);
}
When I run this, it gives this error on console:
Uncaught (in promise) Error: This execution contains the node 'SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/while/Exit_4', which has the dynamic op 'Exit'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_2/TensorArrayGatherV3]
at t.compile (tfjs:2)
at t.execute (tfjs:2)
at t.execute (tfjs:2)
at predict ((index):85)
at /websites/optik2/async http://localhost/websites/optik2/:96
I need predict() function, executeAsync() is not good as it is.
EDIT
Ok, I'm using as executeAsync now as @Jason Mayes says. But it's returning some values like that:
t {kept: false, isDisposedInternal: false, shape: Array(3), dtype: "float32", size: 1200, …}
rank: 3
isDisposed: false
kept: false
isDisposedInternal: false
shape: (3) [1, 300, 4]
dtype: "float32"
size: 1200
strides: (2) [1200, 4]
dataId: {}
id: 2198
rankType: "3"
scopeId: 3545
__proto__: Object
How can I get the bounding box of this?