From 171a45545409c30d7ae1e68b0fec0aab1a4e1ca7 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Thu, 10 Sep 2020 07:48:08 +0200 Subject: [PATCH 1/7] Make it executeable on CLI --- build_android_examples.sh | 0 build_ios_examples.sh | 0 setup_android_sdk_and_ndk.sh | 0 setup_opencv.sh | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build_android_examples.sh mode change 100644 => 100755 build_ios_examples.sh mode change 100644 => 100755 setup_android_sdk_and_ndk.sh mode change 100644 => 100755 setup_opencv.sh diff --git a/build_android_examples.sh b/build_android_examples.sh old mode 100644 new mode 100755 diff --git a/build_ios_examples.sh b/build_ios_examples.sh old mode 100644 new mode 100755 diff --git a/setup_android_sdk_and_ndk.sh b/setup_android_sdk_and_ndk.sh old mode 100644 new mode 100755 diff --git a/setup_opencv.sh b/setup_opencv.sh old mode 100644 new mode 100755 From 63fccc474fac9a51de20d922e5dad6b28b288862 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Thu, 10 Sep 2020 07:56:42 +0200 Subject: [PATCH 2/7] Make install Android more verbose --- setup_android_sdk_and_ndk.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup_android_sdk_and_ndk.sh b/setup_android_sdk_and_ndk.sh index 4236d84d3..c8de1df5e 100755 --- a/setup_android_sdk_and_ndk.sh +++ b/setup_android_sdk_and_ndk.sh @@ -32,6 +32,10 @@ then echo "Found existing \$ANDROID_HOME="$ANDROID_HOME" and \$ANDROID_NDK_HOME="$ANDROID_NDK_HOME echo "Bazel will locate Android SDK and NDK automatically." exit 0 +else + echo "You can specify ANDROID_HOME and ANDROID_NDK_HOME, currently I've these variables:" + echo ANDROID_HOME=$ANDROID_HOME + echo ANDROID_NDK_HOME=$ANDROID_NDK_HOME fi android_sdk_path=$1 From 2c19b194af3d387937550d0c72aead78e4c11821 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Fri, 25 Dec 2020 10:52:53 +0100 Subject: [PATCH 3/7] temp skip docker build --- Dockerfile | 69 ------------------------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index dc3b034a2..000000000 --- a/Dockerfile +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2019 The MediaPipe Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM ubuntu:18.04 - -MAINTAINER - -WORKDIR /io -WORKDIR /mediapipe - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - ffmpeg \ - git \ - wget \ - unzip \ - python3-dev \ - python3-opencv \ - python3-pip \ - libopencv-core-dev \ - libopencv-highgui-dev \ - libopencv-imgproc-dev \ - libopencv-video-dev \ - libopencv-calib3d-dev \ - libopencv-features2d-dev \ - software-properties-common && \ - add-apt-repository -y ppa:openjdk-r/ppa && \ - apt-get update && apt-get install -y openjdk-8-jdk && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN pip3 install --upgrade setuptools -RUN pip3 install wheel -RUN pip3 install future -RUN pip3 install six==1.14.0 -RUN pip3 install tensorflow==1.14.0 -RUN pip3 install tf_slim - -RUN ln -s /usr/bin/python3 /usr/bin/python - -# Install bazel -ARG BAZEL_VERSION=3.4.1 -RUN mkdir /bazel && \ - wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\ -azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \ - wget --no-check-certificate -O /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ - chmod +x /bazel/installer.sh && \ - /bazel/installer.sh && \ - rm -f /bazel/installer.sh - -COPY . /mediapipe/ - -# If we want the docker image to contain the pre-built object_detection_offline_demo binary, do the following -# RUN bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/demo:object_detection_tensorflow_demo From 29e645760f7987c526b0f9c47e11e38ab16e2e83 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Fri, 25 Dec 2020 10:47:37 +0100 Subject: [PATCH 4/7] Build on CI --- .github/workflows/CI.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 000000000..ef54e27ff --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,33 @@ +name: PullRequest + +on: [pull_request] + +jobs: + buildTest: + name: Build + runs-on: macOS-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Install Android SDK + uses: malinskiy/action-android/install-sdk@release/0.1.0 + - name: Install prerequisite + run: | + brew install opencv@3 + brew install python + python --version + pip3 install --user six + - name: Build project + run: | + export ANDROID_HOME=/Users/runner/Library/Android/sdk + export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle + echo a | ./build_android_examples.sh + - name: Show result + run: git status + - name: Archive APK + uses: actions/upload-artifact@v2.2.1 + if: ${{ always() }} + with: + name: APKs + path: ./*.apk + if-no-files-found: error From b8803c43225f3e74da24de6072d733e57914943d Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 28 Dec 2020 15:35:11 +0100 Subject: [PATCH 5/7] Build MultihandTracking AAR source https://github.com/google/mediapipe/blob/master//docs/getting_started/android_archive_library.md#steps-to-build-a-mediapipe-aar build with bazel build -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar --- .github/workflows/CI.yml | 11 ++++++----- .../mediapipe/apps/multihandtrackinggpu_aar/BUILD | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar/BUILD diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ef54e27ff..47181cf5d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,13 +21,14 @@ jobs: run: | export ANDROID_HOME=/Users/runner/Library/Android/sdk export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle - echo a | ./build_android_examples.sh + bazel build -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar - name: Show result run: git status - - name: Archive APK + - name: Search AAR + run: find bazel-bin/mediapipe/ -name *.aar | xargs ls -la + - name: Archive AAR uses: actions/upload-artifact@v2.2.1 if: ${{ always() }} with: - name: APKs - path: ./*.apk - if-no-files-found: error + name: AAR-library + path: bazel-bin/mediapipe//examples/android/src/java/com/google/mediapipe/apps/**/*.aar diff --git a/mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar/BUILD b/mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar/BUILD new file mode 100644 index 000000000..cb0f882a5 --- /dev/null +++ b/mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar/BUILD @@ -0,0 +1,6 @@ +load("//mediapipe/java/com/google/mediapipe:mediapipe_aar.bzl", "mediapipe_aar") + +mediapipe_aar( + name = "mp_multi_hand_aar", + calculators = ["//mediapipe/graphs/hand_tracking:mobile_calculators"], +) From e98bc9a84c8f6342fba05d1fcd31e59f13101c3c Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 28 Dec 2020 15:39:25 +0100 Subject: [PATCH 6/7] x86 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 47181cf5d..c1f9050aa 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: run: | export ANDROID_HOME=/Users/runner/Library/Android/sdk export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle - bazel build -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar + bazel build -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a,x86_64,x86 mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar - name: Show result run: git status - name: Search AAR From 28cf053bf658f4fef4ae80845e8fc199cf91d884 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Tue, 29 Dec 2020 09:17:54 +0100 Subject: [PATCH 7/7] x86_64 only --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c1f9050aa..8b1f1fefd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: run: | export ANDROID_HOME=/Users/runner/Library/Android/sdk export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle - bazel build -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a,x86_64,x86 mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar + bazel build -c opt --fat_apk_cpu=x86_64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/multihandtrackinggpu_aar:mp_multi_hand_aar - name: Show result run: git status - name: Search AAR