I am new to the TensorFlow and JS.
I was trying to convert the MobileNet V2 model from keras to tensorflow.js
When I try to load model into JS, I get the following error:
`errors.ts:48 Uncaught (in promise) Error: Unknown layer: Functional. This may be due to one of the following reasons:
I construct my model with a MobileNet V2 pre-trained model and add two layers on top of it. And I convert the model using tensorflowjs_converter with a saved h5 file of the model.
Here is my model summary. The mobilenetv2_1.00_160 with a type of functional and I believed is the cause of the error.
Model: "sequential"
Layer (type)// Output Shape// Param #
mobilenetv2_1.00_160 (Functi (None, 5, 5, 1280)// 2257984
global_average_pooling2d (Gl (None, 1280) 0
dense (Dense) (None, 3755) 4810155
Total params: 7,068,139
Trainable params: 7,034,027
Non-trainable params: 34,112
I had an issue like this albeit im using MobileNet not v2. I don't have the specific link, but a stack overflow thread somewhere said to go into the public/model.json folder and ctrl+f "Functional" and replace the word with "Model". worked for me!
Replace the "Functional" with "Model" indeed solve this error. However, it also gives me the new error as following:
Uncaught (in promise) Error: computeMask has not been implemented for Merge yet
@KailiangGu @lospericos I was able to reproduce the same for my model conversion, @pyu10055 can you please assist with this bug ?
@KailiangGu have you tried to convert the HDF5 model to TFJS graph model?
The same issue with Keras MobileNet v1. Replacing the word with "Model" worked for me, thanks!
@pyu10055 i tried to convert with TFJS graph model and no issues , i used the command
!tensorflowjs_converter --input_format keras --output_format=tfjs_graph_model my_sample_model.h5 model/
@KailiangGu @starrabb1t can you please try using TFJS Graph model
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 dyas if no further activity occurs. Thank you.
I had an issue like this albeit im using MobileNet not v2. I don't have the specific link, but a stack overflow thread somewhere said to go into the public/model.json folder and ctrl+f "Functional" and replace the word with "Model". worked for me!
Where is this public/model.json folder located?
Most helpful comment
I had an issue like this albeit im using MobileNet not v2. I don't have the specific link, but a stack overflow thread somewhere said to go into the public/model.json folder and ctrl+f "Functional" and replace the word with "Model". worked for me!