Divulge HN: Educate an AI mannequin on Android without coding, construct your luxuriate in app with it

Divulge HN: Educate an AI mannequin on Android without coding, construct your luxuriate in app with it


  • English (this document)
  • Русский


This document will plod you by the steps for setting up your Android app that runs a deep discovering out checklist classification mannequin educated in Pocket AutoML and exported in TensorFlow Lite structure. The app will repeatedly classify despite it sees from the machine’s abet digicam.

This tutorial is essentially based fully totally on TensorFlow Lite checklist classification Android example application.
For an clarification of its supply code, glimpse
Explore the code.

When that it is probably going you’ll perchance perchance possess any points following this tutorial please contact me (the creator of Pocket AutoML) by process of e mail at or by setting up a GitHub bother.


  • Android Studio 4.2 (save in on a Linux, Mac or Windows machine)

  • [if not using an Android emulator] an Android machine in
    developer mode
    with USB debugging enabled and a USB cable (to connect an Android machine to your computer)

Step 1. Educate a mannequin in Pocket AutoML

  • Set up Pocket AutoML from Google Play Retailer and originate it

  • Salvage a role e.g. Kittens or Puppies by pressing + button

  • Salvage a class e.g. Kittens

  • Add example pictures of the category by taking photos with a digicam or selecting them from a storage

  • Return to the process quiz by pressing <- and repeat these steps for every class

  • Return to the process quiz by pressing <-, switch to the MODEL tab and press TRAIN

Step 2. Export a model in TF Lite format from Pocket AutoML


  • Swipe down on the status bar at the top of the screen to open the notification drawer and track the export progress. The export takes few minutes.

  • When the export is done, press Share Model on a notification to open the standard Android Sharesheet, chose a sharing method to send a model to your PC (e.g. send it to yourself via an email app like GMail or store it on your cloud storage like Google Drive or Dropbox)

Step 3. Clone the Pocket AutoML example source code

Run the following command to get the demo application.

git clone https://github.com/OutSorcerer/pocket-automl-android-tutorial

Open the example source code in Android Studio. To do this, open Android
Studio and select Open an existing project, setting the folder to

Unlike the original example, this one uses only TFLite Support library to avoid confusion. An alternative is TensorFlow Lite Task Library, see the README of the original example for details.

Step 4. Build the Android Studio project

Select Build -> Originate Mission and take a look at that the mission builds successfully.
The luxuriate in.gradle file will suggested you to get any lacking

Step 5. Set up and inch the app

Apply this step to construct definite that that the instance runs successfully for your atmosphere utilizing its constructed-in fashions. The next high-tail will camouflage easy how to add your custom mannequin from Pocket AutoML into the instance app.

Speed on a machine

Even as you is seemingly to be willing to take a look at the app on an Android machine, connect the machine to the computer and construct definite to approve any ADB
permission prompts that appear to your cellular phone. Click Speed -> Speed 'app' from the major menu of Android Studio. Pick
the deployment target in the linked devices to the machine on which the app
shall be save in. This can set up the app on the machine.

Speed on an an emulator

Even as you is seemingly to be willing to take a look at the app on an Android emulator

  • rob Tools -> AVD Manager -> Salvage Digital System...
  • exhaust a machine definition e.g. Pixel 2 (this controls its camouflage determination and density)
  • click on Next and rob a machine checklist, Android 11 (API level 30) is ceaselessly recommended, click on Download on the chosen machine checklist, await get to total, click on Next and Carry out
  • halt the AVD Manager, rob the newly created machine in a list of accessible devices and click on Speed -> Speed 'app' from the major menu of Android Studio

Even as you fancy to have to know extra, glimpse Salvage and space up digital devices in Android documentation.

To examine the app, originate the app known as Pocket AutoML Classify to your machine or emulator.
While you inch the app the first time, the app will quiz permission to safe entry to the digicam.
Re-installing the app might per chance perchance perchance require you to uninstall the previous installations.

Step 6. Add your mannequin from Pocket AutoML into the instance app

  • At this point that it is probably going you'll perchance perchance have to possess .zip file to your PC. Extract its contents into pocket-automl-android-tutorial/fashions/src/major/sources. You need to .tflite and .labels.txt there.

  • Initiate ClassifierPocketAutoML.java (by cl

NOW WITH OVER +8500 USERS. other folks can Be part of Knowasiak without cost. Take a look at in on Knowasiak.com
Read More

Charlie Layers

Charlie Layers

Fill your life with experiences so you always have a great story to tell