1.git clone到本地
git clone https://github.com/tensorflow/tensorflowxcode
2.compile static library
安装xcode command line: xcode-select --install
安装依赖包: brew install automake brew install libtool
安装automake时,autoconf下载失败,自己编译安装. cd autoconf-2.65 ./configure --prefix=/usr/local make sudo make install autoconf -V autoconf编译安装后,brew依然卡在下载autoconf. 参考:http://blog.csdn.net/x32sky/article/details/42710063 同样自己编译安装和libtool automake --version
下载graph:
mkdir -p ~/graphs curl -o ~/graphs/inception.zip https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip unzip ~/graphs/inception.zip -d ~/graphs/inception
使用curl下载太慢,直接输入网址下载,解压后文件夹改名为inception.
3.一键编译
tensorflow/contrib/makefile/build_all_ios.sh 下载dependencies时可能比较慢,等等就好。也可以自己下载后放到tensorflow/contrib/makefile/downloads下,
各目录名字为eigen、gemmlowp、googletest、protobuf、re2
最终在 tensorflow/contrib/makefile/gen/lib/ 下生成.a文件
TensorFlow iOS Examples流程
1.~/graphs/inception已经下好,copy到ios_examples
cp ~/graphs/inception/* tensorflow/contrib/ios_examples/benchmark/data/ cp ~/graphs/inception/* tensorflow/contrib/ios_examples/camera/data/ cp ~/graphs/inception/* tensorflow/contrib/ios_examples/simple/data/
打开xcode工程编译运行即可。。。