Dar*_*ina 7 java tensorflow tensorflow2.0
无法在 Google 上找到答案,这里提出的问题似乎都很接近,但又不尽相同。对不起,如果我忽略了什么。
目前是否已经可以在 Java 8 中加载用 Python TensorFlow 2.0.0-beta1 编写的模型?该模型将使用 Keras Sequential API。如果这是可能的,我感谢指向适当文档的指针。
如果您首先将模型转换为 tflite 文件,如下所述,您可以完成此操作:
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model_file("keras_model.h5")
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
Run Code Online (Sandbox Code Playgroud)
然后您可以按照此处所述加载并运行:
public Interpreter(@NotNull File modelFile);
try (Interpreter interpreter = new Interpreter(file_of_a_tensorflowlite_model)) {
interpreter.run(input, output);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1341 次 |
| 最近记录: |