Cannot load json model in nodered

Hi I want to know why I cannot load my mode.json from local file. I have attached the screenshot of this.



pls suggest me on that. Thank you.

Did you check for the property the error is indicating ?

I don't quite understand your suggestion. So what I did was I created the image classification model in tensorflow, then I change this hdf5 model to model.json file.Then I loaded the .json file in tf.model node.

The tensorflow node is looking for a property called "producer" in the json, which it cannot find.

sorry that I still don't get it. For me, I just convert tensorflow model to tensorflow.js using model conversion(Model conversion  |  TensorFlow.js), but then I load model.json into tt.model node. I still don't know how to proceed with that. I would be more appreciate if you can guide me step by step troubleshoot,

can you post your tensorflow.js? In order to make code more readable and importable it is important to surround your code with three backticks
```
like this
```

See this post for more details - How to share code or flow json


[{"id":"453c3fa4.ad135","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"62ab9935.52dea8","type":"tf-model","z":"453c3fa4.ad135","modelURL":"file:///home/pi/Downloads/model.json","outputNode":"","name":"","x":670,"y":40,"wires":[["9971b303.8badf"]]},{"id":"9971b303.8badf","type":"debug","z":"453c3fa4.ad135","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1040,"y":220,"wires":[],"info":"{\n    payload:{\n        image_tensor: image\n    }\n}"},{"id":"5ef20a9c.342084","type":"inject","z":"453c3fa4.ad135","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":490,"y":140,"wires":[["62ab9935.52dea8"]]}]

Ok, if you do a string search of that file and look for 'producer' it doesn't show up. The node (you never specified what node you are using - i.e. node-red-contrib.???) must be looking for it and is throwing an error since it is not there.

You could ask the author of the node (on gitHub) about it. Or add it to your model.json.

Does producer exist as property in model.json ?

Hi I am using node-red-contrib-tf.model. And I have asked about it to the author but no reply yet. And so if I want to add it in model.json, how to add that?

No, I didn't see producer in model.json.

Is there anyway that I can load my custom image classification model in nodered?

I would expect you could edit the fie and add it HOWEVER, I am not familiar with tensor models so I can't tell you where it should go or what it should contain. Sorry.

thanks anyway.

Actually, I don't know how to find that. Do suggest me if you know how to do that. Anyway, you know how to make a custom image classifier with your own model, not the pre-builtin model. Because I still cannot find the clear explanation on how to do that in nodered.

Actually, I don't know how to find that. Do suggest me if you know how to do that. Anyway, you know how to make a custom image classifier with your own model, not the pre-builtin model. Because I still cannot find the clear explanation on how to do that in nodered.

{"format": "layers-model", "generatedBy": "keras v2.5.0", "convertedBy": "TensorFlow.js Converter v3.8.0", "modelTopology": {"keras_version": "2.5.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 1], "dtype": "float32", "sparse": false, "ragged": false, "name": "dense_input"}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "batch_input_shape": [null, 1], "dtype": "float32", "units": 1, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}}, "training_config": {"loss": "mean_squared_error", "metrics": null, "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "SGD", "config": {"name": "SGD", "learning_rate": 0.009999999776482582, "decay": 0.0, "momentum": 0.0, "nesterov": false}}}}, "weightsManifest": [{"paths": ["group1-shard1of1.bin"], "weights": [{"name": "dense/kernel", "shape": [1, 1], "dtype": "float32"}, {"name": "dense/bias", "shape": [1], "dtype": "float32"}]}]}```

This is what inside model.json file. Along with that, .h5 file and .bin file.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.