I am trying to export a custom model made with TensorflowJS to Tensorflow Python. The main problem is that TF.JS saves two artifacts: "model-js.json" and "model-js.weights.bin"
I tried importing the JSON:
with open('model-js/model-js.json') as json_file:
json_config = str(json.loads(json_file.read())["modelTopology"])
json_config=json_config.replace("'","\"")
new_model = tf.keras.models.model_from_json(json_config)
But I am getting the next error:
~\anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
So, the line 103 in the Json File is the "N" in the "Null" of:
"config": {
"batch_input_shape": [
null,
128,
128,
1
],
"dtype": "float32",
"sparse": false,
"name": "conv2d_input"
}
That is later changed "Null" for "None" when you import the JSON to python.
Why the TensorflowJS model artifacts doesnt fit in Python Tensorflow?
Other thing is that I dont know how to import the weights in the .bin file. There are some other ways to do that? Or there are other kinds of files that can be exported from TF.JS?
Thanks in advance