javascript - Convert a saved .h5 file to a JSON file - Stack Overflow

I used a pre-made model with Keras for training a data-set about URLs. results are saved in a .h5 forma

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.

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.

Share Improve this question edited Mar 22, 2019 at 0:34 Rishabh Bhargava 376 bronze badges asked Mar 21, 2019 at 23:33 Alexander WazowskiAlexander Wazowski 911 gold badge1 silver badge5 bronze badges 3
  • You can refer to the answers at here: stackoverflow./questions/28170623/… – Han Wang Commented Mar 21, 2019 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 Commented Mar 21, 2019 at 23:51
  • You can refer the answers here for saving as json: stackoverflow./questions/12309269/… – Manoj Mohan Commented Mar 22, 2019 at 17:42
Add a ment  | 

2 Answers 2

Reset to default 3

As mentioned in https://www.tensorflow/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 mand:

tensorflowjs_converter --input_format=keras /tmp/model.h5 /tmp/tfjs_model

At first

!sudo pip3 install tensorflowjs

Then

!sudo tensorflowjs_converter

Just replace model.h5 with your trained weight

!tensorflowjs_converter --input_format=keras '/content/drive/MyDrive/model.h5' "/content/drive/MyDrive/json"

you are good to go your file will me converted!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742396933a4436137.html

相关推荐

  • javascript - Convert a saved .h5 file to a JSON file - Stack Overflow

    I used a pre-made model with Keras for training a data-set about URLs. results are saved in a .h5 forma

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信