Compiling OpenEB on Linux Ubuntu

This section describes how to install OpenEB on Linux Ubuntu 18.04 and 20.04 64-bit. Compilation on other versions of Ubuntu or other Linux distributions was not tested. For those platforms some adjustments to this guide or to the code itself may be required (specially for non-Debian Linux).

Note

OpenEB is the open source version of our code base for the modules Base, Core, Core ML, Driver, UI, and HAL (see Metavision modules organization). If you acquired the full source code of the SDK, OpenEB will also be the basis of your installation, but you should follow the installation guide of SDK from source.

If you don’t want to go through some compilation steps, you can download pre-built Ubuntu packages of Metavision Intelligence modules by signing-up for SDK. Once you have downloaded this version, follow our specific installation guide.

Supported Cameras

OpenEB contains the source code of Prophesee camera plugins, enabling to stream data from our event-based cameras and to read recordings of event-based data. The supported cameras are:

  • EVK1 - Gen3.1 VGA

  • EVK2 - Gen4.1 HD

  • EVK3 - Gen 3.1 VGA / Gen4.1 HD

  • EVK4 - HD

Requirements

Please note the base system requirements for using Metavision:

  • Operating system: Linux Ubuntu 18.04 or 20.04 64-bit

  • Architecture: amd64 (a.k.a. x64)

  • Graphic card: must support OpenGL 3.0 minimum

  • CPU: must support AVX2

For Windows, check the page OpenEB installation on Windows.

Prerequisites

Upgrading Metavision

First of all, read carefully the Release Notes as some changes may impact your usage of our SDK (e.g. API updates) and cameras (e.g. firmware update might be necessary).

Then, you need to clean your system from previously installed Prophesee software. If after a previous compilation, you chose to deploy the Metavision files in your system path, then go to the build folder in the source code directory and launch the following command to remove those files:

sudo make uninstall

In addition, make a global check in your system paths (/usr/lib, /usr/local/lib, /usr/include, /usr/local/include) and in your environment variables (PATH, PYTHONPATH and LD_LIBRARY_PATH) to remove occurrences of Prophesee or Metavision files.

Installing Dependencies

Install the following dependencies:

sudo apt update
sudo apt -y install apt-utils build-essential software-properties-common wget unzip curl git cmake
sudo apt -y install libopencv-dev libgtest-dev libboost-all-dev libusb-1.0-0-dev libeigen3-dev
sudo apt -y install libglew-dev libglfw3-dev libcanberra-gtk-module ffmpeg

For the Python API, you will need Python and some additional libraries. If Python is not available on your system, install it (we support Python 3.6 and 3.7 on Ubuntu 18.04 and Python 3.7 and 3.8 on Ubuntu 20.04).

sudo apt -y install python3-pip python3-distutils
python3 -m pip install pip --upgrade

To use Machine Learning features, you need to install some additional dependencies.

First, if you have some Nvidia hardware with GPUs, install CUDA (10.2, 11.1 or 11.3) and cuDNN to leverage them with pytorch and libtorch. Make sure that you install a version of CUDA that is compatible with your GPUs by checking Nvidia compatibility page.

Note

At the moment, we don’t support OpenCL and AMD GPUs.

Then, install pytorch. Go to pytorch.org to retrieve the pip command for the installation of PyTorch 1.8.2 LTS:

PyTorch install

Then install some extra Python libraries:

python3 -m pip install "opencv-python>=4.5.5.64" "sk-video==1.1.10" "fire==0.4.0" "numpy<=1.21" pandas scipy numba h5py profilehooks pytest
python3 -m pip install jupyter jupyterlab matplotlib "ipywidgets==7.6.5"
python3 -m pip install "pytorch_lightning==1.5.10" "tqdm==4.63.0" "kornia==0.6.1"

Note

You can use anaconda to install Python and conda to manage your Python packages, but be sure to use a Python version that we support. You will need to adapt the library installation steps accordingly and use conda whenever we use pip. In this documentation, we chose to use pip as a package manager. We recommend using it with virtualenv to avoid conflicts with other installed Python packages.

The Python bindings rely on the pybind11 library (version >= 2.6.0).

Note

pybind11 is required only if you want to use the Python bindings of our C++ API. You can skip compiling these bindings by passing the argument -DCOMPILE_PYTHON3_BINDINGS=OFF during compilation (see step 3 below). This allows you to skip installing pybind11, but you won’t be able to use our Python interface.

Unfortunately, there is no pre-compiled version of pybind11 available, so you need to install it manually:

wget https://github.com/pybind/pybind11/archive/v2.6.0.zip
unzip v2.6.0.zip
cd pybind11-2.6.0
mkdir build && cd build
cmake .. -DPYBIND11_TEST=OFF
cmake --build .
sudo cmake --build . --target install

If you want to run the tests, then you need to compile gtest package (this is optional):

cd /usr/src/gtest
sudo cmake .
sudo make
sudo make install

Compilation

  1. Retrieve the source code of OpenEB

git clone https://github.com/prophesee-ai/openeb.git
  1. Create and open the build directory in the openeb folder (absolute path to this directory is called OPENEB_SRC_DIR in next sections):

cd openeb
mkdir build && cd build
  1. Generate the makefiles using CMake:

cmake .. -DBUILD_TESTING=OFF
  1. Compile:

cmake --build . --config Release -- -j 4
  1. To use Metavision Intelligence directly from the build folder, you need to update some environment variables using this script (which you may add to your ~/.bashrc to make it permanent):

    source utils/scripts/setup_env.sh
    

    Optionally, you can deploy the OpenEB files in the system path (/usr/local/lib, /usr/local/include…) to use them as 3rd party dependency in some other code with the following command:

    sudo cmake --build . --target install
    

    In that case, you will also need to update LD_LIBRARY_PATH:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    

    And if you want to update this path permanently, you should add the previous command in your ~/.bashrc

Note

You can also deploy the OpenEB files (applications, samples, libraries etc.) in a directory of your choice by using the CMAKE_INSTALL_PREFIX variable (-DCMAKE_INSTALL_PREFIX=<OPENEB_INSTALL_DIR>) when generating the makefiles in step 3. Similarly, you can configure the directory where the Python packages will be deployed using the PYTHON3_SITE_PACKAGES variable (-DPYTHON3_SITE_PACKAGES=<PYTHON3_PACKAGES_INSTALL_DIR>).

Note

Since OpenEB 3.0.0, Prophesee camera plugins are included in OpenEB, so you don’t need to perform any extra step to install them. After the compilation described above, you are ready to stream from Prophesee-compatible event-based devices and read RAW files.

Compiling and running tests

Running the test suite is a sure-fire way to ensure you did everything well with your compilation and installation process.

  • Go to this page to download the files necessary to run the tests. Click the Download button on the top right of the page. The obtained archive weighs around 500 Mb.

  • Extract and put the contents of this archive into <OPENEB_SRC_DIR>/. For instance, the correct path of sequence gen31_timer.raw should be <OPENEB_SRC_DIR>/datasets/openeb/gen31_timer.raw.

  • Regenerate the makefiles with the test options on. Make sure that all your pro modules were properly configured. Don’t forget to install gtest as specified here compiling OpenEB:

cd <OPENEB_SRC_DIR>/build
cmake .. -DBUILD_TESTING=ON
  • Compile again:

cmake --build . --config Release -- -j 4
  • Make sure you launched the utils/scripts/setup_env.sh mentioned before, and run the test suite:

ctest -C Release

Get started!

You are now ready to use Metavision Intelligence. The best way to start getting familiar with the event-based technology is to open an event-based camera with Metavision Viewer to begin data collection and visualization. You can choose to dive directly in the SDK by following a Tutorial or looking at a Code Sample.