Get a Real-time Object Detector Running


The starter applications are the quickest way to get started with the alwaysAI platform after you set up your development computer. Below you will find steps on how to install and run the real-time object detector starter application.

Download the Starter Applications

To get started with the object detector, first download all of the starter applications (unless you have already done so):

$ aai get-starter-apps

Configure the Application

You can run your application either remotely on an edge device, or locally on your computer if you are running Windows or Linux.

Please choose a method below:

To install and run the application on your Windows computer, open your terminal and navigate to the realtime_object_detector starter application directory on your development machine. Then run the following command:

$ aai app install

This command prompts you for your alwaysAI account credentials and then installs into the application directory the application’s models and a Python virtual environment (venv).

Start the Application

Now that everything your application needs to run on your laptop is in place, start it with the command:

$ aai app start

The log output from  app.py  is forwarded through the CLI to your development terminal. The labels the model is trained on will be printed to the terminal.

The starter applications also expose a graphical web interface while the application is running. Once the app starts, a log will be printed with the link:

[INFO] Streamer started at http://localhost:5000

Open that URL in a browser to see the video and text data generated by the app.

Stop the application: Hit CTRL-C on your keyboard to send a termination signal to your application.

To deploy an application locally on your development machine running Linux,  navigate to the realtime_object_detector starter application directory in your terminal :

$ cd alwaysai-starter-apps/realtime_object_detector

Then run the following command:

$ aai app deploy

This command prompts you for your alwaysAI account credentials and the target where you would like the application to run. Select the Your local computer option when prompted.

The first time you run this command, the “Build docker image” step can take several minutes to download the edgeIQ docker image.

Start the Application

Now that everything your application needs to run on your laptop is in place, start it with the command:

$ aai app start

The log output from  app.py  is forwarded through the CLI to your development terminal. The labels the model is trained on will be printed to the terminal.

The starter applications also expose a graphical web interface while the application is running. Once the app starts, a log will be printed with the link:

[INFO] Streamer started at http://localhost:5000

Open that URL in a browser to see the video and text data generated by the app.

Stop the application: Hit CTRL-C on your keyboard to send a termination signal to your application.

To deploy an application from your development machine to your edge device,  navigate to the realtime_object_detector starter application directory in your terminal:

$ cd alwaysai-starter-apps/realtime_object_detector

Then run the following command:

$ aai app deploy

This command prompts you for your alwaysAI account credentials and the target where you would like the application to run. Select the Remote device option if prompted, then enter the hostname (with optional username e.g. pi@1.2.3.4 ) of the target device, the ssh password for the device, and any other necessary information.

The first time you run this command, the “Build docker image” step can take several minutes to download the edgeIQ docker image.

Start the Application

Now that everything your application needs to run on your laptop is in place, start it with the command:

$ aai app start

The log output from  app.py  is forwarded through the CLI to your development terminal. The labels the model is trained on will be printed to the terminal.

The starter applications also expose a graphical web interface while the application is running. Once the app starts, a log will be printed with the link:

[INFO] Streamer started at http://localhost:5000

Open that URL in a browser to see the video and text data generated by the app.

Stop the application: Hit CTRL-C on your keyboard to send a termination signal to your application.

Change the Computer Vision Model

Now that you have a starter application up and running, it’s easy to modify your application to use a different model and see how it behaves. Explore the alwaysAI Model Catalog to find models that fit your needs. As an example, let’s change the model in the realtime_object_detector starter application.

By default, the realtime_object_detector app uses the alwaysai/MobileNetSSD model which was trained on the Pascal VOC dataset and can detect 20 unique objects. Let’s switch to the alwaysai/ssd_mobilenet_v1_coco_2018_01_28 model, which was trained on the COCO dataset and can detect 100 unique objects.

  1. Add the new model to your application configuration:

     $ aai app models add alwaysai/ssd_mobilenet_v1_coco_2018_01_28
    
  2. Update the ObjectDetection instantiation in app.py to use the new model:

    Replace

     obj_detect = edgeiq.ObjectDetection("alwaysai/mobilenet_ssd")
    

    with

     obj_detect = edgeiq.ObjectDetection("alwaysai/ssd_mobilenet_v1_coco_2018_01_28")
    
  3. Deploy the updated application to your target device.

    Deploy locally on Windows:

     $ aai app install
    

    Deploy to a remote device:

     $ aai app deploy
    
  4. Start the application:

     $ aai app start
    
  5. (Optional) Remove the old model from your application configuration:

     $ aai app models remove alwaysai/mobilenet_ssd