8

I used a pre-made model with Keras for training a data-set about URLs. results are saved in a .h5 format and I am wondering if I could convert that saved .h5 file to JSON so that I could see the results and apply the JSON file in my system that separates bad URLs from good URLs. I also want to avoid re-training again if possible.

  • You can refer to the answers at here: https://stackoverflow.com/questions/28170623/how-to-read-hdf5-files-in-python – Han Wang Mar 21 '19 at 23:38
  • I needed it to convert to json so that I could call that json file using javascript and get the data from it – Alexander Wazowski Mar 21 '19 at 23:51
  • You can refer the answers here for saving as json: https://stackoverflow.com/questions/12309269/how-do-i-write-json-data-to-a-file – Manoj Mohan Mar 22 '19 at 17:42

1 Answers1

3

As mentioned in https://www.tensorflow.org/js/guide/conversion

For example, let’s say you have saved a Keras model named model.h5 to your tmp/ directory. To convert your model using the TensorFlow.js converter, you can run the following command:

tensorflowjs_converter --input_format=keras /tmp/model.h5 /tmp/tfjs_model
desertnaut
  • 52,940
  • 19
  • 125
  • 157
Arun P
  • 33
  • 7