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

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 01:15
    关注

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

    评论
  • laust9 2021-08-18 06:20
    关注

    YoloWrapper的代码如下:

    using Alturos.Yolo.Model;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Text;
    
    namespace Alturos.Yolo
    {
        public class YoloWrapper : IDisposable
        {
            public const int MaxObjects = 1000;
            private const string YoloLibraryCpu = "yolo_cpp_dll_cpu";
            private const string YoloLibraryGpu = "darknet";
    
            private readonly ImageAnalyzer _imageAnalyzer = new ImageAnalyzer();
            private readonly IYoloSystemValidator _yoloSystemValidator;
            private YoloObjectTypeResolver _objectTypeResolver;
    
            public DetectionSystem DetectionSystem { get; private set; } = DetectionSystem.Unknown;
    
            #region DllImport Cpu
    
            [DllImport(YoloLibraryCpu, EntryPoint = "init")]
            private static extern int InitializeYoloCpu(string configurationFilename, string weightsFilename, int gpuIndex);
    
            [DllImport(YoloLibraryCpu, EntryPoint = "detect_image")]
            internal static extern int DetectImageCpu(string filename, ref BboxContainer container);
    
            [DllImport(YoloLibraryCpu, EntryPoint = "detect_mat")]
            internal static extern int DetectImageCpu(IntPtr pArray, int nSize, ref BboxContainer container);
    
            [DllImport(YoloLibraryCpu, EntryPoint = "dispose")]
            internal static extern int DisposeYoloCpu();
    
            [DllImport(YoloLibraryCpu, EntryPoint = "built_with_opencv")]
            internal static extern bool BuiltWithOpenCV();
    
            #endregion
    
            #region DllImport Gpu
    
            [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);
    
    #endregion
    
            /// <summary>
            /// Initialize Yolo
            /// </summary>
            /// <param name="yoloConfiguration"></param>
            /// <param name="ignoreGpu">Disable automatic gpu detection</param>
            /// <exception cref="NotSupportedException">Thrown when the process not run in 64bit</exception>
            /// <exception cref="YoloInitializeException">Thrown if an error occurs during initialization</exception>
            public YoloWrapper(YoloConfiguration yoloConfiguration, GpuConfig gpuConfig = null, IYoloSystemValidator yoloSystemValidator = null)
            {
                if (yoloSystemValidator == null)
                {
                    this._yoloSystemValidator = new DefaultYoloSystemValidator();
                }
    
                this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, gpuConfig);
            }
    
            /// <summary>
            /// Initialize Yolo
            /// </summary>
            /// <param name="configurationFilename">Yolo configuration (.cfg) file path</param>
            /// <param name="weightsFilename">Yolo trainded data (.weights) file path</param>
            /// <param name="namesFilename">Yolo object names (.names) file path</param>
            /// <param name="gpu">Gpu Index if multiple graphic devices available</param>
            /// <param name="ignoreGpu">Disable automatic gpu detection</param>
            /// <exception cref="NotSupportedException">Thrown when the process not run in 64bit</exception>
            /// <exception cref="YoloInitializeException">Thrown if an error occurs during initialization</exception>
            public YoloWrapper(string configurationFilename, string weightsFilename, string namesFilename, GpuConfig gpuConfig = null, IYoloSystemValidator yoloSystemValidator = null)
            {
                if (yoloSystemValidator == null)
                {
                    this._yoloSystemValidator = new DefaultYoloSystemValidator();
                }
    
                this.Initialize(configurationFilename, weightsFilename, namesFilename, gpuConfig);
            }
    
            public void Dispose()
            {
                switch (this.DetectionSystem)
                {
                    case DetectionSystem.CPU:
                        DisposeYoloCpu();
                        break;
                    case DetectionSystem.GPU:
                        DisposeYoloGpu();
                        break;
                }
            }
    
            private void Initialize(string configurationFilename, string weightsFilename, string namesFilename, GpuConfig gpuConfig)
            {
                if (IntPtr.Size != 8)
                {
                    throw new NotSupportedException("Only 64-bit processes are supported");
                }
    
                var systemReport = this._yoloSystemValidator.Validate();
                if (!systemReport.MicrosoftVisualCPlusPlusRedistributableExists)
                {
                    throw new YoloInitializeException("Microsoft Visual C++ 2017-2019 Redistributable (x64)");
                }
    
                this.DetectionSystem = DetectionSystem.CPU;
    
                if (gpuConfig != null)
                {
                    if (!systemReport.CudaExists)
                    {
                        throw new YoloInitializeException("Cuda files not found");
                    }
    
                    if (!systemReport.CudnnExists)
                    {
                        throw new YoloInitializeException("Cudnn not found");
                    }
    
                    var deviceCount = GetDeviceCount();
                    if (deviceCount == 0)
                    {
                        throw new YoloInitializeException("No Nvidia graphic device is available");
                    }
    
                    if (gpuConfig.GpuIndex > (deviceCount - 1))
                    {
                        throw new YoloInitializeException("Graphic device index is out of range");
                    }
    
                    this.DetectionSystem = DetectionSystem.GPU;
                }
    
                switch (this.DetectionSystem)
                {
                    case DetectionSystem.CPU:
                        InitializeYoloCpu(configurationFilename, weightsFilename, 0);
                        break;
                    case DetectionSystem.GPU:
                        InitializeYoloGpu(configurationFilename, weightsFilename, gpuConfig.GpuIndex);
                        break;
                }
    
                this._objectTypeResolver = new YoloObjectTypeResolver(namesFilename);
            }
    
            /// <summary>
            /// Detect objects on an image
            /// </summary>
            /// <param name="filepath"></param>
            /// <returns></returns>
            /// <exception cref="FileNotFoundException">Thrown when the filepath is wrong</exception>
            public IEnumerable<YoloItem> Detect(string filepath)
            {
                if (!File.Exists(filepath))
                {
                    throw new FileNotFoundException("Cannot find the file", filepath);
                }
    
                var container = new BboxContainer();
                var count = 0;
                switch (this.DetectionSystem)
                {
                    case DetectionSystem.CPU:
                        count = DetectImageCpu(filepath, ref container);
                        break;
                    case DetectionSystem.GPU:
                        count = DetectImageGpu(filepath, ref container);
                        break;
                }
    
                if (count == -1)
                {
                    throw new NotImplementedException("C++ dll compiled incorrectly");
                }
    
                return this.Convert(container);
            }
    
            /// <summary>
            /// Detect objects on an image
            /// </summary>
            /// <param name="imageData"></param>
            /// <returns></returns>
            /// <exception cref="NotImplementedException">Thrown when the yolo_cpp dll is wrong compiled</exception>
            /// <exception cref="Exception">Thrown when the byte array is not a valid image</exception>
            public IEnumerable<YoloItem> Detect(byte[] imageData)
            {
                if (!this._imageAnalyzer.IsValidImageFormat(imageData))
                {
                    throw new Exception("Invalid image data, wrong image format");
                }
    
                var container = new BboxContainer();
                var size = Marshal.SizeOf(imageData[0]) * imageData.Length;
                var pnt = Marshal.AllocHGlobal(size);
    
                var count = 0;
                try
                {
                    // Copy the array to unmanaged memory.
                    Marshal.Copy(imageData, 0, pnt, imageData.Length);
                    switch (this.DetectionSystem)
                    {
                        case DetectionSystem.CPU:
                            count = DetectImageCpu(pnt, imageData.Length, ref container);
                            break;
                        case DetectionSystem.GPU:
                            count = DetectImageGpu(pnt, imageData.Length, ref container);
                            break;
                    }
                }
                catch (Exception)
                {
                    return null;
                }
                finally
                {
                    // Free the unmanaged memory.
                    Marshal.FreeHGlobal(pnt);
                }
    
                if (count == -1)
                {
                    throw new NotImplementedException("C++ dll compiled incorrectly");
                }
    
                return this.Convert(container);
            }
    
            /// <summary>
            /// Detect objects on an image
            /// </summary>
            /// <param name="imagePtr"></param>
            /// <param name="size"></param>
            /// <returns></returns>
            /// <exception cref="NotImplementedException">Thrown when the yolo_cpp dll is wrong compiled</exception>
            public IEnumerable<YoloItem> Detect(IntPtr imagePtr, int size)
            {
                var container = new BboxContainer();
    
                var count = 0;
                try
                {
                    switch (this.DetectionSystem)
                    {
                        case DetectionSystem.CPU:
                            count = DetectImageCpu(imagePtr, size, ref container);
                            break;
                        case DetectionSystem.GPU:
                            count = DetectImageGpu(imagePtr, size, ref container);
                            break;
                    }
                }
                catch (Exception)
                {
                    return null;
                }
    
                if (count == -1)
                {
                    throw new NotImplementedException("C++ dll compiled incorrectly");
                }
    
                return this.Convert(container);
            }
    
            public string GetGraphicDeviceName(GpuConfig gpuConfig)
            {
                if (gpuConfig == null)
                {
                    return string.Empty;
                }
    
                var systemReport = this._yoloSystemValidator.Validate();
                if (!systemReport.CudaExists || !systemReport.CudnnExists)
                {
                    return "unknown";
                }
    
                var deviceName = new StringBuilder(); //allocate memory for string
                GetDeviceName(gpuConfig.GpuIndex, deviceName);
                return deviceName.ToString();
            }
    
            public bool IsBuiltWithOpenCV()
            {
                return BuiltWithOpenCV();
            }
    
            private IEnumerable<YoloItem> Convert(BboxContainer container)
            {
                return container.candidates.Where(o => o.h > 0 || o.w > 0).Select(o =>
    
                    new YoloItem
                    {
                        X = (int)o.x,
                        Y = (int)o.y,
                        Height = (int)o.h,
                        Width = (int)o.w,
                        Confidence = o.prob,
                        Type = this._objectTypeResolver.Resolve((int)o.obj_id)
                    }
                );
            }
        }
    }
    
    
    

    调用的代码如下:

     private void Initialize(YoloConfiguration config)
            {
                try
                {
                    if (this._yoloWrapper != null)
                    {
                        this._yoloWrapper.Dispose();
                    }
    
                    var gpuConfig = new GpuConfig();
                    // var useOnlyCpu = this.cpuToolStripMenuItem.Checked;
                    bool useOnlyCpu = false;
                    if (useOnlyCpu)
                    {
                        gpuConfig = null;
                    }
    
                    this.toolStripStatusLabelYoloInfo.Text = $"Initialize...";
    
                    var sw = new Stopwatch();
                    sw.Start();
                    this._yoloWrapper = new YoloWrapper(config.ConfigFile, config.WeightsFile, config.NamesFile, gpuConfig);
                    sw.Stop();
    
                    var action = new MethodInvoker(delegate ()
                    {
                        var deviceName = this._yoloWrapper.GetGraphicDeviceName(gpuConfig);
                        this.toolStripStatusLabelYoloInfo.Text = $"Initialize Yolo in {sw.Elapsed.TotalMilliseconds:0} ms - Detection System:{this._yoloWrapper.DetectionSystem} {deviceName} Weights:{config.WeightsFile}";
                    });
    
                    this.statusStrip1.Invoke(action);
                    this.buttonProcessImage.Invoke(new MethodInvoker(delegate () { this.buttonProcessImage.Enabled = true; }));
                    this.buttonStartTracking.Invoke(new MethodInvoker(delegate () { this.buttonStartTracking.Enabled = true; }));
                }
                catch (Exception exception)
                {
                    MessageBox.Show($"{nameof(Initialize)} - {exception}", "Error Initialize", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }        
    
            private void DetectSelectedImage()
            {
                var items = this.Detect();
                this.dataGridViewResult.DataSource = items;
                this.DrawBoundingBoxes(items);
            }
    
            private List<YoloItem> Detect(bool memoryTransfer = true)
            {
                if (this._yoloWrapper == null)
                {
                    return null;
                }
    
                var imageInfo = this.GetCurrentImage();
                var imageData = File.ReadAllBytes(imageInfo.Path);
    
                var sw = new Stopwatch();
                sw.Start();
                List<YoloItem> items;
                if (memoryTransfer)
                {
                    items = this._yoloWrapper.Detect(imageData).ToList();
                }
                else
                {
                    items = this._yoloWrapper.Detect(imageInfo.Path).ToList();
                }
                sw.Stop();
                this.groupBoxResult.Text = $"Result [ processed in {sw.Elapsed.TotalMilliseconds:0} ms ]";
    
                return items;
            }
    
    

    每出错是在 this._yoloWrapper = new YoloWrapper(config.ConfigFile, config.WeightsFile, config.NamesFile, gpuConfig);这段代码处,一旦带GPU初始化,就出错,用CPU初始化就可能通过

    展开全部

    评论
  • laust9 2021-08-18 06:21
    关注

    cfg结构如下:
    [net]

    Testing

    #batch=1
    #subdivisions=1

    Training

    batch=64
    subdivisions=16
    width=416
    height=416
    channels=3
    momentum=0.9
    decay=0.0005
    angle=0
    saturation = 1.5
    exposure = 1.5
    hue=.1

    learning_rate=0.001
    burn_in=1000
    max_batches = 500200
    policy=steps
    steps=400000,450000
    scales=.1,.1

    [convolutional]
    batch_normalize=1
    filters=32
    size=3
    stride=1
    pad=1
    activation=leaky

    Downsample

    [convolutional]
    batch_normalize=1
    filters=64
    size=3
    stride=2
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=32
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=64
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    Downsample

    [convolutional]
    batch_normalize=1
    filters=128
    size=3
    stride=2
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=64
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=128
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=64
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=128
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    Downsample

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=2
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    Downsample

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=2
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    Downsample

    [convolutional]
    batch_normalize=1
    filters=1024
    size=3
    stride=2
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=1024
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=1024
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=1024
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=1024
    size=3
    stride=1
    pad=1
    activation=leaky

    [shortcut]
    from=-3
    activation=linear

    ######################

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=1024
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=1024
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=512
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=1024
    activation=leaky

    [convolutional]
    size=1
    stride=1
    pad=1
    filters=255
    activation=linear

    [yolo]
    mask = 6,7,8
    anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
    classes=80
    num=9
    jitter=.3
    ignore_thresh = .7
    truth_thresh = 1
    random=1

    [route]
    layers = -4

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [upsample]
    stride=2

    [route]
    layers = -1, 61

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=512
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=512
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=256
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=512
    activation=leaky

    [convolutional]
    size=1
    stride=1
    pad=1
    filters=255
    activation=linear

    [yolo]
    mask = 3,4,5
    anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
    classes=80
    num=9
    jitter=.3
    ignore_thresh = .7
    truth_thresh = 1
    random=1

    [route]
    layers = -4

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [upsample]
    stride=2

    [route]
    layers = -1, 36

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=256
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=256
    activation=leaky

    [convolutional]
    batch_normalize=1
    filters=128
    size=1
    stride=1
    pad=1
    activation=leaky

    [convolutional]
    batch_normalize=1
    size=3
    stride=1
    pad=1
    filters=256
    activation=leaky

    [convolutional]
    size=1
    stride=1
    pad=1
    filters=255
    activation=linear

    [yolo]
    mask = 0,1,2
    anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
    classes=80
    num=9
    jitter=.3
    ignore_thresh = .7
    truth_thresh = 1
    random=1

    展开全部

    评论
  • {∞} 2021-08-18 06:58
    关注
    评论
  • laust9 2021-08-18 07:06
    关注

    img

    img

    尝试了以上版本的OPENCV

    评论
  • {∞} 2021-08-18 07:16
    关注
    评论
  • laust9 2021-08-18 07:23
    关注

    我的编译环境是WIN10+VS2019 显卡为GF2070

    评论
    {∞} 2021-08-18 07:35

    GF2070

    回复
  • 夜半被帅醒 鑫金电子技术官方账号 2021-08-19 07:45
    关注
    评论
    laust9 2021-08-19 22:04

    问题还是出现啊!

    回复
    夜半被帅醒 回复 laust9 2021-08-20 04:23

    上面有两个链接,应该可以解决

    回复
  • {∞} 2021-08-18 06:56
    关注
    评论
  • 狼队.Modest 2021-08-23 07:27
    关注

    @laust9 你是什么语言

    评论
    laust9 2021-08-23 10:43

    c#

    回复
    酥酥禾 回复 laust9 2023-02-28 06:26

    我也遇到相同问题 请问你解决了吗

    回复
编辑
预览

报告相同问题?

问题事件

  • 系统已结题 8月24日
  • 修改了问题 8月19日
  • 修改了问题 8月19日
  • 创建了问题 8月17日
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部