question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tensorflowjs_convertor fails during inverse transformation

See original GitHub issue

To get help from the community, check out our Google group.

tensorflow==1.8.0 Keras==2.1.4 @tensorflow/tfjs": “0.12.0” Google Chrome, Version 67.0.3396.99 (Official Build) (64-bit)

I’ve tried to convert yolo model to tensorflow.js and used keras-yolo3 script which build keras model from darknet cfg and weight files. And It works pretty well with keras. Then I convert [.h5] model to tensorflow.js using tenserflowjs_converter and got a strange error:

Error: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got input shapes: [[null,0,0,128],[null,null,null,256]]

Seems that tfjs_converter set 0 shapes to UpSampling2D layer. I also investigated that tfjs_converters fails during inverse transformation with:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes must be equal rank, but are 1 and 4 for ‘Assign_3’ (op: ‘Assign’) with input shapes: [16], [3,3,16,32].

I think It should be some consistency between this two processes.

To reproduce download yolo-tiny.cfg and yolo-tiny.weight :

1. git clone https://github.com/qqwweee/keras-yolo3
2. Run python convert.py yolo-tiny.cfg yolo-tiny.weights model_data/yolo-tiny.h5
3. tensorflowjs_converter --input_format=keras --output_format=tensorflowjs model_data/yolo-tiny.h5 model_data/tfjs
4. You could try load model with tfjs and you'll get my first error...
5. tensorflowjs_converter --input_format=tensorflowjs --output_format=keras model_data/tfjs/model.json model_data/smth.h5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
caisqcommented, Jul 19, 2018

FYI, the 1st error is fixed by https://github.com/tensorflow/tfjs-layers/pull/262, and the fix is available in the latest release of @tensorflow/tfjs version 0.12.3.

We will send a PR to fix the 2nd error soon.

0reactions
caisqcommented, Jul 29, 2018

@bielanm FYI, the latest release of the pip package of tensorflowjs (0.5.4) incorporates the fix to your 2nd issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model conversion | TensorFlow.js
The TensorFlow.js converter has two components: A command line utility that converts Keras and TensorFlow models for use in TensorFlow.js.
Read more >
TensorFlow.js — Making Predictions from 2D Data
You will make a webpage that uses TensorFlow.js to train a model in the browser. Given "Horsepower" for a car, the model will...
Read more >
Tensorflow.js tf.spectral.ifft () Function - GeeksforGeeks
spectral.ifft() function is used for IFFT(Inverse Fast Fourier transform) i.e. it computes the inverse 1-dimensional DFT(discrete Fourier ...
Read more >
JavaScript for Machine Learning using TensorFlow.js
In the same folder as the HTML file above, create a file called script.js and put the following code in it. console.log('Hello TensorFlow'); ......
Read more >
Transform Data - Amazon SageMaker - AWS Documentation
Choose Error if you want Data Wrangler to throw an error if missing values are encountered in the Input column. Is input ordinal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found