OpenCV  3.4.12
Open Source Computer Vision
How to enable Halide backend for improve efficiency

Prev Tutorial: Load Caffe framework models

Next Tutorial: How to schedule your network for Halide backend

Introduction

This tutorial guidelines how to run your models in OpenCV deep learning module using Halide language backend. Halide is an open-source project that let us write image processing algorithms in well-readable format, schedule computations according to specific device and evaluate it with a quite good efficiency.

An official website of the Halide project: http://halide-lang.org/.

An up to date efficiency comparison: https://github.com/opencv/opencv/wiki/DNN-Efficiency

Requirements

LLVM compiler

Note
LLVM compilation might take a long time.
Note
\\path-to-llvm-build\\ and \\path-to-llvm-install\\ are different directories.

Halide language.

Build OpenCV with Halide backend

When you build OpenCV add the following configuration flags:

Set Halide as a preferable backend

net.setPreferableBackend(DNN_BACKEND_HALIDE);