OpenCV 5 Lands With Rebuilt DNN Engine and 80% ONNX Operator Coverage
OpenCV 5 marks the library’s first major release in years, centered on a rewritten deep neural network engine that lifts ONNX operator coverage from roughly 22% to over 80%. The old engine treated networks as flat layer lists and choked on dynamic shapes; the replacement is graph-based with proper shape inference, constant folding, and operator fusion. It now handles If/Loop subgraphs, symbolic shapes, quantize/dequantize graphs, and recognizes the MatMul-Softmax-MatMul attention pattern, collapsing it into a fused FlashAttention-style op so transformers run faster without code changes.
To avoid breaking production pipelines, OpenCV ships three engines behind one API. An EngineType argument on readNet calls lets users pin the new graph engine, the classic engine, or an optional ONNX Runtime path, with ENGINE_AUTO falling back automatically. The new engine is CPU-only for now, so CUDA or OpenVINO targets still route through the classic engine.
Beyond the DNN overhaul, the release retires the legacy C API for a smaller core, adds native FP16/BF16 and proper 0D/1D tensors, modernizes Python bindings with named arguments, cleans up the hardware acceleration layer for vendor kernels, and expands 3D tooling with ChArUco and multi-camera calibration. The pip release ships June 8. GPU support in the new engine and a non-CPU HAL are slated next.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.