All Projects → androidthings → Sample Tensorflow Imageclassifier

androidthings / Sample Tensorflow Imageclassifier

Licence: apache-2.0
Classify camera images locally using TensorFlow models

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Sample Tensorflow Imageclassifier

photobooth
Cloud-connected talking photobooth using TensorFlow
Stars: ✭ 40 (-93.58%)
Mutual labels:  android-things
androidthings-weatherstation
Codelab and solution for the Android Things Weatherstation
Stars: ✭ 16 (-97.43%)
Mutual labels:  android-things
New Project Template
Stars: ✭ 265 (-57.46%)
Mutual labels:  android-things
sample-lowpan
Discover and connect to Thread mesh networks on Android Things
Stars: ✭ 28 (-95.51%)
Mutual labels:  android-things
atdocs
Android Things Translation 中文翻译
Stars: ✭ 19 (-96.95%)
Mutual labels:  android-things
ThingsCommander
Things Commander System, based on Android Things developer preview 2
Stars: ✭ 13 (-97.91%)
Mutual labels:  android-things
Sample Simplepio
Basic Peripheral I/O examples with Android Things
Stars: ✭ 191 (-69.34%)
Mutual labels:  android-things
Sample Googleassistant
Google Assistant API sample for Android Things
Stars: ✭ 460 (-26.16%)
Mutual labels:  android-things
sensorhub-cloud-iot
Sensor-based data collection device publishing to Cloud IoT Core
Stars: ✭ 73 (-88.28%)
Mutual labels:  android-things
android-things-samples
Samples and projects for platforms running Android Things
Stars: ✭ 23 (-96.31%)
Mutual labels:  android-things
Fool
Simple Russian voice assistant based on Android Things and Raspberry Pi 3
Stars: ✭ 26 (-95.83%)
Mutual labels:  android-things
edison-candle
Production sample using Android Things
Stars: ✭ 42 (-93.26%)
Mutual labels:  android-things
native-libandroidthings
NDK library for exposing Peripheral I/O APIs in C/C++
Stars: ✭ 28 (-95.51%)
Mutual labels:  android-things
FRILLER
FRILLER is a 3D printed compact robot that can change the radius of its wheels to overcome obstacles.
Stars: ✭ 15 (-97.59%)
Mutual labels:  android-things
Doorbell
Cloud-based photo doorbell with companion app
Stars: ✭ 298 (-52.17%)
Mutual labels:  android-things
Weatherstation
Sensor-based peripheral sample using Android Things
Stars: ✭ 210 (-66.29%)
Mutual labels:  android-things
android-things-rc522
Android library to communicate with RFID Module RC522
Stars: ✭ 44 (-92.94%)
Mutual labels:  android-things
Contrib Drivers
Open source peripheral drivers
Stars: ✭ 539 (-13.48%)
Mutual labels:  android-things
Lantern
Transform any surface into mixed-reality using Raspberry Pi, a laser projector, and Android Things.
Stars: ✭ 403 (-35.31%)
Mutual labels:  android-things
sample-uartloopback
Echo received characters over a UART with Android Things
Stars: ✭ 71 (-88.6%)
Mutual labels:  android-things

TensorFlow Lite IoT Image Classifier

This sample demonstrates how to run TensorFlow Lite inference on Android Things. Push a button to capture an image with the camera, and TensorFlow Lite will tell you what it is! Follow the Image Classifier Codelab step-by-step instructions on how to build a similar sample.

Introduction

When a button is pushed or when the touchscreen is touched, the current image is captured from the camera. The image is then converted and piped into a TensorFlow Lite classifier model that identifies what is in the image. Up to three results with the highest confidence returned by the classifier are shown on the screen, if there is an attached display. Also, the result is spoken out loud using Text-To-Speech to the default audio output.

This project is based on the TensorFlow Android Camera Demo TF_Classify app and was adapted to use TensorFlow Lite, a lightweight version of TensorFlow targeted at mobile devices. The TensorFlow classifier model is MobileNet_v1 pre-trained on the ImageNet ILSVRC2012 dataset.

This sample uses the TensorFlow Lite inference library and does not require any native build tools. You can add the TensorFlow Lite inference library to your project by adding a dependency in your build.gradle, for example:

dependencies {
    compile 'org.tensorflow:tensorflow-lite:0.1.1'
}

Note: this sample requires a camera. Find an appropriate board in the documentation.

Screenshots

TensorFlow Lite image classifier sample demo

(Watch the demo on YouTube)

Pre-requisites

  • Android Things compatible board and an attached camera
  • Android Studio 2.2+
  • The following optional components:
    • one button and one resistor for triggering the camera
    • one LED and one resistor for the "ready" indicator
    • speaker or headphones for Text-To-Speech results
    • touchscreen or display for showing results

Schematics

Schematics

Run on Android Things Starter Kit

If you have an Android Things Starter Kit, you can easily run this sample on your i.MX7D development board from the Android Things Toolkit app.

To run the sample on your i.MX7D development board:

  1. Set up your device using Toolkit
  2. Navigate to the Apps tab
  3. Select Run next to the Image Classifier sample.
  4. Press the "A" button on your Rainbow HAT or tap on the display to take a photo.

Running Image Classifier Sample on Toolkit

Build and Install

On Android Studio, click on the "Run" button. If you prefer to run on the command line, type

./gradlew installDebug
adb shell am start com.example.androidthings.imageclassifier/.ImageClassifierActivity

If you have everything set up correctly:

  1. Wait until the LED turns on
  2. Point the camera to something like a dog, cat or a furniture
  3. Push the button to take a picture
  4. The LED should go off while running. In a Raspberry Pi 3, it takes about 500 millisecond to capture the picture and run it through TensorFlow, and some extra time to speak the results through Text-To-Speech
  5. Inference results will show in logcat and, if there is a display connected, both the image and the results will be shown
  6. If a speaker or headphones are connected, the results will be spoken via text to speech

Enable auto-launch behavior

This sample app is currently configured to launch only when deployed from your development machine. To enable the main activity to launch automatically on boot, add the following intent-filter to the app's manifest file:

<activity ...>

   <intent-filter>
       <action android:name="android.intent.action.MAIN"/>
       <category android:name="android.intent.category.HOME"/>
       <category android:name="android.intent.category.DEFAULT"/>
   </intent-filter>

</activity>

License

Copyright 2018 The Android Things Samples 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].