python - 机器学习: Converting bash script into Python

标签 python machine-learning tensorflow protocol-buffers

我按照在线图像分类教程使用 Tensorflow 创建了一个变体,该变体按珠宝类型对图像进行分类。一切都已启动并运行。目前我必须在终端中运行此脚本以在新图像上测试模型:

python -m scripts.label_image \
    --graph=tf_files/retrained_graph.pb  \
    --image=tf_files/jewellery_photos/new_images/1.jpg

它有效。

现在我想制作一个在线前端界面,用户可以在其中上传图像,脚本将运行,界面将显示它是什么类型的珠宝首饰。

1) 我如何将此机器学习脚本连接到前端...

a) Do I store the script in my front-end repository and call it
   when an image has been uploaded by the user? 

b) I need to convert the bash script into python. Do I have to 
   convert the retrained_graph.pb file into something else to be 
   able to import it as a module into a python file?

最佳答案

放到flask服务器上,做一个上传文件的接口(interface)。 逻辑和图形文件将驻留在该服务器上,每当上传文件时,运行该函数以给出结果。

关于python - 机器学习: Converting bash script into Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47470304/

相关文章:

python - 如何使用 pandas 将整个列字符串转换为数据框中的 float ?

r - 基于广播中播放的音乐流派分类

python - 机器学习算法将结果存储在哪里?

python - 如何创建字典类型列?

opencv - 我收到错误。我想反对计数

python - 处理类中的 tensorflow session

python - 以漂亮的格式打印字典键的简洁方法

python - 尝试使用Python计算单元格重复的次数(排除某些值)

python - 将浮点范围放入容器中

machine-learning - 结合其他模型中的单词创建词向量模型