Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: arm support #227

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,30 @@ For this, first a `.so` needs to be built. You can follow the [Bazel build guide
As a second step, the library needs to be added to your application's project. This is a simple procedure

1. Create a folder called `blobs` in the top level of your project
2. Copy the `libtensorflowlite_c-linux.so` to this folder
3. Append following lines to your `linux/CMakeLists.txt`
2. Copy the `libtensorflowlite_c.so` to this folder
3. Rename the file matching you architecture
1. arm -> `libtensorflowlite_c_arm64.so`
2. x86 -> `libtensorflowlite_c_x86.so`
4. Append following lines to your `linux/CMakeLists.txt`

``` Make
...

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linuxlibtensorflowlite_c-linux.so
)
```

Expand All @@ -118,16 +132,30 @@ For this, first a `.dll` needs to be built. You can follow the [Bazel build guid
As a second step, the library needs to be added to your application's project. This is a simple procedure

1. Create a folder called `blobs` in the top level of your project
2. Copy the `libtensorflowlite_c-win.dll` to this folder
3. Append following lines to your `windows/CMakeLists.txt`
2. Copy the `libtensorflowlite_c.dll` to this folder
3. Rename the file matching you architecture
1. arm -> `libtensorflowlite_c_arm64.dll`
2. x86 -> `libtensorflowlite_c_x86.dll`
4. Append following lines to your `windows/CMakeLists.txt`

``` Make
...

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
```

Expand Down
16 changes: 14 additions & 2 deletions example/audio_classification/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/audio_classification/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/image_classification_mobilenet/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/image_classification_mobilenet/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/live_object_detection_ssd_mobilenet/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/live_object_detection_ssd_mobilenet/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/object_detection_ssd_mobilenet/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/object_detection_ssd_mobilenet/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/style_transfer/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/style_transfer/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/super_resolution_esrgan/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/super_resolution_esrgan/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
16 changes: 14 additions & 2 deletions example/text_classification/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
COMPONENT Runtime)
endif()

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.so)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_SO ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.so)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-linux.so
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_SO}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-linux.so
)
15 changes: 13 additions & 2 deletions example/text_classification/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,18 @@ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

# get tf lite binaries
message(STATUS "TF Lite detected processor architecture: ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_arm64.dll)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(TF_LITE_DLL ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c_x86.dll)
endif()

install(
FILES ${PROJECT_BUILD_DIR}/../blobs/libtensorflowlite_c-win.dll
DESTINATION ${INSTALL_BUNDLE_DATA_DIR}/../blobs/
FILES
${TF_LITE_DLL}
DESTINATION
${INSTALL_BUNDLE_DATA_DIR}/../blobs/
RENAME
libtensorflowlite_c-win.dll
)
Loading