Installation of SDK from source on Windows

This section describes how to install Metavision SDK from source on Windows 10.

Note

Contact us for a quote to acquire the source code of Metavision SDK. If you only need to have access to the source code of the Open modules (Base, Core, Core ML, Driver, UI, and HAL. See Metavision modules organization), compiling our open source project OpenEB will be enough. In that case, follow the specific guide on the Installation of OpenEB.

Requirements

Please note the base system requirements for using Metavision:

  • Operating system: Windows 10 64-bit

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

  • Graphic card: must support OpenGL 3.0 minimum

  • CPU: must support AVX2

For Linux, check the page Installation of SDK from source on Linux.

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, if you have previously installed any Prophesee’s software, you will need to uninstall it first. Remove the folders where you installed Metavision artifacts (check both the build folder of the source code and C:\Program Files\Prophesee which is the default install path of the deployment step).

System Settings

You must enable the support for long paths:

  • Hit the Windows key, type gpedit.msc and press Enter

  • Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem

  • Double-click the “Enable Win32 long paths” option, select the “Enabled” option and click “OK”

Development tools

To compile OpenEB, you will need to install some extra tools:

Installing Dependencies

  • download and extract vcpkg version 2022.03.10 that will be used for installing dependencies

  • then in a command prompt, navigate to the directory where vcpkg was extracted (called VCPKG_SRC_DIR in following sections) and launch the following command:

bootstrap-vcpkg.bat
  • finally, install the following libraries using vcpkg:

vcpkg.exe install --triplet x64-windows libusb eigen3 boost opencv glfw3 glew gtest dirent

Note

To avoid using –triplet x64-windows, which informs vcpkg to install packages for a x64-windows target, you can run setx VCPKG_DEFAULT_TRIPLET x64-windows in a console. Then, you need to close the command line and re-open it to ensure that this variable is set.

Note

If you are using vcpkg for various projects or multiple versions of OpenEB, you might want to optimize the number of vcpkg install you manage. To do so, you will need the versions of the libraries we require. Those can be found in the vcpkg repository but we list them here for convenience:

  • libusb: 1.0.24

  • eigen3: 3.4.0

  • boost: 1.78.0

  • opencv: 4.5.5

  • glfw3: 3.3.6

  • glew: 2.2.0

  • gtest: 1.11.0

  • dirent: 1.23.2

  • FFMPEG library is required to write videos:

Installing pybind

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

You should install pybind using vcpkg in order to get the appropriate version:

vcpkg.exe install --triplet x64-windows pybind11

Note

pybind11 is required only if you plan to use the Python API. You can skip compiling these bindings by passing the argument -DCOMPILE_PYTHON3_BINDINGS=OFF during compilation (see step 2 in the section “Compilation using CMake”). This allows you to skip installing pybind11, but you won’t be able to use our Python interface.

Installing Python

Install Python (version 3.7 or 3.8), if not yet available on your machine:

  • Download “Windows x86-64 executable installer” for one of these Python versions:

  • Run the installer and follow the prompt

  • We advise you to check the box to update the PATH or update the PATH manually with the following paths after replacing the Username to your own and using the Python version you installed (here, we assume that the install is limited to the local user and the default install path was used):

    C:\Users\Username\AppData\Local\Programs\Python\Python37
    C:\Users\Username\AppData\Local\Programs\Python\Python37\Scripts
    
  • Finally, install required Python packages using pip:

python -m pip install pip --upgrade
python -m pip install "opencv-python>=4.5.5.64" "sk-video==1.1.10" "fire==0.4.0" "numpy<=1.21" pandas scipy h5py pytest
python -m pip install jupyter jupyterlab matplotlib "ipywidgets==7.6.5"

Prerequisites for the CV3D module

If you acquired the CV3D module, you need to install a third-party Sophus library that is required to handle geometric transformation problems:

  • Clone the Sophus repository:

    git clone https://github.com/strasdat/Sophus.git
    
  • Go to the Sophus directory:

    cd Sophus
    mkdir build && cd build
    
  • Create a directory where Sophus will be installed (make sure you have the write permission in that directory):

    mkdir <sophus_install_path>
    
  • Compile and install:

    cmake .. -DCMAKE_TOOLCHAIN_FILE=<VCPKG_SRC_DIR>\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=<sophus_install_path>
    cmake --build . --config Release
    sudo cmake --build . --target install
    

    Note

    The value passed to the parameter -DCMAKE_TOOLCHAIN_FILE must be an absolute path, not a relative one.

Prerequisites for the ML module

To use Machine Learning features, you need to install some additional dependencies. If you have some Nvidia hardware with GPUs, install CUDA (10.2 or 11.1) 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.

Packages for Python

Metavision ML requires PyTorch 1.8.2 LTS. This version was deprecated by PyTorch team but can still be downloaded in the Previous Versions page of pytorch.org (in future releases of Metavision ML, more recent version of PyTorch will be leveraged). Retrieve and execute the pip command for the installation:

PyTorch install

Metavision ML has additional Python requirements that can be installed with pip:

python -m pip install numba llvmlite profilehooks "pytorch_lightning==1.5.10"
python -m pip install "pycocotools==2.0.4" "tqdm==4.63.0"
python -m pip install "torchmetrics==0.7.2" "seaborn==0.11.2" "kornia==0.6.1"

LibTorch for C++

To compile and run the neural network inference in a C++ pipeline, you need LibTorch (PyTorch’s C++ frontend)

Compilation of OpenEB

The first step to compile the whole solution is to first compile OpenEB. You should use the OpenEB archive (openeb_x.y.z.tar) that was included in your delivery.

Then follow one of the next sections depending of the tool you chose: cmake or MS Visual Studio.

Compilation of OpenEB using CMake

Open a command prompt inside the extracted openeb folder and follow the steps: (absolute path to this directory is called OPENEB_SRC_DIR in next sections).

  1. Create and open the build directory where temporary files will be created:

mkdir build && cd build
  1. Generate the makefiles using CMake (note that -DCMAKE_TOOLCHAIN_FILE must be absolute path, not a relative one):

cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=OFF
  1. Compile:

cmake --build . --config Release --parallel 4
  1. To use Metavision Intelligence directly from the build folder, you need to update some environment variables using this script:

utils\scripts\setup_env.bat

Optionally, you can deploy the OpenEB files (applications, samples, libraries etc.) in a directory of your choice. To do so, configure the target folder (OPENEB_INSTALL_DIR) with CMAKE_INSTALL_PREFIX variable. when generating the makefiles in step 2:

cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DCMAKE_INSTALL_PREFIX=<OPENEB_INSTALL_DIR> -DBUILD_TESTING=OFF

You can also configure the directory where the Python packages will be deployed using the PYTHON3_SITE_PACKAGES variable (note that in that case, you will also need to edit your environment variable PYTHONPATH and append the <PYTHON3_PACKAGES_INSTALL_DIR> path):

cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DCMAKE_INSTALL_PREFIX=<OPENEB_INSTALL_DIR> -DPYTHON3_SITE_PACKAGES=<PYTHON3_PACKAGES_INSTALL_DIR> -DBUILD_TESTING=OFF

If you did not customize the install folders with the previous commands, the default path will be C:\Program Files\Prophesee.

You can now launch the actual compilation and installation of the OpenEB files:

cmake --build . --config Release --parallel 4
cmake --build . --config Release --target install

Compilation of OpenEB using MS Visual Studio

Open a command prompt inside the extracted openeb folder and follow the steps:

  1. Create and open the build directory where temporary file will be created:

mkdir build && cd build
  1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version):

cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=OFF

Note

The value passed to the parameter -DCMAKE_TOOLCHAIN_FILE must be an absolute path, not a relative one.

  1. Open the solution file metavision.sln, select the Release configuration and build the ALL_BUILD project.

Camera Plugins

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. If you are using a third-party camera, you need to install the plugin provided by the camera vendor and specify the location of the plugin using the MV_HAL_PLUGIN_PATH environment variable.

Compilation of the standalone apps

Next, compile the standalone applications (today, Metavision Studio).

  • Extract the archive (metavision_sdk_sources_standalone_apps_x.y.z.tar) that was included in your source delivery in OPENEB_SRC_DIR (without creating an extra intermediate folder metavision_sdk_sources_standalone_apps_x.y.z)

    Note

    Standalone apps source delivery is restricted to customers who acquired our SDK Source Code offer. Contact us for a quote.

  • Install the packages necessary to compile Metavision Studio:

  • Generate the makefiles using CMake (note that -DCMAKE_TOOLCHAIN_FILE must be absolute path, not a relative one):

    cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=OFF
    
  • Compile:

    cmake --build . --config Release --parallel 4
    

Compilation of the advanced modules

  • First, extract the archives of the advanced modules that were included in your source delivery in OPENEB_SRC_DIR folder. Beware to not create an extra intermediate folder metavision_sdk_sources_xxx_a.b.c while extracting the archive.

    Note

    Advanced Modules source delivery is restricted to customers who acquired our SDK Source Code offer. Contact us for a quote.

  • Go to the build directory:

    cd <OPENEB_SRC_DIR>/build
    
  • Run CMake to detect the advanced modules you extracted:

    cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=OFF [ADDITIONAL_OPTIONS]
    

    With the value of ADDITIONAL_OPTIONS that depends on the modules you are compiling:

    • if you are compiling the CV3D module, you need to add the option -DUSE_SOPHUS=ON -DSophus_DIR=<SOPHUS_DIR_PATH>\share\sophus\cmake

    • if you are compiling the ML module, you need to add the option -DUSE_TORCH=ON -DTorch_DIR=<LIBTORCH_DIR_PATH>\share\cmake\Torch

  • Build the code:

    • Either using CMake:

    cmake --build . --config Release --parallel 4
    
    • Or using Visual Studio:

      • Open the solution file metavision.sln

      • Select Release configuration

      • Build the ALL_BUILD project

Running tests

Running the test suite is a sure-fire way to ensure you did everything well with your compilation and installation process. The more modules you add the more tests will be run when you do this step.

  • Download the files necessary to run the tests. Click the Download button on the top right of the page. The archive weighs around 3 Gb.

  • 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.

  • To run the test suite you need to reconfigure your build environment using CMake and to recompile. Make sure that all your pro modules were properly configured.

    • Compilation using only CMake

      1. Regenerate the build using CMake (note that -DCMAKE_TOOLCHAIN_FILE must be absolute path, not a relative one):

      cd <OPENEB_SRC_DIR>/build
      cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=ON ..
      
      1. Compile:

      cmake --build . --config Release --parallel 4
      
    • Compilation using CMake and MS Visual Studio

      1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version):

      cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=<OPENEB_SRC_DIR>\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=<VCPKG_SRC_DIR> -DBUILD_TESTING=ON ..
      

      Note

      The value passed to the parameter -DCMAKE_TOOLCHAIN_FILE must be an absolute path, not a relative one.

      1. Open the solution file metavision.sln, select the Release configuration and build the ALL_BUILD project.

  • Running the test suite (after making sure you launched the script utils\scripts\setup_env.bat mentioned before):

    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 Studio 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.