Android object detection on Camera using tflite interpreter
CameraX-tflite
Android Kotlin and Java codes object detection on phone Camera using tflite interpreter
Build instruction:
Run below commands in Linux command line to installing Java:
sudo apt install openjdk-8-jdk-headless
Then run to installing Android SDK:
wget https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
mkdir -p Android/Sdk
unzip commandlinetools-linux-9123335_latest.zip -d Android/Sdk
export ANDROID_HOME=$HOME/Android/Sdk
export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/cmdline-tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools:$PATH"
sdkmanager --sdk_root=${ANDROID_HOME} "tools"
sdkmanager --update
sdkmanager --list
sdkmanager --install "build-tools;33.0.3" "platform-tools" "platforms;android-33" "tools"
sdkmanager --licenses
Note: Sometimes “$ANDROID_HOME/cmdline-tools/bin” path is “$ANDROID_HOME/cmdline-tools/latest/bin” instead, So check it manually.
Then run to building APK:
git clone https://github.com/marzban2030/CameraX-tflite
cd CameraX-tflite
./gradlew assembleDebug
Or:
Build APK in Google Colab:
Run below commands in Google Colab:
!wget https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
!mkdir -p sdk
!unzip commandlinetools-linux-9123335_latest.zip -d sdk
!yes | ./sdk/cmdline-tools/bin/sdkmanager --sdk_root=/content/sdk "tools"
!git clone https://github.com/marzban2030/CameraX-tflite
!chmod -c 755 /content/CameraX-tflite/gradlew
!export ANDROID_HOME=/content/sdk && cd /content/CameraX-tflite && ./gradlew assembleDebug
from google.colab import files
files.download('path_to_APK')
path_to_APK in Google Colab:
/content/CameraX-tflite/tflite/build/outputs/apk/debug/tflite-debug.apk