zoukankan      html  css  js  c++  java
  • darknet yolo4 如何配置 CUDA 和 cuDNN?

    如何配置 CUDA 和 cuDNN?

    为何神经网络框架需要配置 CUDA 和 cuDNN

    通常一个神经网络框架,使用GPU加速训练或推理时都需要配置 CUDA 和 cuDNN,cuDNN 是一个 C 函数风格的动态库,像下面的这些框架都调用了 cuDNN 的函数进行 GPU 加速计算,而 cuDNN 又依赖于 CUDA,故我们需要配置 CUDA 和 cuDNN。

    Caffe Caffe2 Pytorch TensorFlow PaddlePaddle Chainer Mxnet Torch Wolfram Language 等框架都使用到了 cuDNN。

    通过以上了解得知,我们第一步是需要确定下需要的 cuDNN 版本,这个版本最好根据具体的框架的开发者给出的一个推荐版本确定即可,确定好 cuDNN 版本后,我们在 NVIDIA(英伟达) 官网上面找到相对应的 CUDA 版本即可。

    到哪里下载安装包?

    https://developer.nvidia.com/cuda-downloads (一般不用下载最新的,最新的可能在官网都找不到对应的 cuDNN 版本,比如 CUDA 11.2 截至2021/01/08)

    https://developer.nvidia.com/cudnn (需要注册账户才能下载)

    https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html (这个可以找到对应的 CUDA 版本)

    https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html (cuDNN 安装教程)

    待 cuDNN(需要注册账户才能下载) 和 CUDA (如有补丁也把补丁下载下来) 全部下载完毕后,我们可以开始配置环境了。

    如果找不到在哪里下载历史安装包,我们可以网页中寻找 Archived 关键字,点进去即可。
    注意 cuDNN7 和 cuDNN8 的版本区别,在之前推断和训练放在一个动态库,现在推断和训练放在不同动态库,这样部署时仅部署推断动态库即可,当前性能有很大提升,可以看官网测试图。

    如何在 windows 编译最新 darknet(gpu版本) ?

    安装环境:

    Win10 x64 企业版
    GeForce GTX 1660 Ti (6G)

    前置条件:

    VS2017/VS2019 都已经安装完成。
    git 工具已经安装完成。

    以下内容是需要的提前下载好。

    cuda_10.2.89_441.22_win10.exe
    cuda_10.2.1_win10.exe 补丁1
    cuda_10.2.2_win10.exe 补丁2
    cudnn-10.2-windows10-x64-v7.6.5.32.zip
    
    安装步骤

    这里以配置 darknet 为例子,我们安装 cuDNN 版本 7 最后的一个版本。

    1. 安装 CUDA (如有补丁则在安装 CUDA 之后继续安装补丁)
    验证 CUDA 安装是否成功 
    nvcc -V
    
    1. 安装 cuDNN
    假设 CUDA 安装目录位置 C:Program FilesNVIDIA GPU Computing ToolkitCUDAvx.x
    假设 cuDNN 安装目录位置 <installpath>
    
    Copy <installpath>cudaincudnn*.dll to C:Program FilesNVIDIA GPU Computing ToolkitCUDAvx.xin.
    Copy <installpath>cudaincludecudnn*.h to C:Program FilesNVIDIA GPU Computing ToolkitCUDAvx.xinclude.
    Copy <installpath>cudalibx64cudnn*.lib to C:Program FilesNVIDIA GPU Computing ToolkitCUDAvx.xlibx64.
    
    直接 CTRL+C CTRL+V 复制粘贴到目标目录即可,当然也可以使用以上命令行复制。
    
    配置环境变量一般安装 CUDA 时,自动帮你配置好了。
    windows 版本可没有验证,linux 版本到有验证,具体可参考 https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
    
    1. 下载 OpenCV
    直接官网下载 4.x 或 3.x 最新的版本即可。
    运行执行程序解压到一个位置。
    
    1. 下载 darknet 源代码
    下载源代码
    git clone https://github.com/AlexeyAB/darknet.git
    

    打开 darknet gpu 工程
    .darknetuilddarknetdarknet.sln

    修改工程 Release x64

    配置属性页中 opencv includelib 目录
    配置属性页中 cuda includelib 目录


    使用 C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.2extrasdemo_suitedeviceQuery.exe 工具查询显卡计算能力。

    C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.2extrasdemo_suite>deviceQuery.exe
    deviceQuery.exe Starting...
    
     CUDA Device Query (Runtime API) version (CUDART static linking)
    
    Detected 1 CUDA Capable device(s)
    
    Device 0: "GeForce GTX 1660 Ti"
      CUDA Driver Version / Runtime Version          11.1 / 10.2
      CUDA Capability Major/Minor version number:    7.5
      Total amount of global memory:                 6144 MBytes (6442450944 bytes)
      (24) Multiprocessors, ( 64) CUDA Cores/MP:     1536 CUDA Cores
      GPU Max Clock rate:                            1770 MHz (1.77 GHz)
      Memory Clock rate:                             6001 Mhz
      Memory Bus Width:                              192-bit
      L2 Cache Size:                                 1572864 bytes
      Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
      Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
      Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
      Total amount of constant memory:               zu bytes
      Total amount of shared memory per block:       zu bytes
      Total number of registers available per block: 65536
      Warp size:                                     32
      Maximum number of threads per multiprocessor:  1024
      Maximum number of threads per block:           1024
      Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
      Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
      Maximum memory pitch:                          zu bytes
      Texture alignment:                             zu bytes
      Concurrent copy and kernel execution:          Yes with 6 copy engine(s)
      Run time limit on kernels:                     Yes
      Integrated GPU sharing Host Memory:            No
      Support host page-locked memory mapping:       Yes
      Alignment requirement for Surfaces:            Yes
      Device has ECC support:                        Disabled
      CUDA Device Driver Mode (TCC or WDDM):         WDDM (Windows Display Driver Model)
      Device supports Unified Addressing (UVA):      Yes
      Device supports Compute Preemption:            Yes
      Supports Cooperative Kernel Launch:            Yes
      Supports MultiDevice Co-op Kernel Launch:      No
      Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
      Compute Mode:
         < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
    
    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.1, CUDA Runtime Version = 10.2, NumDevs = 1, Device0 = GeForce GTX 1660 Ti
    Result = PASS
    

    比如 CUDA Capability 7.5,则计算能力就是 7.5.
    我们还可以看到当前的显卡驱动是支持 CUDA 11.1 的,(当然你更新到最新显卡驱动是可以支持 CUDA 11.2 截至2021/01/08)。
    我们还可以看到安装的CUDA版本是 10.2

    回到 darknet 解决方案中,鼠标右键打开属性页。
    修改 CUDA C/C++ -> Device -> Code Generation 选项内容以符合你显卡计算能力。
    比如我显卡计算能力 7.5 则修改为 compute_75,sm_75

    更多内容可以使用 nvcc --help 查看。

    然后就可以编译了,经过以上步骤一般可以顺利编译完成。

    下载 yolo4 网络配置文件和 yolo4 权重文件后,执行以下命令

    darknet.exe detect yolov4.cfg yolov4.weights -ext_output dog.jpg
    

     CUDA-version: 10020 (11010), cuDNN: 7.6.5, CUDNN_HALF=1, GPU count: 1
     CUDNN_HALF=1
     # 10020 即 CUDA 10.2 版本
     # 11010 即当前显卡驱动可以支持 CUDA 11.1
     OpenCV version: 4.5.1
     0 : compute_capability = 750, cudnn_half = 1, GPU: GeForce GTX 1660 Ti
    net.optimized_memory = 0
    mini_batch = 1, batch = 8, time_steps = 1, train = 0
       layer   filters  size/strd(dil)      input                output
       0 conv     32       3 x 3/ 1    608 x 608 x   3 ->  608 x 608 x  32 0.639 BF
       1 conv     64       3 x 3/ 2    608 x 608 x  32 ->  304 x 304 x  64 3.407 BF
       2 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF
       3 route  1                                      ->  304 x 304 x  64
       4 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF
       5 conv     32       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  32 0.379 BF
       6 conv     64       3 x 3/ 1    304 x 304 x  32 ->  304 x 304 x  64 3.407 BF
       7 Shortcut Layer: 4,  wt = 0, wn = 0, outputs: 304 x 304 x  64 0.006 BF
       8 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF
       9 route  8 2                                    ->  304 x 304 x 128
      10 conv     64       1 x 1/ 1    304 x 304 x 128 ->  304 x 304 x  64 1.514 BF
      11 conv    128       3 x 3/ 2    304 x 304 x  64 ->  152 x 152 x 128 3.407 BF
      12 conv     64       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x  64 0.379 BF
      13 route  11                                     ->  152 x 152 x 128
      14 conv     64       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x  64 0.379 BF
      15 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BF
      16 conv     64       3 x 3/ 1    152 x 152 x  64 ->  152 x 152 x  64 1.703 BF
      17 Shortcut Layer: 14,  wt = 0, wn = 0, outputs: 152 x 152 x  64 0.001 BF
      18 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BF
      19 conv     64       3 x 3/ 1    152 x 152 x  64 ->  152 x 152 x  64 1.703 BF
      20 Shortcut Layer: 17,  wt = 0, wn = 0, outputs: 152 x 152 x  64 0.001 BF
      21 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BF
      22 route  21 12                                  ->  152 x 152 x 128
      23 conv    128       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x 128 0.757 BF
      24 conv    256       3 x 3/ 2    152 x 152 x 128 ->   76 x  76 x 256 3.407 BF
      25 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
      26 route  24                                     ->   76 x  76 x 256
      27 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
      28 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      29 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      30 Shortcut Layer: 27,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      31 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      32 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      33 Shortcut Layer: 30,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      34 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      35 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      36 Shortcut Layer: 33,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      37 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      38 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      39 Shortcut Layer: 36,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      40 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      41 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      42 Shortcut Layer: 39,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      43 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      44 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      45 Shortcut Layer: 42,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      46 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      47 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      48 Shortcut Layer: 45,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      49 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      50 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
      51 Shortcut Layer: 48,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF
      52 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
      53 route  52 25                                  ->   76 x  76 x 256
      54 conv    256       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 256 0.757 BF
      55 conv    512       3 x 3/ 2     76 x  76 x 256 ->   38 x  38 x 512 3.407 BF
      56 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
      57 route  55                                     ->   38 x  38 x 512
      58 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
      59 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      60 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      61 Shortcut Layer: 58,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      62 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      63 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      64 Shortcut Layer: 61,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      65 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      66 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      67 Shortcut Layer: 64,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      68 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      69 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      70 Shortcut Layer: 67,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      71 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      72 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      73 Shortcut Layer: 70,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      74 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      75 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      76 Shortcut Layer: 73,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      77 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      78 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      79 Shortcut Layer: 76,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      80 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      81 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
      82 Shortcut Layer: 79,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF
      83 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
      84 route  83 56                                  ->   38 x  38 x 512
      85 conv    512       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 512 0.757 BF
      86 conv   1024       3 x 3/ 2     38 x  38 x 512 ->   19 x  19 x1024 3.407 BF
      87 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
      88 route  86                                     ->   19 x  19 x1024
      89 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
      90 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
      91 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
      92 Shortcut Layer: 89,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF
      93 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
      94 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
      95 Shortcut Layer: 92,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF
      96 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
      97 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
      98 Shortcut Layer: 95,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF
      99 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
     100 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
     101 Shortcut Layer: 98,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF
     102 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
     103 route  102 87                                 ->   19 x  19 x1024
     104 conv   1024       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x1024 0.757 BF
     105 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     106 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
     107 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     108 max                5x 5/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.005 BF
     109 route  107                                            ->   19 x  19 x 512
     110 max                9x 9/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.015 BF
     111 route  107                                            ->   19 x  19 x 512
     112 max               13x13/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.031 BF
     113 route  112 110 108 107                        ->   19 x  19 x2048
     114 conv    512       1 x 1/ 1     19 x  19 x2048 ->   19 x  19 x 512 0.757 BF
     115 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
     116 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     117 conv    256       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 256 0.095 BF
     118 upsample                 2x    19 x  19 x 256 ->   38 x  38 x 256
     119 route  85                                     ->   38 x  38 x 512
     120 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     121 route  120 118                                ->   38 x  38 x 512
     122 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     123 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
     124 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     125 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
     126 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     127 conv    128       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 128 0.095 BF
     128 upsample                 2x    38 x  38 x 128 ->   76 x  76 x 128
     129 route  54                                     ->   76 x  76 x 256
     130 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
     131 route  130 128                                ->   76 x  76 x 256
     132 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
     133 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF
     134 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
     135 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF
     136 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
     137 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF
     138 conv    255       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 255 0.754 BF
     139 yolo
    [yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.20
    nms_kind: greedynms (1), beta = 0.600000
     140 route  136                                            ->   76 x  76 x 128
     141 conv    256       3 x 3/ 2     76 x  76 x 128 ->   38 x  38 x 256 0.852 BF
     142 route  141 126                                ->   38 x  38 x 512
     143 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     144 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
     145 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     146 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
     147 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
     148 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
     149 conv    255       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 255 0.377 BF
     150 yolo
    [yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.10
    nms_kind: greedynms (1), beta = 0.600000
     151 route  147                                            ->   38 x  38 x 256
     152 conv    512       3 x 3/ 2     38 x  38 x 256 ->   19 x  19 x 512 0.852 BF
     153 route  152 116                                ->   19 x  19 x1024
     154 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     155 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
     156 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     157 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
     158 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
     159 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
     160 conv    255       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 255 0.189 BF
     161 yolo
    [yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.05
    nms_kind: greedynms (1), beta = 0.600000
    Total BFLOPS 128.459
    avg_outputs = 1068395
     Allocate additional workspace_size = 52.43 MB
    Loading weights from yolov4.weights...
     seen 64, trained: 32032 K-images (500 Kilo-batches_64)
    Done! Loaded 162 layers from weights-file
     Detection layer: 139 - type = 28
     Detection layer: 150 - type = 28
     Detection layer: 161 - type = 28
    dog.jpg: Predicted in 182.040000 milli-seconds.
    bicycle: 92%    (left_x:  115   top_y:  128     458   height:  299)
    dog: 98%        (left_x:  129   top_y:  225     184   height:  316)
    truck: 92%      (left_x:  464   top_y:   77     221   height:   93)
    pottedplant: 33%        (left_x:  681   top_y:  109      37   height:   46)
    

    至于为何没有安装最新版本,因为我尝试安装最新版本,cuda 11.2(没对应的 cuDNN),这里选择 CUDA 11.1 和对应的 cuDNN 11.1 进行安装,然而没有什么效果,可能是 cuDNN7和cuDNN8 动态库拆分分发的原因,也可能是 cuDNN C 函数做了不兼容修改。所以还是老老实实的安装 cuDNN7 版本实在。

  • 相关阅读:
    解决Android SDK Manager更新、下载速度慢
    selenium报错以及各解决方法
    webdriver对各种浏览器的支持
    selenium driver版本和Chrome浏览器版本对应关系
    selenium web driver
    js中变量注意事项
    js选项卡实现
    两种JS方法实现斐波那契数列
    三种JS方法确定元素在数组中的索引值
    javascript内置属性——arguments
  • 原文地址:https://www.cnblogs.com/cheungxiongwei/p/14240531.html
Copyright © 2011-2022 走看看