Opencv 之 DNN 与 CUDA综述

Posted 明月醉窗台

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Opencv 之 DNN 与 CUDA综述相关的知识,希望对你有一定的参考价值。

Opencv 之 DNN 与 CUDA 目录

#可通过git下载拉取
git clone https://github.com/opencv/opencv_extra.git
  • 开源Opencv+contrib - 455:https://gitcode.net/openmodel/opencv

    • 深度学习是当今计算机视觉中最受欢迎和增长最快的领域。从 OpenCV 3.1 开始,库中有 DNN 模块,该模块通过深度网络实现正向传递(推理),并使用一些流行的深度学习框架(如 Caffe)进行预训练。在OpenCV 3.3中,该模块已从opencv_contrib存储库提升到主存储库(https://github.com/opencv/opencv/tree/master/modules/dnn),并已显着加速。
    • 该模块没有任何额外的依赖关系,除了libprotobuf,libprotobuf现在包含在OpenCV中。

1.DNN模块

#ifndef OPENCV_DNN_HPP
#define OPENCV_DNN_HPP

// This is an umbrella header to include into you project.
// We are free to change headers layout in dnn subfolder, so please include
// this header for future compatibility


/** @defgroup dnn Deep Neural Network module
  @
    This module contains:
        - API for new layers creation, layers are building bricks of neural networks;
        - set of built-in most-useful Layers;
        - API to construct and modify comprehensive neural networks from layers;
        - functionality for loading serialized networks models from different frameworks.

    Functionality of this module is designed only for forward pass computations (i.e. network testing).
    A network training is in principle not supported.
  @
*/
/** @example samples/dnn/classification.cpp
Check @ref tutorial_dnn_googlenet "the corresponding tutorial" for more details
*/
/** @example samples/dnn/colorization.cpp
*/
/** @example samples/dnn/object_detection.cpp
Check @ref tutorial_dnn_yolo "the corresponding tutorial" for more details
*/
/** @example samples/dnn/openpose.cpp
*/
/** @example samples/dnn/segmentation.cpp
*/
/** @example samples/dnn/text_detection.cpp
*/
#include <opencv2/dnn/dnn.hpp>

#endif /* OPENCV_DNN_HPP */

2. CUDA模块

//其中包括
    /**
     * @brief Enum of computation backends supported by layers.
     * @see Net::setPreferableBackend
     */
    enum Backend
    
        //! DNN_BACKEND_DEFAULT equals to DNN_BACKEND_INFERENCE_ENGINE if
        //! OpenCV is built with Intel's Inference Engine library or
        //! DNN_BACKEND_OPENCV otherwise.
        DNN_BACKEND_DEFAULT = 0,
        DNN_BACKEND_HALIDE,
        DNN_BACKEND_INFERENCE_ENGINE,            //!< Intel's Inference Engine computational backend
                                                 //!< @sa setInferenceEngineBackendType
        DNN_BACKEND_OPENCV,
        DNN_BACKEND_VKCOM,
        DNN_BACKEND_CUDA,
        DNN_BACKEND_WEBNN,
#ifdef __OPENCV_BUILD
        DNN_BACKEND_INFERENCE_ENGINE_NGRAPH = 1000000,     // internal - use DNN_BACKEND_INFERENCE_ENGINE + setInferenceEngineBackendType()
        DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019,      // internal - use DNN_BACKEND_INFERENCE_ENGINE + setInferenceEngineBackendType()
#endif
    ;

    /**
     * @brief Enum of target devices for computations.
     * @see Net::setPreferableTarget
     */
    enum Target
    
        DNN_TARGET_CPU = 0,
        DNN_TARGET_OPENCL,
        DNN_TARGET_OPENCL_FP16,
        DNN_TARGET_MYRIAD,
        DNN_TARGET_VULKAN,
        DNN_TARGET_FPGA,  //!< FPGA device with CPU fallbacks using Inference Engine's Heterogeneous plugin.
        DNN_TARGET_CUDA,
        DNN_TARGET_CUDA_FP16,
        DNN_TARGET_HDDL
    ;

专栏目录

以上是关于Opencv 之 DNN 与 CUDA综述的主要内容,如果未能解决你的问题,请参考以下文章

NVIDIA GPU / CUDA 中使用 OpenCV 深度神经网络模块

CUDA(GPU) 作为 OpenCV 后端

用opencv的dnn模块调onnx模型文件

OpenCV DNN之YOLO实时对象检测

OpenCV3.3深度学习模块(DNN)应用-图像分类

OpenCV4.4正式发布,支持YOLOv4版本推理与SIFT算法