Skip to content

Plumerai People Detection for Cortex-A library

This document describes how to use the C and C++ library for Plumerai’s people detection software for videos on Arm Cortex-A. For documentation about the API and an example, please see here for C++ and here for C. Go here for more information about Plumerai’s people detection solution and to try it out yourself.

Overview

Plumerai's people detection software expects a video feed and computes bounding boxes with a confidence value, for each person that is detected. The software assumes that the camera does not move. For the best results we recommend mounting the camera to a fixed position. The software works for any input resolution, but a higher resolution is always preferred and leads to higher accuracy. Although there is a small latency overhead the extra accuracy is usually worth it. The software works for any aspect ratio, but for best accuracy we recommend an aspect ratio between 16:9 and 9:16.

Contents of the package

The library package consists of the following files inside a plumeraipeopledetection.zip archive:

plumeraipeopledetection/include/plumerai/people_detection.h
plumeraipeopledetection/include/plumerai/people_detection_c.h
plumeraipeopledetection/lib/{target}/libplumeraipeopledetection.a
plumeraipeopledetection/lib/{target}/compiler_version.txt
Multiple {target} options are available for x86 and Arm. Note that the x86 version is not optimized for speed, see below.

They can be unzipped to a folder of your choice, which is referred to as $PLUMERAI_DIR below. For example:

unzip plumeraipeopledetection.zip -d /opt/
export PLUMERAI_DIR=/opt/plumeraipeopledetection/

Building and linking

Follow these steps to build and link your application with the Plumerai library (example applications can be found here for C++ and here for C):

  • Link to the Plumerai library, e.g. $PLUMERAI_DIR/lib/{target}/libplumeraipeopledetection.a.
  • Add $PLUMERAI_DIR/include to the include path, e.g. -I$PLUMERAI_DIR/include.

Here's how an example C++ application can be built and linked:

g++ -std=c++11 example.cc $PLUMERAI_DIR/lib/arm-linux-gnueabihf/libplumeraipeopledetection.a -I$PLUMERAI_DIR/include -lpthread -ldl -o example
And similarly for C:
gcc -std=c99 example.c $PLUMERAI_DIR/lib/arm-linux-gnueabihf/libplumeraipeopledetection.a -I$PLUMERAI_DIR/include -lstdc++ -lm -lpthread -ldl -o example

The final binary size for a minimal example with the Plumerai people detection library should be around 3MB for an ARMv7 device. By using strip example it can be further reduced to 2.4MB.

There are different versions of the library for different targets:

  1. There is an x86-64 version which can be used with a normal Intel or AMD CPU. Note however that this is not optimized for speed and only made available to be able to try out the API or do qualitative evaluation on a regular laptop or desktop PC.

  2. There are arm-linux-gnueabi (compiled with -mfloat-abi=softfp) and arm-linux-gnueabihf (compiled with -mfloat-abi=hard) versions for the AArch32 target. The libraries have been linked with the standard libraries that come with GCC 4.9.4 (GLIBC 2.19) and should link fine with code compiled with newer GCC versions.

Expected latency

Below is a table with expected latency numbers for some example Arm CPUs and input resolutions1:

OS CPU Threads Latency @ 800x600x3 Latency @ 1600x1200x3
32-bit Cortex-A53 @ 1.2GHz2 1 42 ms 44 ms
64-bit Cortex-A53 @ 1.2GHz2 1 42 ms 44 ms
64-bit Cortex-A72 @ 1.5GHz3 1 20 ms 21 ms

  1. Note that any input resolution is supported. 

  2. BCM2837, Raspberry Pi 3B Rev 1.2 

  3. BCM2711, Raspberry Pi 4B Rev 1.5