[英]How do I use the model Inception.tgz in TensorFlow?
我刚刚从tensorflow.org下载了inception.tgz文件,网址为http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz 。 但是,我不知道我应该在哪里提取这个。
此外,当我使用models / image / imagenet / classify_image.py脚本获取模型时,重新启动后模型未保存,因此我必须通过相同的脚本再次下载它。 我有时需要使用它我没有连接到互联网,所以每次我需要分类时下载模型对我来说并不理想。 我怎样才能一劳永逸地坚持这个模型?
另外,我如何使用.tgz初始模型?
我无法对你的问题发表评论,因为我还没有足够的学分。 那么,让我给你一个通用的答案。
您提到的inception-2015-12-05.tgz
文件包含两个您需要的文件:
a)imagenet_comp_graph_label_strings.txt
b)tensorflow_inception_graph.pb
还有一个您不需要的许可证文件。 这两个文件可以让您对图像进行预测。
你提到the model was not saved after a reboot, so I had to download it again via the same script
的部分在the model was not saved after a reboot, so I had to download it again via the same script
引起我的兴趣。 我从未遇到过这样的问题。 立即尝试:
~/Documents
。 classify_image.py
使用--model_dir
标志将模型文件目录重定向到~/Documents
。 这将基本上下载并提取必要的文件到指定的位置,从那以后你可以在--model_dir
标志中使用相同的位置。 看看这个:
Aruns-MacBook-Pro:imagenet arundas$ python classify_image.py --model_dir ~/Documents/
>> Downloading inception-2015-12-05.tgz 100.0%
Succesfully downloaded inception-2015-12-05.tgz 88931400 bytes.
W tensorflow/core/framework/op_def_util.cc:332] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.89233)
indri, indris, Indri indri, Indri brevicaudatus (score = 0.00859)
lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00264)
custard apple (score = 0.00141)
earthstar (score = 0.00107)
Aruns-MacBook-Pro:imagenet arundas$ python classify_image.py --model_dir ~/Documents/
W tensorflow/core/framework/op_def_util.cc:332] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.89233)
indri, indris, Indri indri, Indri brevicaudatus (score = 0.00859)
lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00264)
custard apple (score = 0.00141)
earthstar (score = 0.00107)
该模型未第二次下载。 希望这可以帮助。
默认情况下,映像模型会下载到/ tmp / imagenet,但您可以通过将--model_dir
命令行参数传递给--model_dir
来设置自己的文件夹: https : //github.com/tensorflow/tensorflow/blob/master /tensorflow/models/image/imagenet/classify_image.py#L56
因为它保存在临时目录中,所以每次关闭机器时都会将其删除。 尝试使用--model_dir
参数将文件保存到目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.