Integrated TensorFlow
TensorFlow is Google's Open framework for machine learning, the latest official version 1.0 released, the author played a bit, about the pit has the following:
When the entire package is loaded in the GitHub, we need to enter the Tensorflow/tensorflow/contrib/makefile at the terminal and we can see a shell script: build_all_ios.sh
Pit 1:
The network environment when executing build_all_ios.sh scripts, sed:tensorflow/contrib/makefile/downloads/eigen/eigen/src/core/arch/neon/complex.h : No such file or directory
The solution is:
Requires the current network environment to support HTTPS
After the previous step, after executing the script, you will encounter
Pit 2:
+ autoreconf-f-i-wall,no-obsolete
./autogen.sh:line 48:autoreconf:command Not found
Solution:
Brew Install autoconf
After the previous step is complete, continue with the script and encounter
Pit 3:
+ autoreconf-f-i-wall,no-obsolete
Can ' t exec "aclocal": No such file or directory at/usr/local/cellar/autoconf/2.69/share/autoconf/autom4te/fileutils.pm Line 326.
Autoreconf:failed to run aclocal:no such file or directory
Solution:
Brew Install Automake
After the previous step is complete, continue with the script and encounter
Pit 4:
+ autoreconf-f-i-wall,no-obsolete
configure.ac:30:error:possibly undefined Macro:ac_prog_libtool
If This is token and others are legitimate, please use M4_pattern_allow.
The autoconf documentation.
Autoreconf:/usr/local/cellar/autoconf/2.69/bin/autoconf failed with exit Status:1
The solution is:
Brew Install Libtool
Continue to execute the script, no problem, the entire script execution takes time, the final completion of the logo is:
There are libprotobuf.a,libprotobuf-lite.a under the Tensorflow/tensorflow/contrib/makefile/gen/protobuf_ios/lib path.
There are libtensorflow-core.a under the Tensorflow/tensorflow/contrib/makefile/gen/lib path.
After you've done that, go to the path:
Tensorflow/contrib/ios_examples/simple
Open the Tf_ios_makefile_example.xcodeproj project, compile it, click the Run Model button in the app, execute it, and you'll see the TENSORFLOW_INCEPTION_GRAPH.PB file loaded.
Then enter the path: Tensorflow/contrib/ios_examples/camera
Open the Camera_example.xcodeproj project, compile and execute on the real machine with the camera, and then you can play it yourself.
Creating your Own App
You'll need to update various the settings in the Your app to link against TensorFlow. Can view them in the example projects, but here's a full rundown:
The compile_ios_tensorflow.sh script builds a universal static library intensorflow/contrib/makefile/gen/lib/ Libtensorflow-core.a. You'll need to add this to your linking builds stage, and in Search Paths add Tensorflow/contrib/make File/gen/lib to the Library Search Paths setting.
' ll also need to add LIBPROTOBUF.A and Libprotobuf-lite.a fromtensorflow/contrib/makefile/gen/protobuf_ios/lib to Your build stages and Library Search Paths.
The Header Search paths needs to contain:the root folder of TensorFlow, TENSORFLOW/CONTRIB/MAKEFILE/DOWNLOADS/PROTOBUF/SR C Tensorflow/contrib/makefile/downloads, Tensorflow/contrib/makefile/downloads/eigen, and tensorflow/contrib/ Makefile/gen/proto.
In the linking section, you need to add-force_load followed by the path to the TensorFlow static library in the other Lin Ker Flags section. This is ensures that the global C + + objects that are used to register important classes inside the library are not stripped O Ut. To the linker, they can appear unused because no other code references the variables but in fact their constructors The important side effect of registering the class.
You'll need to include the accelerate framework in the "Link Binary with Libraries" build phase of your project.
C++11 support (or later) should is enabled by setting C + + Language dialect to gnu++11 (or gnu++14), and C + + Standard Libra Ry to libc++.
The library doesn ' t currently support Bitcode, so you'll need to disable this in your project settings.
Remove any with The-all_load flag in your project. The Protocol buffers libraries (full and Lite versions) contain duplicate, and symbols the-all_load would flag these Duplicates to become link errors. If you are were using-all_load to avoid issues with objective-c categories in static libraries, your May is able to replace it With The-objcflag.