Although alwaysAI is focused on computer vision on the edge, you can easily install Ubuntu on your desktop, and do prototyping before going to the edge. In this article, I will show how to install the alwaysAI platform on your desktop using either a virtual machine (macOS, Windows) or native installation (Linux). If you are already running a Linux desktop you can skip down to the Installing alwaysAI Platform section.
Setting Up a Virtual Linux Operating Environment
The alwaysAI platform is a containerized system that requires Linux operating system to execute. Currently, I’m using a Mac PC running macOS as my desktop system. So, I will need to install a virtual machine on my desktop to support Linux. Users of Windows based PC's need to do the same thing. First step is to choose a virtual desktop manager and install it on your PC. VirtualBox from Oracle is my current preference, but there are others. For a complete overview of alternative virtual desktop managers see Aatif Khan’s article.
In your browser, go to the following website and download the appropriate version of VirtualBox software for your system (Windows, or MacOS) and install it. Next download Ubuntu 18.04.3 LTS desktop edition from this website.
Startup the VirtualBox Manager and press the new button (top left) and fill out the OS configuration form:
- Name: alwaysaAI Platform
- Type: Linux
- Version: Ubuntu (64-bit)
Give the VirtualBox the following configuration parameters:
- 2048MB of memory for now.
- 2 CPUs
- 40Gb dynamically allocated VDI (VirtualBox Disk Image)
In the storage section of the VirtualBox Manager on the optical drive folder, select the Ubuntu disk image from where you downloaded it to your hard drive.
Next, click the green start arrow on the VirtualBox Manager to begin the Install Ubuntu Desktop, follow the install wizard to complete the process. Once the installation is complete and the system has rebooted, open a terminal and type sudo apt-get update && sudo apt-get upgrade -y. To access USB and other utilities, like clipboard, you need to install Oracle’s VirtualBox Guest Additions: in your browser go to the following website http://download.virtualbox.org/virtualbox/5.2.32/VBoxGuestAdditions_5.2.32.iso and download the software. Make sure the version number matches the VirtualBox software you are using. In the VirtualBox Manager, load the software image into the virtual CD ROM drive.
On the Ubuntu Desktop, click the CD ROM icon to install the software and reboot the system. Once the system has rebooted, you are ready to install the alwaysAI platform.
Installing Supporting Software
The first step is to install nodejs, npm and docker on your system.
Open terminal on your Ubuntu desktop, and type the following command: sudo apt-get update && sudo apt-get install nodejs -y.
Once the install ubuntu desktop is complete at the command, prompt type nodejs --version, it should be version 8 or higher to work with alwaysAI software.
Next, we’ll install npm software which allows you to manage nodejs software applications.
At the command prompt, enter sudo apt-get install npm -y. Again, check the version number by typing npm --version at the command prompt. You will need version 3.5 or higher to work with the alwaysAI software.
Before you do a fresh install of docker software, it is recommended that you remove any existing installs: open a terminal on the install Ubuntu desktop and type sudo apt-get remove docker docker-engine docker.io -y; it’s okay if the program returns no software to remove.
Next, at the command prompt, enter sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y, to install the docker software dependencies.
Once the dependencies are installed, we need to install the docker GPG security feature and generate keys by entering curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - on the command prompt.
After you completed adding the security keys, install the docker repository by entering sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable", then update the repository you just installed by running sudo apt-get update.
Next, install the latest version of docker by entering sudo apt-get install docker-ce and add your user id to the docker group by entering sudo usermod -aG docker <user id> (or try sudo usermod -aG docker $USER).
To activate the changes to the docker group, type and enter newgrp docker at the command prompt.
Lastly, to test the docker installation at the command prompt enter docker run hello-world.
Installing alwaysAI Software
Now that all the supporting software is installed, you are ready to install the alwaysAI platform on your Ubuntu system. The first step in the installation process is to install alwaysAI’s CLI tool. At the command prompt enter sudo npm install -g alwaysai. Run aai -v to check the version number and whether the installation worked as expected.
The computer vision software from alwaysAI is called edgeIQ and is packaged in a docker image. To install the software image on your system at the command line type docker pull alwaysai/edgeiq to bring down the latest software image. You have now completed the software installation of alwaysAI product.
To test your installation, open a browser on your Ubuntu desktop and login into alwaysAI website. Go to starter applications section and download the starter applications to your Ubuntu system (https://dashboard.alwaysai.co/docs/reference/starter_applications).
On your Ubuntu desktop, within alwaysai-starter-application directory, go into the object_dector directory. In terminal window, login into alwaysAI CLI by typing in aai user login. Once you completed the login enter aai app deploy at the command line. When prompted for destination choose local computer.
At the command prompt, type in aai app start, to run your first starter application and verify the installation.
Myriad Accelerator Support
The alwaysAI platform comes with support for Intel’s Myriad processor built into the platform. Intel packages the Myriad accelerators into USB 3.0 called Neural Compute Stick 2 (NCS2) that you can attach to your PC via the USB port. You can order NCS2 from Amazon for $68.99 USD. To access this USB device from a virtualized environment, you will need to create two USB filters. Before beginning, make sure the Ubuntu virtual machine is shut down.
Next, enable the USB 3.0 controller and then create two USB whitelist filters for the virtual machine. As mentioned earlier, the USB 3.0 feature requires the VirtualBox Guest Additions software be installed. With the Ubuntu virtual machine selected on VirtualBox Manager open settings, under Ports section select USB and check “Enable USB Controller”.
Next check “USB 3.0 (xHCI)” and then create two filters, first one named Myriad Filter One with Vendor ID of 03e7 and second one named Myriad Filter Two with a Vendor ID of 040e. All other fields in the filters should be blank. Once complete, close the configuration panel and then restart the Ubuntu virtual machine.
Testing NCS2 Configuration
With the Ubuntu virtual machine up and running, go back to the object detection folder and edit the app.py file with your favorite editor.
Find the line with obj_detect.load(engine=edgeiq.Engine.DNN) and change it to obj_detect.load(engine=edgeiq.Engine.DNN_OPENVINO), and save the file.
Redeploy the software to the container by entering the following command aai app deploy && aai app start.
In the terminal window, you should see Accelerator: Accelerator.MYRIAD
Using the Host Computer's Camera from the Virtual Machine
If you want to run applications from your virtual machine that needs access to the host systems camera, you will need to enable that using VirtualBox's command line interface. On your host system with the virtual machine running, open a terminal and enter the following command:
VBoxManage list webcams
Next enter VboxManage controlvm "vmname" webcam attach .1. This will enable your application to access the host systems webcam.