admin管理员组文章数量:1335871
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
2 Answers
Reset to default 3As 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!
本文标签: javascriptConvert a saved h5 file to a JSON fileStack Overflow
版权声明:本文标题:javascript - Convert a saved .h5 file to a JSON file - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742396932a2467114.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论