我按照在线图像分类教程使用 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/