我如何将从 google 的 teachablemachine 保存的 tensorflow.js 模型转换为 keras.hdf5 或 tflite 模型?

How can i convert a tensorflow.js model saved from google's teachablemachine to a keras.hdf5 or tflite model?

保存的tensorflow.js模型由以下3个文件组成。

  1. metadata.json
  2. model.json
  3. weights.bin

您可以使用 TensorFlow.js converter library 在格式之间进行转换

它不会转换为 TFLite,但它应该允许您从 TensorFlow.js to Keras 转换。例如:

tensorflowjs_converter \
    --input_format tfjs_layers_model \
    --output_format keras \
    tfjs_model/model.json \
    keras_model/