Deep Learning in OpenCV

自OpenCV 3.1起,引入了深度学习模块,支持使用预训练模型进行图像识别等任务。该模块无需额外依赖,且兼容多种深度学习框架如Caffe、TensorFlow等。此外,还提供了丰富的层类型支持及性能优化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://github.com/opencv/opencv/wiki/Deep-Learning-in-OpenCV

Deep Learning in OpenCV

Vadim Pisarevsky edited this page on 2 Aug ·  4 revisions

Deep Learning is the most popular and the fastest growing area in Computer Vision nowadays. Since OpenCV 3.1 there is DNN module in the library that implements forward pass (inferencing) with deep networks, pre-trained using some popular deep learning frameworks, such as Caffe. In OpenCV 3.3 the module has been promoted from opencv_contrib repository to the main repository (https://github.com/opencv/opencv/tree/master/modules/dnn) and has been accelerated significantly.

The module has no any extra dependencies, except for libprotobuf, and libprotobuf is now included into OpenCV.

The supported frameworks:

  • Caffe 1
  • TensorFlow
  • Torch/PyTorch

The supported layers:

  • AbsVal
  • AveragePooling
  • BatchNormalization
  • Concatenation
  • Convolution (including dilated convolution)
  • Crop
  • Deconvolution, a.k.a. transposed convolution or full convolution
  • DetectionOutput (SSD-specific layer)
  • Dropout
  • Eltwise (+, *, max)
  • Flatten
  • FullyConnected
  • LRN
  • LSTM
  • MaxPooling
  • MaxUnpooling
  • MVN
  • NormalizeBBox (SSD-specific layer)
  • Padding
  • Permute
  • Power
  • PReLU (including ChannelPReLU with channel-specific slopes)
  • PriorBox (SSD-specific layer)
  • ReLU
  • RNN
  • Scale
  • Shift
  • Sigmoid
  • Slice
  • Softmax
  • Split
  • TanH

The module includes some SSE, AVX, AVX2 and NEON acceleration of the performance-critical layers. There is also constantly-improved Halide backend. OpenCL (libdnn-based) backend is being developed and should be integrated after OpenCV 3.3 release. Here you may find the up-to-date benchmarking results: DNN Efficiency

The following networks have been tested and known to work:

  • AlexNet
  • GoogLeNet v1 (also referred to as Inception-5h)
  • ResNet-34/50/...
  • SqueezeNet v1.1
  • VGG-based FCN (semantical segmentation network)
  • ENet (lightweight semantical segmentation network)
  • VGG-based SSD (object detection network)
  • MobileNet-based SSD (light-weight object detection network)

The provided API (for C++ and Python) is very easy to use, just load the network and run it. Multiple inputs/outputs are supported. Here are the examples: https://github.com/opencv/opencv/tree/master/samples/dnn.

There is Habrahabr article describing the module: https://habrahabr.ru/company/intel/blog/333612/(in Russian).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值