laust9 2021-08-17 22:52 采纳率: 0%
浏览 1441
已结题

darknet.dll 在C#中调用出错 cuDNN Error cudnn_convolutional_setup()

我采用的时darknet V4版本,在使用CUDA10.2 CUDNN8.0.5 OPENCV4.5.3编译完毕darknet之后,做darknet.exe测试,可以检测到dog图片,采用调用摄像头检测也是可以,并且可以看到GPU已经被使用。但是在使用darknet.dll时,出现错误。加载网络到一定时就报错,具体错误代码如下:

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
Total BFLOPS 128.459 
avg_outputs = 1068395 
 Allocate additional workspace_size = 81.03 MB 
Loading weights from .\yolov4.weights... Used GPU 0 
net.optimized_memory = 0 
mini_batch = 1, batch = 16, time_steps = 1, train = 1 
Create CUDA-stream - 0 
 Create cudnn-handle 0 
nms_kind: greedynms (1), beta = 0.600000 
nms_kind: greedynms (1), beta = 0.600000 
nms_kind: greedynms (1), beta = 0.600000 
Done! Loaded 162 layers from weights-file 
Darknet error location: E:\TRY\darknet-master\src\dark_cuda.c, cudnn_check_error, line #205
cuDNN Error: CUDNN_STATUS_BAD_PARAM: Bad file descriptor
 seen 64, trained: 32032 K-images (500 Kilo-batches_64) 
 cuDNN status Error in: file: E:\TRY\darknet-master\src\convolutional_layer.c : cudnn_convolutional_setup() : line: 253 : build time: Aug 17 2021 - 20:41:18 
 cuDNN Error: CUDNN_STATUS_BAD_PARAM。


我调用darknet.dll采用的C# wrapper。其调用的代码为:

  [DllImport(YoloLibraryGpu, EntryPoint = "init")]
        internal static extern int InitializeYoloGpu(string configurationFilename, string weightsFilename, int gpuIndex);

        [DllImport(YoloLibraryGpu, EntryPoint = "detect_image")]
        internal static extern int DetectImageGpu(string filename, ref BboxContainer container);

        [DllImport(YoloLibraryGpu, EntryPoint = "detect_mat")]
        internal static extern int DetectImageGpu(IntPtr pArray, int nSize, ref BboxContainer container);

        [DllImport(YoloLibraryGpu, EntryPoint = "dispose")]
        internal static extern int DisposeYoloGpu();

        [DllImport(YoloLibraryGpu, EntryPoint = "get_device_count")]
        internal static extern int GetDeviceCount();

        [DllImport(YoloLibraryGpu, EntryPoint = "get_device_name")]
        internal static extern int GetDeviceName(int gpu, StringBuilder deviceName);
        //每次程序都在初始化darknet网络的时候报错,即在下面这一行代码:
     this._yoloWrapper = new YoloWrapper(config.ConfigFile, config.WeightsFile, config.NamesFile, gpuConfig);

后面又换到cuda11.0,cudnn换到8.2.0,问题还是照旧出现!!!!
请码友帮忙参谋一下,请收下我的膝盖!

  • 写回答

10条回答 默认 最新

  • shifenglv 2021-08-18 09:15
    关注

    暂时不知道什么原因。你可以把测试打包代码发一下,不然光看也不知道原因。我猜测是权重初始化出了问题,dark net我也常常遇到各种莫名其妙的问题。

    评论

报告相同问题?

问题事件

  • 系统已结题 8月25日
  • 修改了问题 8月20日
  • 修改了问题 8月20日
  • 创建了问题 8月17日

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化