Error: TensorList shape mismatch: Shapes -1 and 3 must match
See original GitHub issueSystem information
- I’m trying to convert a TF Object Detection model to SavedModel and then TF.js without any customization
- I’m working on Colab to export the model and I load the converted model on Chrome.
- Chrome version 88.0.4324.146 (Official Build) (64-bit)
- TensorFlow.js installed from yarn
- tfjs-core: ^3.0.0
- tfjs-converter: ^3.0.0
- TF 2.4.1
- Python 3.6.9
I’m currently trying to convert to TF.js one of the Object Detection models from the TF2 OD ZOO, in particular SSD MobileNet V2 FPNLite 320x320.
When I convert the model pre-existing SavedModel to TF.js from the saved_model folder I’m able to import it in my browser and launch it through executeAsync(). If I keep the original pipeline.config and try to create another SavedModel from the provided checkpoint using this line
python exporter_main_v2.py --input_type image_tensor \
--pipeline_config_path ./pre-trained-models/ssd320/pipeline.config \
--trained_checkpoint_dir ./pre-trained-models/ssd320/checkpoint_0 \
--output_directory ./pre-trained-models/ssd320/exported_model
after I convert it to TF.js with the following line
tensorflowjs_converter \
--input_format=tf_saved_model \
--saved_model_tags=serve \
./pre-trained-models/ssd320/path-to-savedmodel-folder \
./pre-trained-models/tfjs_test
I encounter the following error when I try to launch the inference on my browser
util_base.js?a6b2:141 Uncaught (in promise) Error: TensorList shape mismatch: Shapes -1 and 3 must match
at Module.assert (util_base.js?a6b2:141)
at assertShapesMatchAllowUndefinedSize (tensor_utils.js?74aa:24)
at TensorList.setItem (tensor_list.js?41f7:182)
at Module.executeOp (control_executor.js?de9e:188)
at eval (operation_executor.js?be85:52)
at executeOp (operation_executor.js?be85:94)
at GraphExecutor.processStack (graph_executor.js?33ef:390)
at GraphExecutor.executeWithControlFlow (graph_executor.js?33ef:350)
at async GraphExecutor._executeAsync (graph_executor.js?33ef:285)
at async GraphModel.executeAsync (graph_model.js?9724:316)
I tried with SSD MobileNet v2 320x320 (no FPN here) and the outcome is the same. I’m starting to think that it may be connected to the use of exporter_main_v2.py but I wouldn’t know how to convert the model without it.
Could you please help me figure out something more about the cause of this issue?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:16
Top GitHub Comments
I have the same exact error when training the model using the object detection API. all works fine right to the point where I convert the model to TFJS. after loading an image I got the error: TensorList shape mismatch: Shapes -1 and 3 must match
I’ve been working for a week. This error appears to be from open source applications that were not in previous versions. I even tried from old models. They are working. But the one I just created doesn’t work.
This error continues. How do we fix this?