1. 程式人生 > >Build TensorFlow for armeabi-v7a and arm64-v8a

Build TensorFlow for armeabi-v7a and arm64-v8a

Copy libs to facerecognitionlibrary to compile the tensorflow so-file

  1. Copy all from "tensorflow/bazel-out/android-aarch64-linux-android-4.9-gnu-libstdcpp-fastbuild/genfiles/tensorflow" to "facerecognitionlibrary/jni-build/jni/genfiles/tensorflow"
  2. Copy all from "tensorflow/tensorflow" to "facerecognitionlibrary/jni-build/jni/include/tensorflow"
  3. Copy all from "tensorflow/third_party" to "facerecognitionlibrary/jni-build/jni/include/third_party"
  4. Copy all from "tensorflow/bazel-tensorflow/external/protobuf" to "facerecognitionlibrary/jni-build/jni/include/google/protobuf"
  5. Copy the files "libprotos_all_cc.a", "libandroid_tensorflow_lib.lo", "libandroid_tensorflow_lib_lite.lo", "kernels/libandroid_tensorflow_kernels.lo" from "tensorflow/bazel-out/android-aarch64-linux-android-4.9-gnu-libstdcpp-fastbuild/bin/tensorflow/core" to "facerecognitionlibrary/jni-build/jni/libs/arm64-v8a"
  6. Copy the files "libprotobuf.a" and "libprotobuf_lite.a" from "tensorflow/bazel-out/android-aarch64-linux-android-4.9-gnu-libstdcpp-fastbuild/bin/external/protobuf" to "facerecognitionlibrary/jni-build/jni/libs/arm64-v8a"
  7. Change line in Application.mk to "APP_ABI := arm64-v8a"
  8. Delete the lines "'-Wl,--icf=all' ", "'-march=armv7-a' " and "-Wl,--fix-cortex-a8 " in the Android.mk file
  9. Make, Make install

在tensorflow原始碼包中執行,下面編譯指令,生成libtensorflow_inference.so. 通過修改cpu=arm64-v8a,armeabi-v7a,armeabi分別生成各平臺的so。

Then, to build the native TF library:

bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so \
   --crosstool_top=//external:android/crosstool \
   [email protected]_tools//tools/cpp:toolchain \
   --cpu=armeabi-v7a

在tensorflow原始碼包中執行,下面編譯指令,生成libtensorflow_demo.so. 通過修改cpu=arm64-v8a,armeabi-v7a,armeabi分別生成各平臺的so。

bazel build //tensorflow/examples/android:tensorflow_demo --fat_apk_cpu=armeabi-v7a,arm64-v8a

然後將2個so庫,分別放入android studio  jnilibs的對於lib庫檔案加

相關推薦

Build TensorFlow for armeabi-v7a and arm64-v8a

Copy libs to facerecognitionlibrary to compile the tensorflow so-file Copy all from "tensorflow/bazel-out/android-aarch64-linux-android-4

android libs資料夾下armeabi armeabi-v7a x86 arm64-v8a

     在我們androidAPK的根目錄有一個 libs資料夾,此資料夾下包含了armeabi和armeabi-v7a兩個資料夾,我們的c程式碼編譯成的本地庫(各種.so)就會放在這兩個資料夾其中的一個。那armeabi-v7a與 armeabi有什麼區別,都是什麼意思呢?    armeabi和

WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contai

WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI' not targeted by this project. http

關於Android arm64-v8aarmeabi-v7aarmeabi、x86等CPU下的so檔案相容問題

安卓開發者平臺關於ABI的介紹 類似介紹 先介紹幾個專業詞: ARM : 是嵌入式中的一種架構,全稱為Advanced RISC Machine,可以理解為ARM處理器。 ABI(Application Binary Interface): 應用程式二進位制介面 描述了應用程

armeabi-v7a armeabi arm64-v8a

armeabi就是針對普通的或舊的arm v5 cpu,armeabi-v7a是針對有浮點運算或高階擴充套件功能的arm v7 cpu。 armeabi-v7a(32位ARM裝置),arm64-v8a(64位ARM裝置) 在2011年11月,ARM公司釋出了新一代處理器64位架構ARMv8的部分技術

我的Android進階之旅------>Android 關於arm64-v8aarmeabi-v7aarmeabi、x86下的so檔案相容問題

Android 裝置的CPU型別(通常稱為”ABIs”) armeabiv-v7a: 第7代及以上的 ARM 處理器。2011年15月以後的生產的大部分Android裝置都使用它. arm64-v8a: 第8代、64位ARM處理器,很少裝置,三星 Ga

jni中arm64-v8aarmeabi-v7a,armeabi文件夾的意義和用法

結果 strong The 主流手機 lin div %20 tco 高通 兼容和文件讀取順序 arm64-v8a是可以向下兼容的,其下有armeabi-v7a,armeabi armeabi-v7a向下兼容armeabi 兼容得不夠智能: 對於一個cpu是arm64-v8

Android 關於arm64-v8aarmeabi-v7aarmeabi、x86下的so檔案相容問題

Android 裝置的CPU型別(通常稱為”ABIs”) armeabiv-v7a: 第7代及以上的 ARM 處理器。2011年15月以後的生產的大部分Android裝置都使用它. arm64-v8a: 第8代、64位ARM處理器,很少裝置,三星 Galaxy S6是其中

android sudio升級後報錯ABIs [armeabi] are not supported for platform. Supported ABIs are [arm64-v8a, arme

Although you should build a single APK to support all your target devices whenever possible, that might result in a very large APK due to files needed to s

QT on Android,for armeabi-v8a的ABI不支援問題

  第一次寫部落格,主要是寫下一些筆記,問題和思考。   最近在圖書館借了本Qt on Android核心程式設計,安曉輝著,想試試用QT來寫Android程式。   書上的QT版本是5.2.0,QT Creator的版本是3.0。   按照書的流程

How to build Tensorflow as a Static Library for Android

A few months ago, I published a Medium story teaching "How to build Tensorflow on Windows with /MT (CPU & GPU)". Recently, I had to make the same Tenso

TensorFlow for R: More flexible models with TensorFlow eager execution and Keras

If you have used Keras to create neural networks you are no doubt familiar with the Sequential API, which represents models as a linear stack of layers. Th

CS20SI Tensorflow for Deeplearning課程筆記(四) word2vec with NCE loss and visualize the embeddings

一、如何去構建Tensorflow model Phase 1: 定義Tensorflow圖 1. 給輸入和輸出定義placeholders 2. 定義weights 3. 定義推斷模型 4. 定義損失函式 5. 定義優化器 Phase 2: 執行

原始碼安裝l CUDA 10.0, cuDNN 7.3 and build TensorFlow (GPU) from source on Ubuntu 18.04

更糟糕的CUDA 10.0和cuDNN 7.3版本我真的很想在我新建的機器上試用它。問題是pip包TensorFlow 1.11rc不支援最新的CUDA版本,我需要從原始碼構建它。整個過程對我來說相當痛苦,最後我完成了它後,我決定再次完成所有步驟並在空的Ubuntu機器上從頭開始設定。 我的

一個關於arm64-v8aarmeabi向下相容so檔案的坑

CPU架構對應的so檔案所在位置 arm64-v8a armeabi-v7a armeabi mips mips64 x86 x86_64 不同版本的CPU架構中,高版本是可以向下相容的,比如arm

linux bash shell中for的用法and示例

bash shell腳本中for的用法關於linux bash shell中的for語句 在linux中shell是必不可少的一部分,但是在bash shell中有while,for,until等循環命令,今天就介紹一下關於for的一些用法。文中任何錯誤希望大佬們一一指出,不勝感激。bash sh

Convolutional Patch Networks with Spatial Prior for Road Detection and Urban Scene Understanding

line evel linux 程序 providing form ram -s visio Convolutional Patch Networks with Spatial Prior for Road Detection and Urban Sce

[React] Configure a React & Redux Application For Production Deployment and Deploy to Now

hang scrip app class pack pub relative pts als In this lesson, we’ll make a few small changes to our scripts and add some environme

SDN實戰: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware

sdn-ip onos mininet gns3 vmwareSDN IN ACTION: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware 薛國鋒 [email protect

stu--CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoning

stanford ted ets question prior main sed and not https://cs.stanford.edu/people/jcjohns/clevr/ 用於視覺推理的診斷數據集 摘要 介紹 visual question