This portal has been archived. Explore the next generation of this technology.

Object detection • MLPerf inference • TFLite CPU • COCO • 50 images validation • Android • benchmark • Portable Workflows

solution:demo-obj-detection-coco-tflite-cpu-benchmark-android-portable-workflows (v1.4.0)

Portable solution description  

Install and run this solution on your platform in several simple steps. Our goal is to make it simpler to reproduce results from research papers, participate in crowd-benchmarking, and enable "live" papers.
Don't hesitate to get in touch if you encounter any issues or would like to discuss this community project!

Check the prerequisites for your system  

Install manually from the command line (to be automated in the future):
# Tested on Ubuntu 18.04
# (including Docker and Windows 10 Sybsystem for Linux)

# These dependencies are needed to cross-compile for Android and rebuild COCO API:

# We tested this solution with the Android NDK GCC though LLVM should work too!

 sudo apt update
 sudo apt install git wget libz-dev curl cmake
 sudo apt install gcc g++ autoconf autogen libtool

# Android SDK and NDK:
  sudo apt install android-sdk
  sudo apt install google-android-ndk-installer


###### Extra notes ######

The installation is a bit trickier if you use Windows with Ubuntu Subsystem -
we plan to automate it in the future!

First, you need to connect your Android device via adb on Windows
and then use adb in Linux to connect to Windows adb server.
In such case you need to make sure that both adb version are the same!

For example, you can test adb version on Windows as follows:
 C:> adb version
 Android Debug Bridge version version 1.0.41

Then on Linux:
 adb version

 Android Debug Bridge version 1.0.39

Since versions are different, we should install correct adb version on Linux into the Python environment of this solution:

  wget https://dl.google.com/android/repository/platform-tools_r29.0.3-linux.zip
  unzip platform-tools_r29.0.3-linux.zip
  cd platform-tools
  mv * ../venv/bin
  cd ..

Now check that adb version is correct:
  which adb

  adb version

 > Android Debug Bridge version 1.0.41
 > Version 29.0.3-5806383

 If you don't see devices, kill the adb server in Linux:

  adb kill-server

 Start it in Windows
 C:> adb start-server

 And then check devices:

  adb devices

Finally, add adb to the CK env:
 $ ck detect soft:tool.adb --full_path=$PWD/venv/bin/adb

Install cBench (docs)

Install cBench from the command line (a small Python library to manage CK solutions):
pip3 install cbench
 or 
python3 -m pip install cbench
 or
pip install cbench 
Note that you may need to add the --user flag if you install in your user space, i.e. "python3 -m pip install cbench --user"

Init this solution with the portable workflow on your machine

Run manually from your command line (cBench will attempt to automatically adapt this workflow to your system - you may need to press Enter several times to select default answers for some questions):
cb init demo-obj-detection-coco-tflite-cpu-benchmark-android-portable-workflows

Start cBench (status: disconnected)

cb start

Participate in collaborative crowd-benchmarking of this solution

or start crowd-benchmarking manually from the command line:
cb benchmark demo-obj-detection-coco-tflite-cpu-benchmark-android-portable-workflows

Run this workflow locally

or start local run manually from the command line:
cb run demo-obj-detection-coco-tflite-cpu-benchmark-android-portable-workflows

  # Note that the following CK program pipeline will be executed:
  ck compile program:object-detection-tflite-benchmark --cmd_key=default --speed
  ck run program:object-detection-tflite-benchmark --cmd_key=default

Successfully tested configuration

Host OS: linux-64 (Ubuntu 18.04.3 LTS)
Target OS: android23-arm64 (Android 9)
Target machine: SAMSUNG SM-G950F
Target CPUs:
Python min version: 3.6
Python max version: 3.7.99

Dependencies    

Reused CK components

These components are automatically installed by cBench from this portal:
cb download --version=1.0.0 --force program:object-detection-tflite-benchmark --all
cb download --version=1.0.0 --force package:model-tf-mlperf-ssd-mobilenet --all
cb download --version=1.0.0 compiler:gcc*

ck install package:lib-tflite-1.13.1-src-static --target_os=android23-arm64

ck install package --tags=model,tf,object-detection,mlperf,ssd-mobilenet,non-quantized

ck install package --tags=lib,python-package,numpy
ck install package --tags=lib,python-package,scipy --force_version=1.2.1
ck install package --tags=lib,python-package,matplotlib
ck install package --tags=lib,python-package,pillow
ck install package --tags=lib,python-package,cython
ck install package --tags=lib,python-package,cv2,opencv-contrib-python --force_version=3.4.3.18

ck install package:lib-tflite-1.13.1-src-static --target_os=android23-arm64

ck install package:tool-coco-codereef

ck install package:dataset-coco-2017-val-small

ck compile program:object-detection-tflite-benchmark --speed --target_os=android23-arm64

Comments  

Please log in to add your comments!
If you notice any inapropriate content that should not be here, please report us as soon as possible and we will try to remove it within 48 hours!