Commit 02a5e931 authored by Andreas Werner's avatar Andreas Werner
Browse files

add tidl-import

parent 3d7bd5cf
Pipeline #11103 passed with stages
in 27 seconds
......@@ -27,10 +27,11 @@ IMAGE_INSTALL_append+= "cmem-mod"
IMAGE_INSTALL_append+= "opencl opencl-runtime opencl-monitor clocl ti-cgt6x opencl-dev opencl-staticdev"
IMAGE_INSTALL_append+= "can-utils"
IMAGE_INSTALL_append+= "remoteproc-shm"
IMAGE_INSTALL_append+= "tidl-api tidl-utils"
IMAGE_INSTALL_append+= "tidl-api tidl-utils tidl-import"
TOOLCHAIN_HOST_TASK += "nativesdk-ti-cgt6x"
TOOLCHAIN_TARGET_TASK += "opencl-staticdev"
TOOLCHAIN_HOST_TASK += "nativesdk-tidl-import"
# Din't compile for x86-64
#TOOLCHAIN_HOST_TASK += "nativesdk-clocl"
......
......@@ -42,6 +42,7 @@ TOOLCHAIN_TARGET_TASK += "kernel-devsrc"
TOOLCHAIN_HOST_TASK = "nativesdk-packagegroup-sdk-host packagegroup-cross-canadian-${MACHINE}"
TOOLCHAIN_HOST_TASK += "nativesdk-ncurses-dev"
TOOLCHAIN_HOST_TASK += "nativesdk-cmake"
TOOLCHAIN_HOST_TASK += "nativesdk-protobuf-c nativesdk-protobuf"
PACKAGECONFIG_append_pn-systemd="xz networkd resolved serial-getty-generator"
......
From 481c021e98c443195b73484fd0d9d50a2e0ae69a Mon Sep 17 00:00:00 2001
From: Hongmei Gou <a0271529@ti.com>
Date: Wed, 25 Sep 2019 18:07:04 -0400
Subject: [PATCH] Makefile: add label_image example
Upstream-Status: Pending
Signed-off-by: Hongmei Gou <a0271529@ti.com>
---
tensorflow/lite/tools/make/Makefile | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile
index 73c50d3272..e2f664e1eb 100644
--- a/tensorflow/lite/tools/make/Makefile
+++ b/tensorflow/lite/tools/make/Makefile
@@ -201,6 +201,12 @@ BENCHMARK_SRCS := $(filter-out \
$(BENCHMARK_SRCS_DIR)/benchmark_plus_flex_main.cc, \
$(BENCHMARK_ALL_SRCS))
+# label image example
+LABELIMAGE_SRCS := \
+ tensorflow/lite/examples/label_image/bitmap_helpers.cc \
+ tensorflow/lite/examples/label_image/label_image.cc \
+ $(EVALUATION_UTILS_SRCS)
+
# These target-specific makefiles should modify or replace options like
# CXXFLAGS or LIBS to work for a specific targetted architecture. All logic
# based on platforms or architectures should happen within these files, to
@@ -209,6 +215,7 @@ include $(wildcard $(MAKEFILE_DIR)/targets/*_makefile.inc)
ALL_SRCS := \
$(MINIMAL_SRCS) \
+ $(LABELIMAGE_SRCS) \
$(PROFILER_SRCS) \
$(PROFILER_SUMMARIZER_SRCS) \
$(TF_LITE_CC_SRCS) \
@@ -225,6 +232,7 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
BENCHMARK_LIB := $(LIBDIR)$(BENCHMARK_LIB_NAME)
BENCHMARK_BINARY := $(BINDIR)$(BENCHMARK_BINARY_NAME)
MINIMAL_BINARY := $(BINDIR)minimal
+LABELIMAGE_BINARY := $(BINDIR)label_image
CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
@@ -233,6 +241,9 @@ AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
MINIMAL_OBJS := $(addprefix $(OBJDIR), \
$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(MINIMAL_SRCS))))
+LABELIMAGE_OBJS := $(addprefix $(OBJDIR), \
+$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(LABELIMAGE_SRCS))))
+
LIB_OBJS := $(addprefix $(OBJDIR), \
$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(TF_LITE_CC_SRCS)))))
@@ -252,7 +263,7 @@ $(OBJDIR)%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
# The target that's compiled if there's no command-line arguments.
-all: $(LIB_PATH) $(MINIMAL_BINARY) $(BENCHMARK_BINARY)
+all: $(LIB_PATH) $(MINIMAL_BINARY) $(LABELIMAGE_BINARY) $(BENCHMARK_BINARY)
# The target that's compiled for micro-controllers
micro: $(LIB_PATH)
@@ -276,6 +287,14 @@ $(MINIMAL_BINARY): $(MINIMAL_OBJS) $(LIB_PATH)
minimal: $(MINIMAL_BINARY)
+$(LABELIMAGE_BINARY): $(LABELIMAGE_OBJS) $(LIB_PATH)
+ @mkdir -p $(dir $@)
+ $(CXX) $(CXXFLAGS) $(INCLUDES) \
+ -o $(LABELIMAGE_BINARY) $(LABELIMAGE_OBJS) \
+ $(LIBFLAGS) $(LIB_PATH) $(LDFLAGS) $(LIBS)
+
+label_image: $(LABELIMAGE_BINARY)
+
$(BENCHMARK_LIB) : $(LIB_PATH) $(BENCHMARK_OBJS)
@mkdir -p $(dir $@)
$(AR) $(ARFLAGS) $(BENCHMARK_LIB) $(LIB_OBJS) $(BENCHMARK_OBJS)
--
2.17.1
diff --git a/tensorflow/lite/tools/make/downloads/eigen/Eigen/src/Core/arch/NEON/Complex.h b/tensorflow/lite/tools/make/downloads/eigen/Eigen/src/Core/arch/NEON/Complex.h
index 306a309beb..4527a64c91 100644
--- a/tensorflow/lite/tools/make/downloads/eigen/Eigen/src/Core/arch/NEON/Complex.h
+++ b/tensorflow/lite/tools/make/downloads/eigen/Eigen/src/Core/arch/NEON/Complex.h
@@ -307,7 +307,7 @@
static uint64x2_t p2ul_CONJ_XOR = {0x0, 0x8000000000000000};
#else
const uint64_t p2ul_conj_XOR_DATA[] = { 0x0, 0x8000000000000000 };
- static uint64x2_t p2ul_CONJ_XOR = vld1q_u64( p2ul_conj_XOR_DATA );
+ static uint64x2_t p2ul_CONJ_XOR;// = vld1q_u64( p2ul_conj_XOR_DATA ); - Removed by script
#endif
struct Packet1cd
Name: tensorflow lite
Description: tensorflow lite static library
Version: @version@
Requires:
Libs: -L@libdir@ -ltensorflow-lite
Cflags: -I@includedir@
#!/bin/sh
#list of model packages
declare -a model_list=(
"http://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/tflite_11_05_08/mobilenet_v2_1.0_224_quant.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/inception_v1_224_quant_20181026.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/inception_v2_224_quant_20181026.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/tflite_11_05_08/inception_v3_quant.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/inception_v4_299_quant_20181026.tgz"
"http://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip"
)
# create a new directory to host and unpack the models
rm -rf ~/tflite-benchmark
mkdir ~/tflite-benchmark
# Set maximal number of threads to the number of arm cores
max_num_threads=`nproc`
# TFLite install dir on filesystem
tflite_install_dir=$(find /usr/share -maxdepth 1 -type d -name "tensorflow-lite*")
for model_link in "${model_list[@]}"
do
# download the model package to modeldir
modelpkg="${model_link##*/}"
modeldir="${modelpkg%.*}"
mkdir ~/tflite-benchmark/$modeldir
cd ~/tflite-benchmark/$modeldir
echo "Downloading $modelpkg..."
wget "$model_link"
if [[ $? -ne 0 ]]; then
echo "wget failed. Set up http proxy as needed before running the scripts!"
exit 1
fi
# unpack the model package
if [[ $modelpkg =~ \.tgz$ ]]; then
tar -xzvf $modelpkg
fi
if [[ $modelpkg =~ \.zip$ ]]; then
unzip $modelpkg
fi
# run benchmark for the model
for model in *.tflite; do
for num_threads in $( seq 1 $max_num_threads )
do
echo "Running benchmark_model for $model with $num_threads thread(s)..."
$tflite_install_dir/examples/benchmark_model --graph=${model} --num_threads=$num_threads --enable_op_profiling=true > ${modeldir}_thread_${num_threads}.log
cat ${modeldir}_thread_${num_threads}.log | grep Timings
done
done
done
echo "Benchmarking completed!"
DESCRIPTION = "TensorFlow's lightweight solution for mobile and embedded devices"
AUTHOR = "Google Inc. and Yuan Tang"
HOMEPAGE = "https://www.tensorflow.org/lite"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=64a34301f8e355f57ec992c2af3e5157"
MD5SUM_EIGEN = "a28a728acb3298471b11132ab5c0c3cb"
SHA256SUM_EIGEN = "7e7a57e33c59280a17a66e521396cd8b1a55d0676c9f807078522fda52114b5c"
MD5SUM_FFT = "4255dd8a74949d123216b1ab91520469"
SHA256SUM_FFT = "52bb637c70b971958ec79c9c8752b1df5ff0218a4db4510e60826e0cb79b5296"
PV = "1.15"
SRC_URI = "git://github.com/tensorflow/tensorflow.git;branch=r${PV};rev=590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b;protocol=https \
https://software-dl.ti.com/processor-sdk-mirror/sources/8071cda5714d.tar.gz;md5sum=${MD5SUM_EIGEN};sha256sum=${SHA256SUM_EIGEN} \
git://github.com/google/gemmlowp;destsuffix=gemmlowp/;branch=master;rev=12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3;protocol=https \
git://github.com/google/googletest;destsuffix=googletest/;branch=master;rev=release-1.8.0;protocol=https \
git://github.com/abseil/abseil-cpp;destsuffix=abseil-cpp/;branch=master;rev=43ef2148c0936ebf7cb4be6b19927a9d9d145b8f;nobranch=1;protocol=https \
git://github.com/intel/ARM_NEON_2_x86_SSE;destsuffix=neon_2_sse/;branch=master;rev=3057bb91b99bae9c7fbdf8710c032d462ca10051;protocol=https \
git://github.com/google/farmhash;destsuffix=farmhash/;branch=master;rev=816a4ae622e964763ca0862d9dbd19324a1eaf45;protocol=https \
git://github.com/google/flatbuffers;destsuffix=flatbuffers/;branch=master;rev=v1.11.0;protocol=https \
https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz;md5sum=${MD5SUM_FFT};sha256sum=${SHA256SUM_FFT} \
http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz;name=mobilenet_v1_quant;subdir=${WORKDIR}/model;destsuffix=model \
file://apply-modification-for-tflite-${PV}-to-eigen.patch \
file://0001-Makefile-add-label_image-example-${PV}.patch \
file://tflite-benchmark.sh \
file://tensorflow-lite.pc.in"
SRC_URI[mobilenet_v1_quant.md5sum] = "36af340c00e60291931cb30ce32d4e86"
SRC_URI[mobilenet_v1_quant.sha256sum] = "d32432d28673a936b2d6281ab0600c71cf7226dfe4cdcef3012555f691744166"
PR = "r5"
S = "${WORKDIR}/git"
DEPENDS = "zlib"
TARGET_CFLAGS_remove = "-O2"
TARGET_CPPFLAGS_remove = "-O2"
TARGET_CXXFLAGS_remove = "-O2"
CFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
CPPFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
LDFLAGS_remove = "-Wl,-O1"
CXXFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
LIBS = "-lstdc++ -lpthread -lm -lz -ldl -lrt"
BUILD_DEPS_DOWNLOAD_DIR_PREFIX = "${S}/tensorflow/lite/tools/make/downloads/"
do_cp_downloaded_build_deps() {
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}eigen
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}gemmlowp
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}googletest
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}absl
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}farmhash
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}neon_2_sse
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}flatbuffers
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}fft2d
cp -rf ${WORKDIR}/eigen-eigen-8071cda5714d/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}eigen"
cp -rf ${WORKDIR}/gemmlowp/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}gemmlowp/"
cp -rf ${WORKDIR}/googletest/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}googletest/"
cp -rf ${WORKDIR}/abseil-cpp/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}absl/"
cp -rf ${WORKDIR}/farmhash/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}farmhash/"
cp -rf ${WORKDIR}/neon_2_sse/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}neon_2_sse/"
cp -rf ${WORKDIR}/flatbuffers/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}flatbuffers/"
cp -rf ${WORKDIR}/fft/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}fft2d"
}
addtask do_cp_downloaded_build_deps after do_unpack before do_patch
EXTRA_OEMAKE = "\
'CC=${CC}' \
'CXX=${CXX}' \
'CPP=${CPP}' \
'CFLAGS=${CFLAGS}' \
'CPPFLAGS=${CPPFLAGS}' \
'CXXFLAGS=${CXXFLAGS}' \
'AR=${AR}' \
'LD=${LD}' \
'LDFLAGS=${LDFLAGS}' \
'LIBS=${LIBS}' \
'TARGET=${TARGET_OS}' \
'TARGET_ARCH=${TUNE_ARCH}'"
do_compile() {
oe_runmake -f tensorflow/lite/tools/make/Makefile
}
do_install() {
install -d ${D}${libdir}
install -m 0644 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/lib/*.a ${D}${libdir}/
install -d ${D}${includedir}/tensorflow/lite
install -m 0644 ${S}/tensorflow/lite/*.h ${D}${includedir}/tensorflow/lite/
install -d ${D}${includedir}/tensorflow/lite/c
install -m 0644 ${S}/tensorflow/lite/c/*.h ${D}${includedir}/tensorflow/lite/c/
install -d ${D}${includedir}/tensorflow/lite/core/
install -m 0644 ${S}/tensorflow/lite/core/*.h ${D}${includedir}/tensorflow/lite/core/
install -d ${D}${includedir}/tensorflow/lite/core/api/
install -m 0644 ${S}/tensorflow/lite/core/api/*.h ${D}${includedir}/tensorflow/lite/core/api/
install -d ${D}${includedir}/tensorflow/lite/kernels
install -m 0644 ${S}/tensorflow/lite/kernels/*.h ${D}${includedir}/tensorflow/lite/kernels/
install -d ${D}${includedir}/tensorflow/lite/profiling/
install -m 0644 ${S}/tensorflow/lite/profiling/*.h ${D}${includedir}/tensorflow/lite/profiling/
install -d ${D}${includedir}/tensorflow/lite/schema/
install -m 0644 ${S}/tensorflow/lite/schema/*.h ${D}${includedir}/tensorflow/lite/schema/
install -m 0644 ${S}/tensorflow/lite/schema/schema.fbs ${D}${includedir}/tensorflow/lite/schema/
install -d ${D}${includedir}/tensorflow/lite/tools/
install -m 0644 ${S}/tensorflow/lite/tools/*.h ${D}${includedir}/tensorflow/lite/tools/
install -d ${D}${includedir}/tensorflow/lite/delegates/nnapi/
install -m 0644 ${S}/tensorflow/lite/delegates/nnapi/*.h ${D}${includedir}/tensorflow/lite/delegates/nnapi/
install -d ${D}${includedir}/tensorflow/lite/experimental/resource_variable/
install -m 0644 ${S}/tensorflow/lite/experimental/resource_variable/*.h ${D}${includedir}/tensorflow/lite/experimental/resource_variable/
install -d ${D}${includedir}/tensorflow/lite/kernels/internal/
install -m 0644 ${S}/tensorflow/lite/kernels/internal/*.h ${D}${includedir}/tensorflow/lite/kernels/internal/
install -d ${D}${libdir}/pkgconfig
install -m 0644 ${WORKDIR}/tensorflow-lite.pc.in ${D}${libdir}/pkgconfig/tensorflow-lite.pc
sed -i 's:@version@:${PV}:g
s:@libdir@:${libdir}:g
s:@includedir@:${includedir}:g' ${D}${libdir}/pkgconfig/tensorflow-lite.pc
# install examples
install -d ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/minimal ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/benchmark_model ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/label_image ${D}${datadir}/${BPN}/examples
install -m 0644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp ${D}${datadir}/${BPN}/examples
install -m 0644 ${S}/tensorflow/lite/java/ovic/src/testdata/labels.txt ${D}${datadir}/${BPN}/examples
install -m 0644 ${WORKDIR}/model/mobilenet_v1_1.0_224_quant.tflite ${D}${datadir}/${BPN}/examples
# install scripts for benchmarking
install -m 0755 ${WORKDIR}/tflite-benchmark.sh ${D}${datadir}/${BPN}/examples
}
BBCLASSEXTEND = "native nativesdk"
From 56a7f7cfdd304b0144568e4d4507f85537c9d142 Mon Sep 17 00:00:00 2001
From: Andreas Werner <kernel@andy89.org>
Date: Fri, 19 Nov 2021 16:06:48 +0100
Subject: [PATCH] fix Buildsys
---
makerules/rules.mk | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/makerules/rules.mk b/makerules/rules.mk
index dc117da..0fc9315 100644
--- a/makerules/rules.mk
+++ b/makerules/rules.mk
@@ -160,11 +160,14 @@ else
endif
ifeq ($(LINUXENV), oearm)
#Linux ARM Emulation
- CC=$(LINUX_BUILD_TOOLS)g++ -c
- CP=$(LINUX_BUILD_TOOLS)g++ -c
- AR=$(LINUX_BUILD_TOOLS)ar
+ #CC=$(LINUX_BUILD_TOOLS)g++ -c
+ #CP=$(LINUX_BUILD_TOOLS)g++ -c
+ #AR=$(LINUX_BUILD_TOOLS)ar
+ CC = $(CXX) -c
+ CP = $(CXX) -c
+ LD = $(CXX)
ARFLAGS := rvs
- LD=$(LINUX_BUILD_TOOLS)g++
+ #LD=$(LINUX_BUILD_TOOLS)g++
ifeq ($(TARGET_BUILD), debug)
COMPILER_FLAGS = -ggdb -ggdb3 -gdwarf-2 -DHOST_EMULATION
LDFLAGS +=
EXTRA_MAKE_ARGS_class-target = "LINUX_BUILD_TOOLS=${TARGET_PREFIX} \
PROTOBUF_LIB_DIR=${STAGING_LIBDIR} PROTOBUF_INC_DIR=${STAGING_INCDIR} \
FLATBUFFERS_INC_DIR=${STAGING_INCDIR}/flatbuffers \
TF_LITE_GENERATED_PATH=${STAGING_INCDIR}/tensorflow/lite/schema LINUXENV=oearm"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-fix-Buildsys.patch"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment