Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/example-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ jobs:
run: |
# Find directories that do not start with dot
acap_list="$(find . -maxdepth 1 -type d -printf '%f\n' |grep -v '^[.]' | sort)"
# Find lines starting with '* ['
# The grep removes anything but '[*]', then remove entries with space
# or capital letter and finally removes the brackets.
endline="$(sed -n '/## Docker Hub images/=' README.md)"
readme_examples="$(sed -n "1,${endline}!d ; /* \[/p" README.md | grep -oe '\[.*\]' | grep -v '[A-Z ]' | grep -oe '[0-9a-z-]*')"

# Find example application links in README.md
# The regular expression '^\* \[[0-9a-z-]*\]' matches lines starting with '* ['
# followed by alphanumeric characters and hyphens, and a closing ']'
example_links="$(grep -o '^\* \[[0-9a-z-]*\]' README.md)"

# Remove '* [' prefix and trailing ']' from example links
# The sed command uses two substitutions:
# 1. 's/^\* \[//' removes the '* [' prefix from the start of the line
# 2. 's/\]$//' removes the trailing ']' from the end of the line
readme_examples="$(echo "$example_links" | sed 's/^\* \[//;s/\]$//')"

# Control that all examples have an entry in README
common=$(printf "${acap_list}\n${readme_examples}" | sort | uniq -d)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/hello-world-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ jobs:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
run: |
cd $EXNAME
docker run --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
docker build --no-cache --tag $imagetag .
1 change: 1 addition & 0 deletions .github/workflows/object-detector-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
modeltag: ${{ env.EXREPO }}_${{ env.EXNAME }}-${{ matrix.chip }}-model:1.0
run: |
cd $EXNAME
docker run --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
docker build --no-cache --build-arg CHIP=${{ matrix.chip }} --tag $imagetag .
docker build --file Dockerfile.model --tag $modeltag .
1 change: 1 addition & 0 deletions .github/workflows/opencv-qr-decoder-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ jobs:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
run: |
cd $EXNAME
docker run --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
docker build --no-cache --tag $imagetag .
1 change: 1 addition & 0 deletions .github/workflows/parameter-api-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ jobs:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
run: |
cd $EXNAME
docker run --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
docker build --no-cache --tag $imagetag .
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@

[![CI](https://github.com/AxisCommunications/acap-computer-vision-sdk-examples/actions/workflows/ci.yml/badge.svg)](https://github.com/AxisCommunications/acap-computer-vision-sdk-examples/actions/workflows/ci.yml)

> [!IMPORTANT]
> The ACAP Computer Vision solution is deprecated from AXIS OS 12.0.
>
> - The deprecation of the ACAP Computer Vision solution only affects container applications.
> It will still be possible to build and run analytics, computer vision and machine learning applications on Axis devices using
> ACAP Native SDK. Examples can be found in the
> [ACAP Native SDK examples](https://github.com/AxisCommunications/acap-native-sdk-examples) repository.
> For more context about this transition, please visit the [Enhanced ACAP SDK news article](https://www.axis.com/developer-community/news/enhanced-acap-sdk).
> - `armv7hf` is no longer supported after AXIS OS 11.11.
> - `aarch64` will be supported until the end of the AXIS OS 12 LTS cycle.
> After this period, the components of the Computer Vision solution will no longer
> receive updates or support.
> - From AXIS OS 12.0, the artifact ACAP Computer Vision SDK in form of a
> container image is removed and utility libraries and scripts have been
> moved to [ACAP Runtime](https://github.com/AxisCommunications/acap-runtime).
> This means that the ACAP Computer Vision SDK is no longer needed to run container applications.

## Mission

Our mission is to provide an excellent development experience by enabling developers
Expand Down Expand Up @@ -32,15 +49,22 @@ developers analytics experience. All examples are using Docker framework and has
README file in its directory which shows overview, example directory structure and
step-by-step instructions on how to run applications on the camera.

### Requirements
## Requirements

### Supported architectures

The examples support the following architectures:

* aarch64

### Example applications for video analytics
### Required components

The example applications make use of two special components:

* [Docker ACAP](https://github.com/AxisCommunications/docker-acap) needs to be installed and running on the Axis device. It's required to deploy and run the example application.
* [ACAP runtime](https://github.com/AxisCommunications/acap-runtime) is used in a few examples to get access to [APIs](https://axiscommunications.github.io/acap-documentation/docs/api/computer-vision-sdk-apis.html). ACAP Runtime is a container image and the example applications will pull it from Docker Hub when starting.

## Example applications

Below is a list of examples available in the repository:

Expand All @@ -60,12 +84,6 @@ Below is a list of examples available in the repository:
* [web-server](./web-server/)
* A C++ example which runs a Monkey web server on the camera.

### Docker Hub images

The examples are based on the [ACAP Computer Vision SDK](https://github.com/AxisCommunications/acap-computer-vision-sdk).
This SDK is an image which contains APIs and tooling to build computer vision apps for running on camera, with support for Python.
Additionally, there is the [ACAP Native SDK](https://github.com/AxisCommunications/acap-native-sdk), which is more geared towards building ACAPs that uses AXIS-developed APIs directly, and primarily does so using C/C++.

## How to work with Github repository

You can help to make this repo a better one using the following commands.
Expand Down
18 changes: 8 additions & 10 deletions hello-world-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# syntax=docker/dockerfile:1

ARG REPO=axisecp
ARG SDK_VERSION=1.15
ARG UBUNTU_VERSION=22.04


FROM ${REPO}/acap-computer-vision-sdk:${SDK_VERSION}-aarch64 AS cv-sdk
ARG UBUNTU_VERSION=24.04

FROM arm64v8/ubuntu:${UBUNTU_VERSION}

# Get the Python package from the CV SDK
COPY --from=cv-sdk /axis/python /
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y --no-install-recommends \
python3 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/app

WORKDIR /app
COPY app/* /app
COPY app/* .
CMD ["python3", "simply_hello.py"]
4 changes: 2 additions & 2 deletions hello-world-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# A minimal Python application

This example demonstrates how to create a simple Python application using the ACAP Computer Vision SDK and run it on an edge device.
This example demonstrates how to create a simple containerized Python application and run it on an edge device.

Going from zero to a Python application running on an AXIS device is quite easy. First, the application script is written, as in the hello-world script in [app/simply_hello.py](app/simply_hello.py). Next, the [Dockerfile](Dockerfile) which builds the application image is constructed. This needs to pull in packages from the ACAP Computer Vision SDK, as is done using the `COPY` commands. Finally, the application needs to be built and uploaded, as is specified below.
Going from zero to a Python application running on an Axis device is quite easy. First, the application script is written, as in the hello-world script in [app/simply_hello.py](app/simply_hello.py). Next, the [Dockerfile](Dockerfile) which builds the application image is constructed. The application needs to be built and uploaded, as is specified below.

## Example structure

Expand Down
46 changes: 31 additions & 15 deletions minimal-ml-inference/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
# syntax=docker/dockerfile:1

ARG RUNTIME_VERSION=2.0.0
ARG REPO=axisecp
ARG SDK_VERSION=1.15
ARG UBUNTU_VERSION=22.04
ARG IMAGE=acap-runtime
ARG UBUNTU_VERSION=24.04

# Specify which ACAP Computer Vision SDK to use
FROM ${REPO}/acap-computer-vision-sdk:${SDK_VERSION}-aarch64 AS cv-sdk
FROM ${REPO}/${IMAGE}:${RUNTIME_VERSION}-protofiles AS proto-image
FROM arm64v8/ubuntu:${UBUNTU_VERSION} AS runtime-image

# Define the runtime image
FROM arm64v8/ubuntu:${UBUNTU_VERSION}
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
ffmpeg \
libsm6 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*

# Get packages from the CV SDK
COPY --from=cv-sdk /axis/python /
COPY --from=cv-sdk /axis/python-tfserving /
COPY --from=cv-sdk /axis/python-vdoproto /
COPY --from=cv-sdk /axis/python-numpy /
COPY --from=cv-sdk /axis/opencv /
COPY --from=cv-sdk /axis/openblas /
# Copy list of grpc dependencies
COPY --from=proto-image /build/requirements.txt .

# Create a virtual environment for installations using pip
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir -r requirements.txt \
numpy \
opencv-python

WORKDIR /opt/app

# Install prebuilt TensorFlow and VDO proto files
COPY --from=proto-image /build/tf/proto_utils .
COPY --from=proto-image /build/vdo/proto_utils .

# Copy the application script to the container
WORKDIR /app
COPY simple_inference.py .
COPY app/* .

CMD ["python3", "simple_inference.py"]
1 change: 0 additions & 1 deletion minimal-ml-inference/Dockerfile.model
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ARG UBUNTU_VERSION=22.04

FROM arm64v8/alpine as model-image


# Get SSD Mobilenet V2
ADD https://github.com/google-coral/edgetpu/raw/master/test_data/ssd_mobilenet_v2_coco_quant_postprocess.tflite models/
ADD https://github.com/google-coral/edgetpu/raw/master/test_data/coco_labels.txt models/
Expand Down
4 changes: 2 additions & 2 deletions minimal-ml-inference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# A minimal, machine learning inference application

This example demonstrates how to create a simple Python application that performs inference on the camera image. This is done using the ACAP Computer Vision SDK.
This example demonstrates how to create a simple Python application that performs inference on the camera image.

## Overview

Expand All @@ -14,7 +14,7 @@ Lastly, there is a third container that holds the deep learning model, which is

```text
model
├── ssdlite-mobilenet-v2 - tflite model
├── ssdlite-mobilenet-v2 - TFLite model
└── objects.txt - list of object labels
```

Expand Down
4 changes: 2 additions & 2 deletions minimal-ml-inference/config/env.aarch64.artpec8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MODEL_PATH=/models/ssd_mobilenet_v2_coco_quant_postprocess.tflite
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:1.3.1-aarch64-containerized
INFERENCE_CHIP=12
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:2.0.0-aarch64-containerized
INFERENCE_CHIP=12
4 changes: 2 additions & 2 deletions minimal-ml-inference/config/env.aarch64.cpu
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MODEL_PATH=/models/ssd_mobilenet_v2_coco_quant_postprocess.tflite
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:1.3.1-aarch64-containerized
INFERENCE_CHIP=2
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:2.0.0-aarch64-containerized
INFERENCE_CHIP=2
44 changes: 32 additions & 12 deletions object-detector-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
# syntax=docker/dockerfile:1

ARG RUNTIME_VERSION=2.0.0
ARG REPO=axisecp
ARG SDK_VERSION=1.15
ARG UBUNTU_VERSION=22.04
ARG IMAGE=acap-runtime
ARG UBUNTU_VERSION=24.04

FROM ${REPO}/${IMAGE}:${RUNTIME_VERSION}-protofiles AS proto-image
FROM arm64v8/ubuntu:${UBUNTU_VERSION} AS runtime-image

FROM ${REPO}/acap-computer-vision-sdk:${SDK_VERSION}-aarch64 AS cv-sdk
FROM arm64v8/ubuntu:${UBUNTU_VERSION}
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
ffmpeg \
libsm6 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=cv-sdk /axis/python /
COPY --from=cv-sdk /axis/python-numpy /
COPY --from=cv-sdk /axis/python-tfserving /
COPY --from=cv-sdk /axis/python-vdoproto /
COPY --from=cv-sdk /axis/opencv /
COPY --from=cv-sdk /axis/openblas /
# Copy list of grpc dependencies
COPY --from=proto-image /build/requirements.txt .

# Create a virtual environment for installations using pip
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir -r requirements.txt \
numpy \
opencv-python

WORKDIR /opt/app

# Install prebuilt TensorFlow and VDO proto files
COPY --from=proto-image /build/tf/proto_utils .
COPY --from=proto-image /build/vdo/proto_utils .

# Copy the application script to the container
COPY app/* .

WORKDIR /app
COPY app/* /app/
CMD ["python3", "detector.py"]
2 changes: 1 addition & 1 deletion object-detector-python/config/env.aarch64.artpec8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MODEL_PATH=/models/ssd_mobilenet_v2_coco_quant_postprocess.tflite
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:1.3.1-aarch64-containerized
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:2.0.0-aarch64-containerized
INFERENCE_CHIP=12
2 changes: 1 addition & 1 deletion object-detector-python/config/env.aarch64.cpu
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MODEL_PATH=/models/ssd_mobilenet_v2_coco_quant_postprocess.tflite
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:1.3.1-aarch64-containerized
INFERENCE_SERVER_IMAGE=axisecp/acap-runtime:2.0.0-aarch64-containerized
INFERENCE_CHIP=2
44 changes: 32 additions & 12 deletions opencv-qr-decoder-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# syntax=docker/dockerfile:1

ARG RUNTIME_VERSION=2.0.0
ARG REPO=axisecp
ARG SDK_VERSION=1.15
ARG UBUNTU_VERSION=22.04
ARG IMAGE=acap-runtime
ARG UBUNTU_VERSION=24.04

FROM ${REPO}/${IMAGE}:${RUNTIME_VERSION}-protofiles AS proto-image
FROM arm64v8/ubuntu:${UBUNTU_VERSION} AS runtime-image

FROM ${REPO}/acap-computer-vision-sdk:${SDK_VERSION}-aarch64-runtime AS cv-sdk
FROM arm64v8/ubuntu:${UBUNTU_VERSION}
COPY --from=cv-sdk /axis/opencv /
COPY --from=cv-sdk /axis/openblas /
COPY --from=cv-sdk /axis/python-tfserving /
COPY --from=cv-sdk /axis/python-vdoproto /
COPY --from=cv-sdk /axis/python /
COPY --from=cv-sdk /axis/python-numpy /
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
ffmpeg \
libsm6 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*

# Copy list of grpc dependencies
COPY --from=proto-image /build/requirements.txt .

# Create a virtual environment for installations using pip
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir -r requirements.txt \
numpy \
opencv-python

WORKDIR /opt/app

# Install prebuilt VDO proto files
COPY --from=proto-image /build/vdo/proto_utils .

# Copy the application script to the container
COPY app/* .

WORKDIR /app
COPY app/qr.py .
CMD ["python3", "qr.py"]
1 change: 0 additions & 1 deletion opencv-qr-decoder-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ It composes two different container images into an application that performs an
The first container contains the actual program built in this example. It then uses [gRPC](https://grpc.io/)/[protobuf](https://developers.google.com/protocol-buffers) to call the second container, that is used to capture images from the camera.

NumPy is used to preprocess the images and OpenCV to detect and decode any QR codes within the image.
Additionally, Python, NumPy and OpenBLAS are also copied from the Computer Vision SDK.

## Application layout

Expand Down
2 changes: 1 addition & 1 deletion opencv-qr-decoder-python/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
volumes:
- inference-server:/tmp
inference-server:
image: axisecp/acap-runtime:1.3.1-aarch64-containerized
image: axisecp/acap-runtime:2.0.0-aarch64-containerized
logging:
driver: "json-file"
options:
Expand Down
Loading
Loading