Skip to content
No description or website provided.
C++ JavaScript CSS HTML CMake Shell PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
UI Update to R2 Sep 12, 2019
docs/images Update to R2 Sep 12, 2019
resources Update to R2 Sep 12, 2019
.gitignore Update to R2 Sep 12, 2019
CMakeLists.txt Update to R2 Sep 12, 2019 Update to R2 Sep 12, 2019

Intruder Detector

Target OS: Ubuntu* 16.04
Programming Language: C++
Time to Complete: 50-70min

This reference implementation is also available in Python*


What it Does

This reference implementation detect the objects in a designated area. It gives the number of objects in the frame, total count and also record the alerts of the objects present in the frame. The application is capable of processing the inputs from multiple cameras and video files.



  • 6th to 8th Generation Intel® Core™ processors with Intel® Iris® Pro graphics or Intel® HD Graphics


  • Ubuntu* 16.04 LTS
    Note: Use kernel versions 4.14+ with this software.
    Determine the kernel version with the uname command.
    uname -a
  • OpenCL™ Runtime Package
  • Intel® Distribution of OpenVINO™ toolkit 2019 R2 Release

How it Works

The application uses the Inference Engine included in the Intel® Distribution of OpenVINO™ toolkit. A trained neural network detects objects within a designated area by displaying a green bounding box over them, and registers them in a logging system.

architectural diagram


Get the code

Clone the reference implementation

sudo apt-get update && sudo apt-get install git
git clone

Install OpenVINO

Refer to Install Intel® Distribution of OpenVINO™ toolkit for Linux* on how to install and setup the Intel® Distribution of OpenVINO™ toolkit.

You will need the OpenCL™ Runtime Package if you plan to run inference on the GPU as shown by the instructions below. It is not mandatory for CPU inference.

Other dependencies

FFmpeg is a free and open-source project capable of recording, converting and streaming digital audio and video in various formats. It can be used to do most of our multimedia tasks quickly and easily say, audio compression, audio/video format conversion, extract images from a video and a lot more.

Which Models to Use

This application uses the person-vehicle-bike-detection-crossroad-0078 Intel® model, that can be downloaded using the model downloader. The model downloader downloads the .xml and .bin files that is used by the application.

The application also works with any object-detection model, provided it has the same input and output format of the SSD model. The model can be any object detection model:

  • Downloaded using the model downloader, provided by Intel® Distribution of OpenVINO™ toolkit.

  • Built by the user.

To download the models and install the dependencies of the application, run the below command in the intruder-detector-cpp directory:


The labels file

In order to work, this application requires a labels file associated with the model being used for detection.
All detection models work with integer labels and not string labels (e.g. for the person-vehicle-bike-detection-crossroad-0078 model, the number 1 represents the class "person"), that is why each model must have a labels file, which associates an integer (the label the algorithm detects) with a string (denoting the human-readable label).

The labels file is a text file containing all the classes/labels that the model can recognize, in the order that it was trained to recognize them (one class per line). For the person-vehicle-bike-detection-crossroad-0078 model, we provide the class file labels.txt in the resources folder.

The config file

The resources/config.json contains the path to the videos that will be used by the application and the labels to be detected on those videos. All labels defined will be detected on all videos. The config.json file is of the form video: ["<path/to/video>"] and label: ["<labels>"]. The labels used in the config.json file must coincide with the labels from the labels file.

Example of the config.json file:


    "inputs": [
            "video": ["sample-videos/video1.mp4", "sample-videos/video2.mp4"],
            "label": [ "person", "bicycle", "car"]

The application can use any number of videos for detection, but the more videos the application uses in parallel, the more the frame rate of each video scales down. This can be solved by adding more computation power to the machine the application is running on.

What input video to use

The application works with any input video. Sample videos for object detection are provided here.

For first-use, we recommend using the person-bicycle-car-detection video.
For example:


    "inputs": [
            "video": ["sample-videos/person-bicycle-car-detection.mp4"],
            "label": [ "person", "bicycle", "car"]

Using the camera stream instead of the video file

Replace path/to/video with the camera ID in the config.json file, where the ID is taken from the video device (the number X in /dev/videoX).

On Ubuntu, to list all available video devices use the following command:

ls /dev/video*

For example, if the output of above command is /dev/video0, then config.json would be:

    "inputs": [
            "video": "0",
            "label": [ "person", "bicycle", "car"]

Setup the Environment

Configure the environment to use the Intel® Distribution of OpenVINO™ toolkit by exporting environment variables:

source /opt/intel/openvino/bin/

Build the Application

To build, go to intruder-detector-cpp directory and run the following commands:

mkdir -p build && cd build
cmake ..

Run the application

If not in build folder, go there by using:

cd <path-to-intruder-detector-cpp>/build/

To see a list of the various options:

./intruder-detector -h

A user can specify what target device to run on by using the device command-line argument -d followed by one of the values CPU, GPU, MYRIAD or HDDL. To run with multiple devices use -d MULTI:device1,device2. For example: -d MULTI:CPU,GPU,MYRIAD

Running on the CPU

Although the application runs on the CPU by default, this can also be explicitly specified through the -d CPU command-line argument:

./intruder-detector -d CPU -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP32/person-vehicle-bike-detection-crossroad-0078.xml

Note: By default, the application runs on async mode. To run the application on sync mode, use -f sync as command-line argument.

Running on the integrated GPU

  • To run on the integrated Intel® GPU with floating point precision 32 (FP32) model, use the -d GPU command-line argument:

    ./intruder-detector -d GPU -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP32/person-vehicle-bike-detection-crossroad-0078.xml

    FP32: FP32 is single-precision floating-point arithmetic uses 32 bits to represent numbers. 8 bits for the magnitude and 23 bits for the precision. For more information, click here

  • To run on the integrated Intel® GPU with floating point precision 16 (FP16):

    ./intruder-detector -d GPU -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP16/person-vehicle-bike-detection-crossroad-0078.xml

    FP16: FP16 is half-precision floating-point arithmetic uses 16 bits. 5 bits for the magnitude and 10 bits for the precision. For more information, click here

Running on the Intel® Neural Compute Stick

To run on the Intel® Neural Compute Stick, use the -d MYRIAD command-line argument:

./intruder-detector -d MYRIAD -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP16/person-vehicle-bike-detection-crossroad-0078.xml

Note: The Intel® Neural Compute Stick can only run on FP16 models. The model that is passed to the application, through the -m <path_to_model> command-line argument, must be of data type FP16.

Run on the Intel® Movidius™ VPU

To run on the Intel® Movidius™ VPU, use the -d HDDL command-line argument:

./intruder-detector -d HDDL -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP16/person-vehicle-bike-detection-crossroad-0078.xml

Note: The HDDL-R can only run on FP16 models. The model that is passed to the application, through the -m <path_to_model> command-line argument, must be of data type FP16.

Loop the input video

By default, the application reads the input videos only once, and ends when the videos end. In order to not have the sample videos end, thereby ending the application, the option to continuously loop the videos is provided.
This is done by running the application with the -lp true command-line argument:

./intruder-detector -lp true -d CPU -l ../resources/labels.txt -m /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/Security/object_detection/crossroad/0078/dldt/FP32/person-vehicle-bike-detection-crossroad-0078.xml

This looping does not affect live camera streams, as camera video streams are continuous and do not end.

Using the browser UI

The default application uses a simple user interface created with OpenCV. A web based UI with more features is also provided here.

You can’t perform that action at this time.