首先,我在spring框架中有这个java程序试图调用一个简单的hello world python脚本 .
它工作并返回"hello world"
然后我试着运行一个嵌入了tensorflow库的python脚本,然后它什么也没有返回 . (控制台中没有打印)
python tensorflow
import tensorflow as tf import sys import os
os.environ ['TF_CPP_MIN_LOG_LEVEL'] ='2'导入张量流为tf
image_path = sys.argv [1] image_data = tf.gfile.FastGFile(image_path,'rb') . read()
label_lines = [line.rstrip()for tf.gfile.GFile中的行(“logs / trained_labels.txt”)]
用tf.gfile.FastGFile(“logs / trained_graph.pb”,'rb')作为f:graph_def = tf.GraphDef()graph_def.ParseFromString(f.read())_ = tf.import_graph_def(graph_def,name =' “)
使用tf.Session()作为sess:
softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')
predictions = sess.run(softmax_tensor, \
{'DecodeJpeg/content