Deploying computer vision applications with Balena and alwaysAI

By Jason Koo • May 05, 2020

This short guide will show you how to combine alwaysAI and Balena to easily deploy a computer vision application to multiple devices with a single command.

alwaysAI plus Balena multiple devices

Balena is an easy to use, yet powerful cloud based fleet management tool for enabling, maintaining and managing applications on a variety of device architectures. This is a perfect fit with alwaysAI’s capability of running computer vision applications on nearly any single board computer or edge device.


To get started, you’ll need the following:


The following steps can be used with any alwaysAI app. If you don’t have one ready yet, this sample app can be used to follow along with.


  1. Create a Balena App with Balena’s dashboard. The application name you choose here is what you’ll use instead of the <balena_app_name> placeholders in the following steps.
  2.  Install the appropriate Balena OS image onto your target device(s)
  3.  **Downloading models for deployment by running ALWAYSAI_HOME=$(pwd) aai app install
  4.  *Create a "Dockerfile.template" file with the contents:
    • FROM alwaysai/edgeiq:0.13.0
    • WORKDIR /app
    • COPY . ./
    • CMD ["python3",""]
  5. *Push upwith Balena’s CLI command to your Balena app: balena push <balena_app_name>`

*Steps 3-5 can be executed via this convenience gist. Just download and run it, or invoke it remotely with the following curl command:

curl | sh -s <balena_app_name>

**Step 3 on a linux system will fail if ALWAYSAI_HOME is not set prior to running this command.

If successful, you should see something like the following in your console:

Screenshot of the build finished imagen from balena

And from your Balena dashboard you should see something similar to:
Balena dashboard

If you have a computer on the same network as the device, you can connect to the debug streamer by entering the device IP address and port 5000 in any browser, ie, and see something like:
Balena platform

That’s it. So long as you use Balena to add additional devices, code from an alwaysAI application deployed this way will automatically update and run on all the devices added. If you’re not already an alwaysAI user, register today at:

By Jason Koo • May 05, 2020

Developer stories to your inbox.

Subscribe to the Developer Digest, a monthly dose of all things code.

You may unsubscribe at any time using the unsubscribe link in the digest email. See our privacy policy for more information.

alwaysAI Ad
stylized image of a computer chip

Sign up today and start your project

We can't wait to see what you'll build!