TensorFlow 研究实践 三

TensorFlow在图像识别中的应用
参考资料:http://www.csdn.net/article/2015-12-16/2826496?_t=t

C++ API的使用方法
用C++运行同样的Inception-v3模型
一、下载定义模型的GraphDef文件(在TensorFlow的根目录下运行):

wget https://storage.googleapis.com/download.tensorflow.org/models/inception_dec_2015.zip -O tensorflow/examples/label_image/data/inception_dec_2015.zip
这里写图片描述

learning@learning-virtual-machine:~/tensorflow$ wget https://storage.googleapis.com/download.tensorflow.org/models/inception_dec_2015.zip -O tensorflow/examples/label_image/data/inception_dec_2015.zip
--2016-05-10 11:13:05--  https://storage.googleapis.com/download.tensorflow.org/models/inception_dec_2015.zip
Resolving storage.googleapis.com (storage.googleapis.com)... 216.58.199.16, 2404:6800:4005:803::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|216.58.199.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 88631107 (85M) [application/zip]
Saving to: ‘tensorflow/examples/label_image/data/inception_dec_2015.zip’

tensorflow/examp 100%[===========>]  84.52M  4.50MB/s   in 18s    

2016-05-10 11:13:24 (4.70 MB/s) - ‘tensorflow/examples/label_image/data/inception_dec_2015.zip’ saved [88631107/88631107]

unzip tensorflow/examples/label_image/data/inception_dec_2015.zip -d tensorflow/examples/label_image/data/

这里写图片描述

二、编译加载和运行模型的C++代码。
下载并安装TensorFlow,在shell终端执行命令编译例子:

bazel build tensorflow/examples/label_image/…

这里写图片描述

三、生成二进制可执行程序,然后运行:

bazel-bin/tensorflow/examples/label_image/label_image

出现问题,待解决

ERROR: /home/learning/tensorflow/tensorflow/cc/BUILD:28:1: Linking of rule '//tensorflow/cc:ops/candidate_sampling_ops_gen_cc' failed: gcc failed: error executing command /usr/bin/gcc -o bazel-out/host/bin/tensorflow/cc/ops/candidate_sampling_ops_gen_cc -pthread -no-canonical-prefixes -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' ... (remaining 3 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
gcc.real: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
compilation terminated.
INFO: Elapsed time: 5572.445s, Critical Path: 5407.48s
learning@learning-virtual-machine:~/tensorflow$ 

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值