To get help from the community, check out our Google group.
tensorflowjs 0.5.6
Dependency versions:
keras 2.1.6
tensorflow 1.9.0
Mac + Chrome 68.0.3440.84 64bit (Latest version)
With the latest version of tfjs, I can succssfully converte
ssd_mobilenet_v1_coco_2018_01_28 to web model and load it.
(This is the Object Detection model)
But when I try to run model.executeAsync(),
the error as below happened.
tf-converter.esm.js?:formatted:6254 Uncaught (in promise) Error: TensorArray dtype is float32 but tensor has dtype undefined
at e.scatter (tf-converter.esm.js?:formatted:6254)
at eval (tf-converter.esm.js?:formatted:6388)
at eval (tf-converter.esm.js?:formatted:144)
at Object.eval [as next] (tf-converter.esm.js?:formatted:157)
at eval (tf-converter.esm.js?:formatted:64)
at new Promise (<anonymous>)
at __awaiter (tf-converter.esm.js?:formatted:43)
at executeOp$2 (tf-converter.esm.js?:formatted:6295)
at executeOp$15 (tf-converter.esm.js?:formatted:6772)
at eval (tf-converter.esm.js?:formatted:7070)
The reproduce procedure is simple.
1. converte ssd_mobilenet_v1_coco_2018_01_28
2. load and run executeAsync()
My code is as below, it's written by React JSX:
componentDidMount = async () => {
this.model = new Model()
await this.model.load()
const tensor = tf.fromPixels(this.image).toFloat().expandDims(0)
this.model.model.executeAsync({
image_tensor: tensor,
}).then((result) => {
// TODO
})
}
@dsmilkov
I tried to read the sourcecode and find the error may happened in
tfjs-converter/src/executor/tensor_array.ts
scatter(indices: number[], tensor: Tensor) {
if (tensor.dtype !== this.dtype) {
throw new Error(`TensorArray dtype is ${
this.dtype} but tensor has dtype ${tensor.dtype}`);
}
// something else......
}
I set the breakpoint here and find the input parameter 'tensor' is not ts.Tensor but the Array.
So tensor.dtype is undefined.
Is this caused by my misuse or bugs?
Please help, thanks.
Can anybody help?
@pyu10055 Was this fixed in the converter? Feel free to reassign if I'm reading this wrong.
cc @pyu10055
Hi! There are several fixes coming up in the next few days to tfjs-converter which will make sure that the ssd_mobilenet_coco models run in TensorFlow.js. The working branch with the fixes is here. Stay tuned.
JS not support uint8? so model dtype set to undefined.
I wonder if this is fixed already? I see some commits on the coco-ssd branch, but still seem to be getting this error. It could be that I'm doing something wrong though.
Any way to work around this?
@dsmilkov Hi, I see the branch is merged. When will you release the next version with ssd mobilenet coco supported.
I converted with cloned repository. still same issue. will it be different after release
@santosh898 Is it because tfjs is not updated?
dependencies:
@tensorflow/tfjs-converter: 0.5.5 @tensorflow/tfjs-core: 0.12.8 @tensorflow/tfjs-layers: 0.7.2
All old versions.
I am putting out a PR with ssd_mobilenet_v1_coco_2018_01_28, which works with my example.
@pyu10055 Thanks very much and it also works perfect on my PC/cell phone.
BTW, this model cost 1200ms more or less on my 2017 i7 mac(Chrome latest version) and iPhonex(safari 11.4 webkit) to predict 300 * 400 image.
What's your performance, is there any way to enhance?
@116050423 I have a pending PR to improve the performance by 60%, it should be around 500ms now.
Closing this out since it looks like the issue is fixed. Please reopen if you are still seeing problems (or open another issue about performance).
I found this error with version 0.15.1 instead it works with 0.14.0
@naikno can you share the model where you鈥檙e having issues?
@pyu10055 can you take a look since this is coming up again?
@nsthorat i'm simply use coco-ssd from tensorflow-models, with version 0.1.1.
The error appears when i call coco.load method
Thanks, we鈥檒l take a look ASAP. For now can you use 0.14.1?
cc @dsmilkov
Hi @Naikno, the fix is in and we are going to release TF.js 0.15.3, which will happen by end of week (most likely Friday). At the same time, we will release new coco-ssd that depends on the 0.15.3. In the mean time, you have two options: use older version (0.14.1), or use the latest alpha release 1.0.0-alpha3
Closing this with https://github.com/tensorflow/tfjs-core/pull/1577