TensorFlow 研究实践 三
发布日期:2021-05-06 19:00:13 浏览次数:20 分类:技术文章

本文共 2004 字,大约阅读时间需要 6 分钟。

TensorFlow在图像识别中的应用

参考资料:

C++ API的使用方法

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

wget -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.zipResolving storage.googleapis.com (storage.googleapis.com)... 216.58.199.16, 2404:6800:4005:803::2010Connecting to storage.googleapis.com (storage.googleapis.com)|216.58.199.16|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 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 foundcompilation terminated.INFO: Elapsed time: 5572.445s, Critical Path: 5407.48slearning@learning-virtual-machine:~/tensorflow$

这里写图片描述

上一篇:Caffe研究实践 一 ------环境搭建
下一篇:图像算法工程师三重境界

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2025年03月21日 13时09分28秒