Skip to content

Commit

Permalink
Message Broker update for release 12.0
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Enberg <[email protected]>
Co-authored-by: Rasmus Rynell <[email protected]>
Co-authored-by: Patrik Åkesson <[email protected]>
Co-authored-by: Mikael Magnusson <[email protected]>
Co-authored-by: Stiv Abdullwahed <[email protected]>
  • Loading branch information
6 people committed Oct 8, 2024
1 parent 93c3734 commit f777461
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: Build metadata-broker applications
name: Build message-broker applications
on:
workflow_dispatch:
push:
paths:
- 'metadata-broker/**'
- '!metadata-broker/README.md'
- '.github/workflows/metadata-broker.yml'
- 'message-broker/**'
- '!message-broker/README.md'
- '.github/workflows/message-broker.yml'
jobs:
test-app:
name: Test app
runs-on: ubuntu-latest
strategy:
matrix:
axis-os: ["11.11.70"]
axis-os: ["12.0.93"]
arch: ["armv7hf", "aarch64"]
env:
EXREPO: acap-native-examples
EXNAME: metadata-broker
EXNAME: message-broker
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3

- name: Build ${{ env.example }} application
env:
example: consume-analytics-scene-description
imagetag: ${{ env.EXREPO }}_consume-analytics-scene-description:${{ matrix.arch }}
example: consume-scene-metadata
imagetag: ${{ env.EXREPO }}_consume-scene-metadata:${{ matrix.arch }}
run: |
docker image rm -f $imagetag
cd $EXNAME/$example
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Below is the list of examples available in the repository.
- A simple hello world C application.
- [licensekey](./licensekey/)
- An example in C that illustrates how to check the licensekey status.
- [metadata-broker](./metadata-broker/)
- Examples that consume metadata.
- [message-broker](./message-broker/)
- Examples that showcase how to use the Message Broker API.
- [object-detection](./object-detection/)
- An example of object detection, cropping and saving detected objects into JPEG files.
- [object-detection-cv25](./object-detection-cv25/)
Expand Down
9 changes: 4 additions & 5 deletions metadata-broker/README.md → message-broker/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
*Copyright (C) 2024, Axis Communications AB, Lund, Sweden. All Rights Reserved.*

# ACAP applications using Metadata Broker API
# ACAP applications using the Message Broker API

This directory contains ACAP application examples that interacts with the
[Metadata Broker API](https://axiscommunications.github.io/acap-documentation/docs/api/native-sdk-api.html#metadata-broker-api).
[Message Broker API](https://axiscommunications.github.io/acap-documentation/docs/api/native-sdk-api.html#message-broker-api).

## Example applications

Each example has as a README file in its directory which shows overview,
example directory structure and step-by-step instructions on how to run
applications on an Axis device.

- [Consume Analytics Scene Description](./consume-analytics-scene-description/README.md)
- The example is written in C and shows how to consume metadata stream
**Analytics Scene Description**.
- [Consume AXIS Scene Metadata](./consume-scene-metadata/README.md)
- The example is written in C and shows how to consume [Scene Metadata](https://www.axis.com/developer-community/scene-metadata-integration).

## License

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ARCH=
ARG VERSION=1.15
ARG UBUNTU_VERSION=22.04
ARG VERSION=12.0.0-rc.1
ARG UBUNTU_VERSION=24.04
ARG REPO=axisecp
ARG SDK=acap-native-sdk

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
*Copyright (C) 2024, Axis Communications AB, Lund, Sweden. All Rights Reserved.*

# ACAP application consuming metadata stream Analytics Scene Description
# ACAP application consuming AXIS Scene Metadata

> [!IMPORTANT]
>
> - The Metadata Broker API is released as a [Beta API](https://axiscommunications.github.io/acap-documentation/docs/api/beta-api.html).
> - The Message Broker API is released as a [Beta API](https://axiscommunications.github.io/acap-documentation/docs/api/beta-api.html).
> To get all topics that can be subscribed to, see more information in the
> [API documentation](https://axiscommunications.github.io/acap-documentation/docs/api/src/api/metadata-broker/html/standard_topics.html).
> - First released in ACAP Native SDK 1.13 which maps to AXIS OS 11.9.
> [API documentation](https://axiscommunications.github.io/acap-documentation/docs/api/src/api/message-broker/html/standard_topics.html).
> - In ACAP Native SDK 1.13 which maps to AXIS OS 11.9:
> - **Metadata Broker API** was released as a Beta API.
> - In this release there's only one topic (`com.axis.analytics_scene_description.v0.beta`) that can be subscribed to.
> - In ACAP Native SDK 1.15 which maps to AXIS OS 11.11, there are the following updates:
> - Breaking change in function names, see more info in the [Changelog](https://axiscommunications.github.io/acap-documentation/docs/api/src/api/metadata-broker/html/release_notes.html).
> - A new topic has been added called `com.axis.consolidated_track.v1.beta`
> - Breaking change in function names, see more info in the [Changelog](https://axiscommunications.github.io/acap-documentation/docs/api/src/api/message-broker/html/release_notes.html).
> - A new topic has been added called `com.axis.consolidated_track.v1.beta` for [consolidated scene metadata](https://www.axis.com/developer-community/scene-metadata-integration).
> - In ACAP Native SDK 12.0 which maps to AXIS OS 12.0:
> - The **Metadata Broker API** has been renamed to **Message Broker API**.
## Use case

- Consume streamed analytics metadata of detected objects in the scene.

## Introduction

This example showcases how an ACAP application can `consume` metadata in AXIS OS
by using the [Metadata Broker API](https://axiscommunications.github.io/acap-documentation/docs/api/native-sdk-api.html#metadata-broker-api).
This example showcases how an ACAP application can `consume` frame-by-frame scene metadata in AXIS OS
by using the [Message Broker API](https://axiscommunications.github.io/acap-documentation/docs/api/native-sdk-api.html#message-broker-api).
To learn more about analytics metadata generated by Axis devices see
[AXIS Scene Metadata integration](https://www.axis.com/developer-community/scene-metadata-integration).

The ACAP application is a **consumer** that subscribes to the `topic`
`com.axis.analytics_scene_description.v0.beta`.
Expand Down Expand Up @@ -111,20 +116,20 @@ These instructions will guide you on how to execute the code. Below is the
structure and scripts used in the example:

```sh
consume-analytics-scene-description
consume-scene-metadata
├── app
│ ├── LICENSE
│ ├── Makefile
│ ├── manifest.json
│ └── consume_analytics_metadata.c
│ └── consume_scene_metadata.c
├── Dockerfile
└── README.md
```

- **app/LICENSE** - Text file which lists all open source licensed source code distributed with the application.
- **app/Makefile** - Makefile containing the build and link instructions for building the ACAP application.
- **app/manifest.json** - Defines the application and its configuration.
- **app/consume_analytics_metadata.c** - Application source code.
- **app/consume_scene_metadata.c** - Application source code.
- **Dockerfile** - Dockerfile with the specified Axis toolchain and API container to build the example specified.
- **README.md** - Step by step instructions on how to run the example.

Expand All @@ -149,7 +154,7 @@ Standing in your working directory run the following commands:
docker build --tag <APP_IMAGE> --build-arg ARCH=<ARCH> .
```

- `<APP_IMAGE>` is the name to tag the image with, e.g., `consume_analytics_metadata:1.0`
- `<APP_IMAGE>` is the name to tag the image with, e.g., `consume_scene_metadata:1.0`
- `<ARCH>` is the SDK architecture, `armv7hf` or `aarch64`.

Copy the result from the container image to a local directory build:
Expand All @@ -161,32 +166,32 @@ docker cp $(docker create <APP_IMAGE>):/opt/app ./build
The working directory now contains a build folder with the following files:

```sh
consume-analytics-scene-description
consume-scene-metadata
├── app
│ ├── LICENSE
│ ├── Makefile
│ ├── manifest.json
│ └── consume_analytics_metadata.c
│ └── consume_scene_metadata.c
├── build
│ ├── LICENSE
│ ├── Makefile
│ ├── manifest.json
│ ├── package.conf
│ ├── param.conf
│ ├── consume_analytics_metadata*
│ ├── consume_analytics_metadata_1_0_0_armv7hf.eap
│ ├── consume_analytics_metadata_1_0_0_LICENSE.txt
│ └── consume_analytics_metadata.c
│ ├── consume_scene_metadata*
│ ├── consume_scene_metadata_1_0_0_armv7hf.eap
│ ├── consume_scene_metadata_1_0_0_LICENSE.txt
│ └── consume_scene_metadata.c
├── Dockerfile
└── README.md
```

- **build/manifest.json** - Defines the application and its configuration.
- **build/package.conf** - Defines the application and its configuration.
- **build/param.conf** - File containing application parameters.
- **build/consume_analytics_metadata*** - Application executable binary file.
- **build/consume_analytics_metadata_1_0_0_armv7hf.eap** - Application package .eap file.
- **build/consume_analytics_metadata_1_0_0_LICENSE.txt** - Copy of LICENSE file.
- **build/consume_scene_metadata*** - Application executable binary file.
- **build/consume_scene_metadata_1_0_0_armv7hf.eap** - Application package .eap file.
- **build/consume_scene_metadata_1_0_0_LICENSE.txt** - Copy of LICENSE file.

#### Install your application

Expand All @@ -198,28 +203,28 @@ http://<AXIS_DEVICE_IP>/index.html#apps

- Click on the tab `App` in the device GUI
- Click `(+)` sign to upload the application file
- Browse to the newly built `consume_analytics_metadata_1_0_0_armv7hf.eap`
- Browse to the newly built `consume_scene_metadata_1_0_0_armv7hf.eap`
- Click `Install`
- Run the application by enabling the `Start` switch

#### The expected output

The application log can be found at

- Browse to `http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=consume_analytics_metadata`.
- Browse to `http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=consume_scene_metadata`.

> [!IMPORTANT]
> The logged output can have data which is empty or has a detection.
> To get a detection, make sure to have an object that can be detected by
> the Axis device scene data. Examples are persons and cars.
```sh
----- Contents of SYSTEM_LOG for 'consume_analytics_metadata' -----
----- Contents of SYSTEM_LOG for 'consume_scene_metadata' -----

consume_analytics_metadata[3844]: Subscribed to com.axis.analytics_scene_description.v0.beta (1)...
consume_analytics_metadata[3844]: Subscriber started...
consume_analytics_metadata[3844]: message received from topic: com.axis.analytics_scene_description.v0.beta on source: 1: Monotonic time - 483.054847000. Data - {"frame":{"observations":[{"bounding_box":{"bottom":0.7384,"left":0.4254,"right":0.7552,"top":0.4216},"class":{"score":0.74,"type":"Car"},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"25"},{"bounding_box":{"bottom":0.9431,"left":0.9656,"right":0.9989,"top":0.8384},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"26"},{"bounding_box":{"bottom":0.8378,"left":0.8102,"right":0.9693,"top":0.1988},"class":{"score":0.75,"type":"Human"},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"37"},{"bounding_box":{"bottom":0.0553,"left":0.727,"right":0.7499,"top":0.0443},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"44"},{"bounding_box":{"bottom":0.7997,"left":0.9833,"right":0.9989,"top":0.7262},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"45"},{"bounding_box":{"bottom":0.9689,"left":0.0208,"right":0.6354,"top":0.002},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"46"},{"bounding_box":{"bottom":0.3236,"left":0.7083,"right":0.8041,"top":0.0994},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"48"}],"operations":[],"timestamp":"2024-02-14T15:37:20.940582Z"}}
consume_analytics_metadata[3844]: message received from topic: com.axis.analytics_scene_description.v0.beta on source: 1: Monotonic time - 483.154843000. Data - {"frame":{"observations":[{"bounding_box":{"bottom":0.7413,"left":0.4396,"right":0.7661,"top":0.4234},"class":{"score":0.74,"type":"Car"},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"25"},{"bounding_box":{"bottom":0.9431,"left":0.9656,"right":0.9989,"top":0.8365},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"26"},{"bounding_box":{"bottom":0.839,"left":0.8295,"right":0.9782,"top":0.2037},"class":{"score":0.75,"type":"Human"},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"37"},{"bounding_box":{"bottom":0.9395,"left":0.0219,"right":0.6531,"top":0.002},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"46"},{"bounding_box":{"bottom":0.3181,"left":0.7094,"right":0.8114,"top":0.1012},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"48"}],"operations":[{"id":"35","type":"DeleteOperation"},{"id":"47","type":"DeleteOperation"}],"timestamp":"2024-02-14T15:37:21.040577Z"}}
consume_scene_metadata[3844]: Subscribed to com.axis.analytics_scene_description.v0.beta (1)...
consume_scene_metadata[3844]: Subscriber started...
consume_scene_metadata[3844]: message received from topic: com.axis.analytics_scene_description.v0.beta on source: 1: Monotonic time - 483.054847000. Data - {"frame":{"observations":[{"bounding_box":{"bottom":0.7384,"left":0.4254,"right":0.7552,"top":0.4216},"class":{"score":0.74,"type":"Car"},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"25"},{"bounding_box":{"bottom":0.9431,"left":0.9656,"right":0.9989,"top":0.8384},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"26"},{"bounding_box":{"bottom":0.8378,"left":0.8102,"right":0.9693,"top":0.1988},"class":{"score":0.75,"type":"Human"},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"37"},{"bounding_box":{"bottom":0.0553,"left":0.727,"right":0.7499,"top":0.0443},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"44"},{"bounding_box":{"bottom":0.7997,"left":0.9833,"right":0.9989,"top":0.7262},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"45"},{"bounding_box":{"bottom":0.9689,"left":0.0208,"right":0.6354,"top":0.002},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"46"},{"bounding_box":{"bottom":0.3236,"left":0.7083,"right":0.8041,"top":0.0994},"timestamp":"2024-02-14T15:37:20.940582Z","track_id":"48"}],"operations":[],"timestamp":"2024-02-14T15:37:20.940582Z"}}
consume_scene_metadata[3844]: message received from topic: com.axis.analytics_scene_description.v0.beta on source: 1: Monotonic time - 483.154843000. Data - {"frame":{"observations":[{"bounding_box":{"bottom":0.7413,"left":0.4396,"right":0.7661,"top":0.4234},"class":{"score":0.74,"type":"Car"},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"25"},{"bounding_box":{"bottom":0.9431,"left":0.9656,"right":0.9989,"top":0.8365},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"26"},{"bounding_box":{"bottom":0.839,"left":0.8295,"right":0.9782,"top":0.2037},"class":{"score":0.75,"type":"Human"},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"37"},{"bounding_box":{"bottom":0.9395,"left":0.0219,"right":0.6531,"top":0.002},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"46"},{"bounding_box":{"bottom":0.3181,"left":0.7094,"right":0.8114,"top":0.1012},"timestamp":"2024-02-14T15:37:21.040577Z","track_id":"48"}],"operations":[{"id":"35","type":"DeleteOperation"},{"id":"47","type":"DeleteOperation"}],"timestamp":"2024-02-14T15:37:21.040577Z"}}
```

The format of a detection shown in a more readable way.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROG1 = consume_analytics_metadata
PROG1 = consume_scene_metadata
OBJS1 = $(PROG1).c
PROGS = $(PROG1)
DEBUG_DIR = debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/**
* This example creates a Metadata Broker subscriber for the
* This example creates a Message Broker subscriber for the
* analytics_scene_description topic. Streamed messages are received in the
* Analytics Data Format (ADF) and is logged to syslog.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": "1.7.0",
"acapPackageConf": {
"setup": {
"appName": "consume_analytics_metadata",
"appName": "consume_scene_metadata",
"vendor": "Axis Communications",
"embeddedSdkVersion": "3.0",
"vendorUrl": "https://www.axis.com",
Expand Down

0 comments on commit f777461

Please sign in to comment.