使用Google Cloud Machine Learning服务来预测本地重新训练的Inception模型(Use Google Cloud Machine Learning service to predict with a locally retrained Inception model)
我使用来自Google Code Lab TensorFlow for Poets的retrain.py文件在本地重新训练了Inception模型,并希望使用Google Cloud机器学习服务进行预测。
具体来说,我想修改retrain.py文件,所以我的TensorFlow应用程序已准备就绪
gcloud beta ml预测--instances = INSTANCES --model = MODEL
(即仅预测;不需要Google Cloud ML培训ala gloud beta ml工作提交培训)。
我从概念上理解必须按照准备模型中的描述修改retrain.py文件。
但是没有完整的答案显示在修改后的retrain.py文件中的所有代码行。 Google Code Lab TensorFlow for Poets和Pete Warden关于再培训Inception的截屏的受欢迎程度使得人们期望这是TensorFlow社区中图像分类的一个非常常见的例子。 这意味着答案将使社区中的许多人受益。
有人会在按照准备模型中的描述进行修改后回复他们的版本的retrain.py文件吗?
注1:我已经研究了我的问题,以确认它没有得到答复......
... Davide Biraghi提出并由JoshGC回答的问题“Q:如何预测谷歌机器学习中的图像”并未显示对重新训练Google Code Lab TensorFlow for Poets中的Inception模型的retrain.py文件的任何修改。
...... KlezFromSpace提出并由rhaertel80回答的问题(由Robert Lacok提供有用的评论)“Q:在Google云计算机上学习部署Retrained inception模型”在修改后没有显示retrain.py文件中的所有代码行:确定产出; 创造投入; 支持可变批量大小; 使用实例键; 将输入和输出集合添加到图形中; 和导出(保存)最终模型。 (参见上面的准备模型。)
...... Vinkeet Kaushik提出的问题和Robert Lacok的回答(mrry的有用评论)“问:将基本的Tensorflow模型导出到Google Cloud ML”并不特定于重新训练Google Code Lab中的Inception模型的retrain.py文件TensorFlow为诗人。
注2:我假设要进行预测的jpeg图像是
gcloud beta ml预测--instances = INSTANCES --model = MODEL
其中INSTANCES是一个JSON文件的路径,其中包含有关图像的信息,根据Davide Biraghi提出的问题并由rhaertel80回答“Q:如何在Google机器学习中将jpeg图像转换为json文件”
注3:我假设我将手动存储由修改后的retrain.py文件保存的EXPORT和EXPORT.META文件,该文件位于我用于在Google Cloud Console中创建MODEL的URL。
I have locally retrained the Inception model using the retrain.py file from Google Code Lab TensorFlow for Poets and want to use Google Cloud machine Learning service to make predictions.
Specifically, I want to modify the retrain.py file, so my TensorFlow application is prepared for
gcloud beta ml predict --instances=INSTANCES --model=MODEL
(i.e., prediction only; no need for Google Cloud ML training ala gloud beta ml jobs submit training).
I understand conceptually that the retrain.py file must be modified as described in Preparing a Model.
But there is no complete answer showing all the lines of code in the retrain.py file after being modified. And the popularity of Google Code Lab TensorFlow for Poets and Pete Warden’s screencasts about retraining Inception makes one expect this to be a very common example of image classification among the TensorFlow community; which means an answer will benefit many in the community.
Will someone please answer with their version of the retrain.py file after being modified as described in Preparing a Model?
Note 1: I have researched my question to confirm it has not been answered…
… The question asked by Davide Biraghi and answered by JoshGC “Q: How predict an image in google machine learning” does not show any modifications to the retrain.py file that retrains the Inception model in Google Code Lab TensorFlow for Poets.
… The question asked by KlezFromSpace and answered by rhaertel80 (with helpful comments by Robert Lacok) “Q: Deploy Retrained inception model on Google cloud machine learning” does not show all the lines of code in the retrain.py file after being modified for: Defining outputs; Creating inputs; Supporting variable batch sizes; Using instance keys; Adding input and output collections to the graph; and Exporting (saving) the final model. (See above Preparing a Model.)
… The question asked by Vinkeet Kaushik and answered by Robert Lacok (with helpful comments by mrry) “Q: Export a basic Tensorflow model to Google Cloud ML” is not specific to the retrain.py file that retrains the Inception model in Google Code Lab TensorFlow for Poets.
Note 2: I assume the jpeg image for which prediction is to be made is
gcloud beta ml predict --instances=INSTANCES --model=MODEL
where INSTANCES is the path to a JSON file with information about the image as per the question asked by Davide Biraghi and answered by rhaertel80 “Q: How convert a jpeg image into json file in Google machine learning”
Note 3: I assume I will manually store the EXPORT and EXPORT.META files saved by the modified retrain.py file at the URL I use to create MODEL in Google Cloud Console.
原文:https://stackoverflow.com/questions/41023733
最满意答案
相关问答
更多-
正则表达式从函数定义中获取参数列表[复制](Regular Expression to get parameter list from function definition [duplicate])[2023-09-05]
最简单的事情是捕获第一组参数中的所有内容,然后使用split(/\s*,\s*/)来获取数组。 例如: var str = "function( one ,\ntwo,three , four ) { laksjdfl akjsdflkasjdfl }"; var args = /\(\s*([^)]+?)\s*\)/.exec(str); if (args[1]) { args = args[1].split(/\s*,\s*/); } snippet.log("args: ... -
使用str.split , myLst = ['5-8','20130-23199','1025-2737'] result = [s.split('-') for s in myLst] print(result) #[['5', '8'], ['20130', '23199'], ['1025', '2737']] Use str.split, myLst = ['5-8','20130-23199','1025-2737'] result = [s.split('-') for s in my ...
-
编译顺序和帖子前缀opertors的答案也回答了你的问题。 以下是摘要。 一般来说,避免在表达式[1]中设置和读取变量的情况。 您的代码执行以下操作: 你设置$1 。 您在堆栈上放置一个字符串和$1 。 (不是$1的副本!) 你设置$1 。 您在堆栈上放置一个字符串和$1 。 你设置$1 。 您在堆栈上放置一个字符串和$1 。 您将堆栈的内容(字符串, $1 ,字符串, $1 ,字符串, $1 ) @tt到@tt 。 $1是3 。 您可以使用"$1"而不是$1解决此问题,因为"$1"会从$1构建一个新字符串 ...
-
您可以查看Pattern类的javadoc: http : //docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html 如果你想要正常的字符而不是特殊的意义,你需要逃避任何列在那里的字符。 作为一个可能更简单的解决方案,您可以将模板放在\ Q和\ E之间 - 它们之间的一切都被视为转义。 You can look at the javadoc of the Pattern class: http://docs.oracle.com/jav ...
-
它看起来对我很好,但我会尝试使用$1而不是\1 。 \1通常用于正则表达式本身,很少用于替换模式。 It looks pretty good for me, but I would try tu use $1 instead of \1. \1 is usually used in the regex itself, rarely in the replacement pattern.
-
你可以用下面的方式组合正则表达式: import re dict_month_name =['january','february','march','april','may','june','july','august','september','october','november','december'] dict_day =['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] dict_special_cha ...
-
Java Regex - 尝试使用正则表达式获取“函数”参数数组(Java Regex - Trying to use regex to get an array of “function” arguments)[2024-04-23]
我不认为这可以单独使用正则表达式来完成。 这可能需要能够识别平衡的括号 - 例如,一旦我们解析了f1(f2(x) ,下一个字符可能是a )或a , - 这是一个可以'的事情的典型例子'使用正则表达式完成,但需要更复杂的解析器。 I don't think this can be done with regexes alone. This would probably require being able to identify balanced parentheses -- for example, onc ... -
我想如果你真的想从一个字符串开始(而不是像其他建议的那样的数组),你可以这样做: 在PHP 5.3中: $params = "'this is, parameter 1', 'this is parameter2'"; $paramsarray = str_getcsv($params, ',', "'"); 在PHP 5.1 / 5.2中: $fp = fopen('php://temp', 'w+'); fwrite($fp, $params); fseek($fp, 0); $paramsarray ...
-
glob模块正是您正在寻找的 检查示例: >>> import glob >>> glob.glob('./[0-9].*') ['./1.gif', './2.txt'] >>> glob.glob('*.gif') ['1.gif', 'card.gif'] >>> glob.glob('?.gif') ['1.gif'] 您可以使用optparse或只使用sys.argv来获取参数。 并将它们传递给glob。 The glob module is exactly what you are looki ...
-
正则表达式列表比较?(regex for list comparing?)[2023-04-27]
它不是一个正则表达式,但它比任何人都可能简单得多。 var attributes = input.Split(","); var testCase = test.Split(","); return attributes.All(x => testCase.Contains(x)) && testCase.All(x => attributes.Contains(x); 如果找到*,请忽略&&表达式的一半。 It's not a regular expression, but it's much sim ...