我们可以运行tensorflow在Linux精简版?或者,它是Android和IOS只

问题描述 投票:2回答:3

你好是否有可能运行在Linux平台上tensorflow精简版?如果是的话,那么我们如何能够用Java编写/ C ++ / Python代码加载和Linux平台上运行的模式?我所熟悉的巴泽尔和使用tensorflow精简版成功地进行了Android和iOS应用。

linux tensorflow-lite
3个回答
1
投票

Tensorflow lite

TensorFlow精简版是TensorFlow对移动和嵌入式设备的轻量级解决方案。

Tensorflow精简版是tensorflow的针对嵌入式设备的叉。对于PC只需使用原有tensorflow。

github tensorflow

TensorFlow是一个开源软件库

TensorFlow提供了稳定的API的Python和C的API,以及没有像C ++,围棋,Java,JavaScript以及斯威夫特API向后兼容性的保证。

我们支持在Linux,Mac和Windows的CPU和GPU封装。

>>> import tensorflow as tf
>>> tf.enable_eager_execution()
>>> tf.add(1, 2)
3
>>> hello = tf.constant('Hello, TensorFlow!')
>>> hello.numpy()
'Hello, TensorFlow!'

1
投票

这是可能的运行(但它会工作较慢,比原来的TF)

# Load TFLite model and allocate tensors.
interpreter = tf.lite.Interpreter(model_path=graph_file)
interpreter.allocate_tensors()

# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

# Get quantization info to know input type
quantization = None
using_type = input_details[0]['dtype']
if dtype is np.uint8:
    quantization = input_details[0]['quantization']

# Get input shape
input_shape = input_details[0]['shape']

# Input tensor
input_data = np.zeros(dtype=using_type, shape=input_shape)

# Set input tensor, run and get output tensor
interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
output_data = interpreter.get_tensor(output_details[0]['index'])

0
投票

是的,你可以编译Tensorflow精简版,甚至与码头工人,容器在Linux平台上运行。观看演示:https://sconedocs.github.io/tensorflowlite/

© www.soinside.com 2019 - 2024. All rights reserved.