The shape of dict['ToFloat'] provided in model.execute(dict) must be []
See original GitHub issueWhen using the latest model created by automl for tensorflowjs using https://cloud.google.com/vision/automl/object-detection/docs/edge-quickstart exactly.
Has anyone else seen this issue with exporting model from automl for tensorflowjs?
When running
const predictions = await model.detect(img, options);
Getting the following error:
util.js:109 Uncaught (in promise) Error: The shape of dict['ToFloat'] provided in model.execute(dict) must be [], but was [1,1280,1920,3]
at Ev (util.js:109)
at graph_executor.js:543
at Array.forEach (<anonymous>)
at e.t.checkInputShapeAndType (graph_executor.js:534)
at e.<anonymous> (graph_executor.js:332)
at u (runtime.js:45)
at Generator._invoke (runtime.js:274)
at Generator.forEach.e.<computed> [as next] (runtime.js:97)
at Um (runtime.js:728)
at o (runtime.js:728)
Using
"@tensorflow/tfjs": "^2.6.0",
"@tensorflow/tfjs-automl": "^1.0.0"
Full code
<script src="/node_modules/@tensorflow/tfjs/dist/tf.min.js"></script>
<script src="/node_modules/@tensorflow/tfjs-automl/dist/tf-automl.min.js"></script>
<img id="img" src="salad.jpg">
<script>
async function run() {
const model = await tf.automl.loadObjectDetection('/model/model.json');
const img = document.getElementById('img');
const options = { score: 0.5, iou: 0.5, topk: 20 };
console.log(model.dictionary);
const predictions = await model.detect(img, options);
console.log(predictions);
// Show the resulting object on the page.
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(predictions, null, 2);
document.body.append(pre);
}
run();
</script>
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
The shape of dict['ToFloat'] provided in model.execute(dict ...
This particular error is telling me that my shape must be an empty array or empty shape. Is that even possible? If this...
Read more >Error: The shape of dict['input_tensor'] provided in model ...
Hi, I converted my saved model to model json using ... Error: The shape of dict['input_tensor'] provided in model.execute(dict) must be [1 ...
Read more >The Shape Of Dict['Tofloat'] Provided In Model.Execute(Dict ...
This particular error is telling me that my shape must be an empty array or empty shape. Is that even possible? If this...
Read more >[Solved]-Error: The shape of dict['ToFloat'] provided in model ...
Coding example for the question Error: The shape of dict['ToFloat'] provided in model.execute(dict) must be [-1,-1,-1,3], but was [200150,3]-React Native.
Read more >The shape of dict['image'] provided in model.execute(dict ...
Is this a custom/modified mobilenet model? The error is letting you know that input named image must be a scalar (shape []) instead...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ghafran This has been fixed recently on the AutoML side, I will update this thread when the changes has been deployed. You might need to retrain the model on the autoML side.
This seems to be fixed now. Its working after re-training and exporting.