Skip to contentSkip to conversation

tensorflow-lite: correct typos when modifying the compilation flags

PATCH In review Hongmei Gou 3 participants 5 messages Nov 13, 2019 – Nov 14, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tensorflow-lite: correct typos when modifying the compilation flags

---
 .../tensorflow-lite/tensorflow-lite_1.15.bb          | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta-arago-extras/recipes-support/tensorflow-lite/tensorflow-lite_1.15.bb +6 -6
index 612440c3..c676177b 100644
@@ -40,17 +40,17 @@ SRC_URI[mobilenet_v1_quant.sha256sum] = "d32432d28673a936b2d6281ab0600c71cf7226d
 
 SRCREV = "590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b"
 
-PR = "r0"
+PR = "r1"
 
 S = "${WORKDIR}/git"
 
 DEPENDS = "zlib"
 TARGET_CFLAGS_remove = "-O2"
-TARGET_CPPLAGS_remove = "-O2"
-TARGET_CXXLAGS_remove = "-O2"
-CCFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
+TARGET_CPPFLAGS_remove = "-O2"
+TARGET_CXXFLAGS_remove = "-O2"
+CFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
     -I${STAGING_INCDIR}"
-CXXFLAGS_append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
+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 \
@@ -84,7 +84,7 @@ EXTRA_OEMAKE = "\
     'CXX=${CXX}' \
     'CPP=${CPP}' \
     'CFLAGS=${CFLAGS}' \
-    'CPPFLAGS=${CFLAGS}' \
+    'CPPFLAGS=${CPPFLAGS}' \
     'CXXFLAGS=${CXXFLAGS}' \
     'AR=${AR}' \
     'LD=${LD}' \
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 tensorflow-lite: add scripts for benchmarking

---
 .../tensorflow-lite/files/tflite-benchmark.sh | 58 +++++++++++++++++++
 .../tensorflow-lite/tensorflow-lite_1.15.bb   |  6 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 meta-arago-extras/recipes-support/tensorflow-lite/files/tflite-benchmark.sh
meta-arago-extras/recipes-support/tensorflow-lite/files/tflite-benchmark.sh new file +58 -0
new file mode 100644
index 00000000..c37ca53f
@@ -0,0 +1,58 @@
+#!/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 up http proxy - MODIFY THIS AS NEEDED!!
+ti_http_proxy="http://webproxy.ext.ti.com:80"
+
+# 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..."
+  http_proxy="$ti_http_proxy" wget "$model_link"
+
+  # 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!"
meta-arago-extras/recipes-support/tensorflow-lite/tensorflow-lite_1.15.bb +5 -1
index c676177b..aade3a1d 100644
@@ -33,6 +33,7 @@ SRC_URI = "git://github.com/tensorflow/tensorflow.git;branch=r${PV};protocol=htt
     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"
@@ -40,7 +41,7 @@ SRC_URI[mobilenet_v1_quant.sha256sum] = "d32432d28673a936b2d6281ab0600c71cf7226d
 
 SRCREV = "590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b"
 
-PR = "r1"
+PR = "r2"
 
 S = "${WORKDIR}/git"
 
@@ -128,6 +129,9 @@ do_install() {
     install -m 0644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp ${D}${datadir}/${PN}-${PV}/examples
     install -m 0644 ${S}/tensorflow/lite/java/ovic/src/testdata/labels.txt ${D}${datadir}/${PN}-${PV}/examples
     install -m 0644 ${WORKDIR}/model/mobilenet_v1_1.0_224_quant.tflite ${D}${datadir}/${PN}-${PV}/examples
+    # install scripts for benchmarking
+    install -d ${D}${bindir}
+    install -m 0755 ${WORKDIR}/tflite-benchmark.sh ${D}/${bindir}
 }
 
 PACKAGES += "${PN}-examples"
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/3 packagegroup-arago-tisdk-addons: add tensorflow-lite

In reply to Hongmei Gou
---
 .../packagegroups/packagegroup-arago-tisdk-addons.bb        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb +5 -1
index 14b2370c..73f3f950 100644
@@ -1,6 +1,6 @@
 DESCRIPTION = "Task to install additional utilities/demos for SDKs"
 LICENSE = "MIT"
-PR = "r76"
+PR = "r77"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -154,6 +154,7 @@ EXTRA_PACKAGES_append_ti33x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \
                                 pdm-anomaly-detection \
 "
 
@@ -161,6 +162,7 @@ EXTRA_PACKAGES_append_ti43x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \
                                 pdm-anomaly-detection \
 "
 
@@ -170,12 +172,14 @@ EXTRA_PACKAGES_append_omap-a15 = " voxelsdk \
                                    arm-compute-library \
                                    ${ARMNN_PACKAGES} \
                                    tensorflow-lite-examples \
+                                   tensorflow-lite \
                                    pdm-anomaly-detection \
 "
 
 EXTRA_PACKAGES_append_am65xx = " arm-compute-library \
                              ${ARMNN_PACKAGES} \
                              tensorflow-lite-examples \
+                             tensorflow-lite \
                              pdm-anomaly-detection \
 "
 
Signature · 1 line
2.17.1
#3 lore raw

Re: [thud/master] [PATCH 3/3] packagegroup-arago-tisdk-addons: add tensorflow-lite

Quoted 18 lines · Hongmei Gou
---
 .../packagegroups/packagegroup-arago-tisdk-addons.bb        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb +1 -1
index 14b2370c..73f3f950 100644
@@ -1,6 +1,6 @@
 DESCRIPTION = "Task to install additional utilities/demos for SDKs"
 LICENSE = "MIT"
-PR = "r76"
+PR = "r77"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 

meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb EXTRA_PACKAGES_append_ti33x = " voxelsdk \ · line 157

Quoted 4 lines
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb +1 -0
@@ -154,6 +154,7 @@ EXTRA_PACKAGES_append_ti33x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \

Can you make tensorflow-lite-examples properly RDEPENDS on tensorflow-lite instead?

Quoted 33 lines
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb +3 -0
                                 pdm-anomaly-detection \
 "
 
@@ -161,6 +162,7 @@ EXTRA_PACKAGES_append_ti43x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \
                                 pdm-anomaly-detection \
 "
 
@@ -170,12 +172,14 @@ EXTRA_PACKAGES_append_omap-a15 = " voxelsdk \
                                    arm-compute-library \
                                    ${ARMNN_PACKAGES} \
                                    tensorflow-lite-examples \
+                                   tensorflow-lite \
                                    pdm-anomaly-detection \
 "
 
 EXTRA_PACKAGES_append_am65xx = " arm-compute-library \
                              ${ARMNN_PACKAGES} \
                              tensorflow-lite-examples \
+                             tensorflow-lite \
                              pdm-anomaly-detection \
 "
 
Signature · 6 lines
2.17.1

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
#4 lore raw

Re: [thud/master] [PATCH 3/3] packagegroup-arago-tisdk-addons: add tensorflow-lite

In reply to Hongmei Gou

NACK. This patch is no longer needed with the updated patch for tensorflow-lite: http://patchwork.dal.design.ti.com/patch/51102/.

-----Original Message-----
From: Gou, Hongmei
Sent: Tuesday, November 12, 2019 7:14 PM
To: [email protected]
Cc: Gou, Hongmei
Subject: [meta-arago] [thud/master] [PATCH 3/3] packagegroup-arago-tisdk-addons: add tensorflow-lite

---
 .../packagegroups/packagegroup-arago-tisdk-addons.bb        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-tisdk-addons.bb +5 -1
index 14b2370c..73f3f950 100644
@@ -1,6 +1,6 @@
 DESCRIPTION = "Task to install additional utilities/demos for SDKs"
 LICENSE = "MIT"
-PR = "r76"
+PR = "r77"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -154,6 +154,7 @@ EXTRA_PACKAGES_append_ti33x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \
                                 pdm-anomaly-detection \
 "
 
@@ -161,6 +162,7 @@ EXTRA_PACKAGES_append_ti43x = " voxelsdk \
                                 arm-compute-library \
                                 ${ARMNN_PACKAGES} \
                                 tensorflow-lite-examples \
+                                tensorflow-lite \
                                 pdm-anomaly-detection \
 "
 
@@ -170,12 +172,14 @@ EXTRA_PACKAGES_append_omap-a15 = " voxelsdk \
                                    arm-compute-library \
                                    ${ARMNN_PACKAGES} \
                                    tensorflow-lite-examples \
+                                   tensorflow-lite \
                                    pdm-anomaly-detection \
 "
 
 EXTRA_PACKAGES_append_am65xx = " arm-compute-library \
                              ${ARMNN_PACKAGES} \
                              tensorflow-lite-examples \
+                             tensorflow-lite \
                              pdm-anomaly-detection \
 "
 
Signature · 1 line
2.17.1