首页 \ 问答 \ 使用Google Cloud Machine Learning服务来预测本地重新训练的Inception模型(Use Google Cloud Machine Learning service to predict with a locally retrained Inception model)

使用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
更新时间:2023-12-07 16:12

最满意答案

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 looking for

Check the examples:

>>> import glob
>>> glob.glob('./[0-9].*')
['./1.gif', './2.txt']
>>> glob.glob('*.gif')
['1.gif', 'card.gif']
>>> glob.glob('?.gif')
['1.gif']

You can use optparse or just sys.argv to get arguments. And pass them to glob.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)