Beam Bots Logo

bb_inference_opencv

CI License: Apache 2.0 Hex version badge Hexdocs badge REUSE status Ask DeepWiki

A bb_inference runtime that runs ONNX models through OpenCV's DNN module, via evision.

inference do
  model :detector do
    runtime BB.Inference.OpenCV
    source "https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_nano.onnx"
    sha256 "c789161ed43c8269fcd4e67c67eeeb4e80c622da2eb296a20bc6007bd18a0b7d"
    codec BB.Estimator.Yolo.YoloX
  end
end

What it can describe

OpenCV has no API for a network's declared inputs, so describe/1 parses the text of Evision.DNN.Net.dump/1. That gives every input and output's name, element type and shape, in the graph's order, with dynamic dimensions as nil. It is a debugging format rather than an API and may change between OpenCV versions; tested with OpenCV 5.1 through evision 1.1.

It can't report quantisation or layout: both are always nil.

Options

OpenCV falls back to the CPU silently, so the runtime can't confirm an accelerator is in use.

Installation

def deps do
  [
    {:bb_inference_opencv, "~> 0.1.0"}
  ]
end