最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论