I just downloaded the inception.tgz file from tensorflow.org at http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz . But, I do not know where I should extract this.
Also, when I used the models/image/imagenet/classify_image.py script to get the model, the model was not saved after a reboot, so I had to download it again via the same script. I need to use it at times I am not connected to the Internet, so downloading the model everytime I need to classify is not ideal for me. How can I persist the model once and for all?
Also, how can I use the .tgz inception model?
I cannot make a comment to your Question since I do not have enough credits yet. So let me give you a generic answer.
The inception-2015-12-05.tgz
file you mentioned contains two files which you require:
a) imagenet_comp_graph_label_strings.txt
b) tensorflow_inception_graph.pb
There is a license file that you won't require as well. These two files will let you make predictions on images.
The part where you mentioned the model was not saved after a reboot, so I had to download it again via the same script
intrigues me. I have never come across such an issue. Try this now:
~/Documents
. classify_image.py
use the --model_dir
flag to redirect the model file directory to ~/Documents
. This will essentially download and extract the necessary files to the specified location and you can use the same location in --model_dir
flag ever since. Take a look at this:
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)
The model was not downloaded the second time. Hope this helps.
默认情况下,映像模型会下载到/ tmp / imagenet,但您可以通过将--model_dir
命令行参数传递给--model_dir
来设置自己的文件夹: https : //github.com/tensorflow/tensorflow/blob/master /tensorflow/models/image/imagenet/classify_image.py#L56
because it is saved in a temp directory, everytime you shut the machine down, it is removed. try saving the file to a directory using the --model_dir
parameter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.