Actually call yolov5 inference
Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: I693aa253d09e88f6000ee9ea5a8c68862ac47629
diff --git a/third_party/libedgetpu/libedgetpu.BUILD b/third_party/libedgetpu/libedgetpu.BUILD
index 0289452..181c93a 100644
--- a/third_party/libedgetpu/libedgetpu.BUILD
+++ b/third_party/libedgetpu/libedgetpu.BUILD
@@ -1,11 +1,27 @@
cc_library(
- visibility = ["//visibility:public"],
name = "libedgetpu-k8",
- srcs = ["k8/libedgetpu.so.1.0"]
+ srcs = ["k8/libedgetpu.so.1.0"],
+ hdrs = glob(["include/**/*.h"]),
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
)
cc_library(
- visibility = ["//visibility:public"],
name = "libedgetpu-arm",
- srcs = ["arm/libedgetpu.so.1.0"]
-)
\ No newline at end of file
+ srcs = ["arm/libedgetpu.so.1.0"],
+ hdrs = glob(["include/**/*.h"]),
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "renamed_libedgetpu-arm",
+ srcs = [
+ "arm/libedgetpu.so.1.0",
+ ],
+ outs = [
+ "arm/libedgetpu.so.1",
+ ],
+ cmd = "cp $< $@",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/libedgetpu/libedgetpu_build_script.sh b/third_party/libedgetpu/libedgetpu_build_script.sh
old mode 100644
new mode 100755
index 0eafccf..76e20db
--- a/third_party/libedgetpu/libedgetpu_build_script.sh
+++ b/third_party/libedgetpu/libedgetpu_build_script.sh
@@ -1,10 +1,18 @@
+#!/bin/bash
+#This script creates a compressed tarball file named libedgetpu-${GIT_VERSION}.tar.gz,
+# which contains the header files, libraries, and binaries needed to use Edge TPU on both arm and x86 architectures.
+# This script assumes you have Docker installed.
+#
# Clone the correct version of libedgetpu
git clone https://github.com/google-coral/libedgetpu.git
cd libedgetpu
+GIT_VERSION=ddfa7bde33c23afd8c2892182faa3e5b4e6ad94e
+git checkout ${GIT_VERSION}
# Build libedgetpu.so.1.0 for both arm and x86
DOCKER_CPUS="k8" DOCKER_IMAGE="ubuntu:18.04" DOCKER_TARGETS=libedgetpu make docker-build
DOCKER_CPUS="aarch64" DOCKER_IMAGE="debian:stretch" DOCKER_TARGETS=libedgetpu make docker-build
-# Create the directory for the tarball and move the resulting files into it
+# Create the directory for the tarball and move the resulting files into it
+rm -rf libedgetpu-bazel
mkdir libedgetpu-bazel
mkdir libedgetpu-bazel/arm
mkdir libedgetpu-bazel/k8
@@ -12,5 +20,7 @@
cp out/direct/k8/libedgetpu.so.1.0 libedgetpu-bazel/k8
# Copy header files to the include directory
-mkdir libedgetpu-bazel/include
-cp -r include/* libedgetpu-bazel/include/
+mkdir -p libedgetpu-bazel/include/tflite/
+rsync -zarv --include="*/" --include='*.h' --exclude='*' tflite/ libedgetpu-bazel/include/tflite/
+tar zcvf libedgetpu-${GIT_VERSION}.tar.gz libedgetpu-bazel
+
diff --git a/third_party/libtensorflowlite/libtensorflowlite.BUILD b/third_party/libtensorflowlite/libtensorflowlite.BUILD
index a6b837d..761ca76 100644
--- a/third_party/libtensorflowlite/libtensorflowlite.BUILD
+++ b/third_party/libtensorflowlite/libtensorflowlite.BUILD
@@ -1,16 +1,19 @@
cc_library(
- visibility = ["//visibility:public"],
name = "tensorflow-k8",
+ srcs = ["k8/libtensorflowlite.so"],
hdrs = glob(["include/**/*.h"]),
+ copts = ["-Wno-unused-parameter"],
strip_include_prefix = "include",
- srcs = ["k8/libtensorflowlite.so"]
+ visibility = ["//visibility:public"],
)
cc_library(
- visibility = ["//visibility:public"],
name = "tensorflow-arm",
+ srcs = ["arm/libtensorflowlite.so"],
hdrs = glob(["include/**/*.h"]),
+ copts = ["-Wno-unused-parameter"],
strip_include_prefix = "include",
- srcs = ["arm/libtensorflowlite.so"]
+ visibility = ["//visibility:public"],
)
+exports_files(["arm/libtensorflowlite.so"])
diff --git a/third_party/libtensorflowlite/tensorflow_build_script.sh b/third_party/libtensorflowlite/tensorflow_build_script.sh
old mode 100644
new mode 100755
index 6c44353..8bde976
--- a/third_party/libtensorflowlite/tensorflow_build_script.sh
+++ b/third_party/libtensorflowlite/tensorflow_build_script.sh
@@ -1,11 +1,18 @@
+#!/bin/bash
+# This script creates a compressed tarball file named tensorflow-${GIT_VERSION}.tar.gz,
+# which contains the header files, libraries, and binaries needed to use Tensorflow Lite on both arm and x86 architectures.
+# This script assumes you have bazelisk and necessary permissions.
+#
# Clone and checkout the correct version of Tensorflow
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
-git checkout v2.8.0
+GIT_VERSION=a4dfb8d1a71385bd6d122e4f27f86dcebb96712d
+git checkout $GIT_VERSION
# Build libtensorflowlite.so for both arm and x86
-bazel build --config=elinux_aarch64 -c opt //tensorflow/lite:libtensorflowlite.so
-bazel build --config=native_arch_linux -c opt //tensorflow/lite:libtensorflowlite.so
-# Create the directory for the tarball and move the resulting files into it
+bazelisk build --config=elinux_aarch64 -c opt //tensorflow/lite:libtensorflowlite.so
+bazelisk build --config=native_arch_linux -c opt //tensorflow/lite:libtensorflowlite.so
+# Create the directory for the tarball and move the resulting files into it
+rm -rf tensorflow-bazel
mkdir tensorflow-bazel
mkdir tensorflow-bazel/arm
mkdir tensorflow-bazel/k8
@@ -13,5 +20,8 @@
cp bazel-out/k8-opt/bin/tensorflow/lite/libtensorflowlite.so tensorflow-bazel/k8
# Copy header files to the include directory
- mkdir -p tensorflow-bazel/tensorflow/core/util
- rsync -zarv --include='*/' --include='*.h' --exclude='*' tensorflow/core/util tensorflow-bazel/tensorflow/core/util
\ No newline at end of file
+mkdir -p tensorflow-bazel/include/tensorflow/
+mkdir -p tensorflow-bazel/include/flatbuffers/
+rsync -zarv --include="*/" --include='*.h' --exclude='*' tensorflow/ tensorflow-bazel/include/tensorflow/
+rsync -zarv --include="*/" --include='*.h' --exclude='*' bazel-out/../../../external/flatbuffers/include/flatbuffers/ tensorflow-bazel/include/flatbuffers/
+tar zcvf tensorflow-${GIT_VERSION}.tar.gz tensorflow-bazel