- aitrios-sample-application-reference Zone Detection
This repository provides a reference implementation of a full solution using AITRIOS™. Building up on top of an existing AI model and Edge app, this reference solution implements a zone detection solution.
It consists of a Backend that interacts with Console for AITRIOS using the Console's REST API that is paired with a UI that retrieves the meta-data from the Console for AITRIOS and displays the image together with the detected objects. The edge application calculates the overlap of the detections with a configurable zone which are shown in the UI.
![]()
The repository is organized as follows:
├── .devcontainer/
├── .github/workflows/
├── .vscode/
├── ai_model/
├── edge_app/
├── backend/
├── frontend/
├── docs/
This directory contains the files necessary to run this project in a development container (dev container), be it in GitHub Codespaces or Visual Studio Code. More details how to use it are provided in the USAGE.md document.
Contains GitHub Actions workflows for continuous integration and deployment.
This directory contains the launch.json file with configuration for a debugger in Visual Studio Code.
Contains materials necessary to create an ai model that shall be deployed on device to enable running the reference solution. Consult model_id.md for more details.
This directory contains the Markdown files that explain how to create edge applications that shall be deployed on device to enable running the reference solution.
edge_app_v1.mddefines the process of obtaining edge application related artifacts for a camera with the firmware version v1 and AITRIOS Console v1.edge_app_v2.mddefines the process of obtaining edge application related artifacts for a camera with the firmware version v2 and AITRIOS Console v2.
Contains the backend application built with FastAPI.
For more details on this directory's structure, check its README.md.
This directory contains the frontend built with React and TypeScript.
For more details on its structure, check its README.md.
This directory contains project documentation.
The application has been tested and verified to work with:
- Operating Systems: Ubuntu 22.04
- Python: 3.10-3.13
- Node.js: 20
To get started with the Zone Detection Application, follow the steps below.
To run this reference solution you need to have a CSV26 camera to be enrolled to your project in the Aitrios Console. In addition, it should have deployed a zone detection Edge application and a compatible object detection AI model. These artifacts should first be obtained locally, then imported to the Console and finally be deployed on device.
Note
For basic device and console operation, please refer to the Console V2 Device Setup Guide and Console V2 User Manual, or Console V1 Device Setup Guide and Console V1 User Manual.
The reference solution requires a model and an edge application to be deployed on the device. In some cases, the process for obtaining and deploying these artifacts varies between versions of Console for AITRIOS, V1 and V2. When applicable, such difference is directly indicated in further description.
- In order to obtain the model, follow the description in ai_model/model.md of this repository.
The AI model is obtained as a
packerOut.ziporyoloXXX_imx.onnxfile and needs to be imported to the AITRIOS Console and then deployed to the device. - To import the AI model into Console, follow the Console V2 Deployment Guide for PyTorch AI Model or Console V1 PyTorch Model Deployment Guide.
-
In order to get the Edge Application, follow the description in edge_app/edge_app_v1.md of this repository for V1 or the description in edge_app/edge_app_v2.md for V2.
NOTE
Note that for V1 the Edge Application artifact would be a single file of type.wasm/.aot, while V2 would result in an Edge Application Package. -
For instructions on how to import an Edge Application into Console and deploy it to the device, check the Console V2 User Manual or Console V1 User Manual.
v1: Import and Bind Command Parameter File
To control the device's inference operation, a Command Parameter file must be bound to the device. While a user can provide an initial command parameter file themselves through the Console, it is not necessary since the current application automatically creates a new Command Parameter file and binds it to a selected device in case when no initial is available. Console User Manual provides instructions on importing Command Parameter file into Console, and on binding Command Parameter to the device.
v2: update Edge Appplication state with DTDL
Starting from version 2, AITRIOS is using DTDL (short for "Digital Twins Definition Language") to define the Edge Application Interface. While there
are numerous configurations, the reference solution requires only some of them to be specified. In particular, one has to correctly configure the port settings that define methods and a storage for the upload of the edge application output. They correspond to the content of the field edge_app.common_settings.port_settings.
To do so, you first need to obtain the ID of your project (YOUR_PROJECT_ID) from AITRIOS Portal and specify it in the "storage_name" for the "input_tensor" field. You can find YOUR_PROJECT_ID in the browser url on the website of the portal, after logging in and selecting a project. The browser url takes the form PORTAL_URL/project/YOUR_PROJECT_ID/marketplace/product.
You can then apply the following configuration to the Edge Application deployed on Console.
{
"edge_app": {
"common_settings": {
"port_settings": {
"metadata": {
"path": "",
"method": 0,
"enabled": true,
"endpoint": "",
"storage_name": ""
},
"input_tensor": {
"path": "YOUR_DEVICE_ID/image/FOLDER_NAME",
"method": 1,
"enabled": true,
"endpoint": "",
"storage_name": "YOUR_PROJECT_ID"
}
}
}
}Note
For general details on the Edge Application interface, check the Edge Application Interface JSON Specification page on the AITRIOS developer website. Pay attention to theport_settingssubsection
For details on the custom settings for the zone detection Edge Application, check its README.md.
Ensure you have the following installed on your system:
These are necessary to run the application in a containerized environment.
Below are the links to the instructions on how to install both Docker and Docker Compose in most common operating systems:
- Linux (Ubuntu): See instructions here.
- Linux (other distributions): See instructions here.
- Windows: See instructions here.
- macOS: See instructions here.
-
Clone or Fork: Clone or fork this repository into your GitHub account.
-
Create a Codespace:
- Navigate to the cloned/forked repository.
- Click the "+" button to create a codespace.
- For more details, see How to Create a Codespace.
-
Access and Monitor:
- The application will start automatically once the setup completes.
- To view deployment logs, press
Ctrl + Shift + P(orCmd + Shift + Pon Mac) and select "View Creation Logs."
-
Open Application:
- Use the URL displayed under frontend port 3000 in the "Ports" tab to access your application.
Clone the repository:
git clone git@github.com:SonySemiconductorSolutions/aitrios-sample-application-reference.git
cd aitrios-sample-application-reference/backendTo run the full application, use the provided Docker Compose setup:
docker compose --env-file backend/.env upTo run only the backend or frontend separately, execute:
docker compose --env-file backend/.env up backenddocker compose up frontendNote
This approach doesn't support debugging. To run app in the debugging mode you should start frontend and backend separately.
For more detailed usage instructions, see the frontend README.
For more detailed usage instructions, see the backend README.
Before using Codespaces, please read the Site Policy of GitHub and understand the usage conditions.