实例介绍
【实例简介】C# Opencvsharp OnnxRuntime YOLOV5net 实时检测(最快速的目标检测)
本文基于yolov5net Microsoft.ML.OnnxRuntime 框架 用opencvsharp进行视频转换
先是引用yolov5net(网上有教程) 安装Microsoft.ML.OnnxRuntime 安装opengcvsharp4
1、用OpengCV所视频转换成Mt对象,
2、将Mt对像转转变成图片
3、利用yolov5net Microsoft.ML.OnnxRuntime进行图像识别并标注(这里需要一个YOLOV5 ONNX的模型文件,包括在附件包里,需要检测其他东西只需要更换模型文件即可,网上可以下载)
5、将标注完成的图像在控件上显示
通过Microsoft.ML.OnnxRuntime推理机加速,比我之前发的opengcvshar yolov3的FPS高出了不少
//包含模型文件共有700M 所以下载分有点高,理解!如果像提高视频流畅度只需要提高帧率间隔就行了 自行研究了!
【实例截图】
【核心代码】
.
├── C# Opencvsharp OnnxRuntime YOLOV5net 实时检测(最快速的目标检测).rar
└── WindowsFormsApp1
├── Onnx ylov5Net opengcvsharp.sln
├── WindowsFormsApp1
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Onnx ylov5Net opengcvsharp.csproj
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── bin
│ │ └── Debug
│ │ ├── Assets
│ │ │ ├── Weights
│ │ │ │ ├── yolov5n.onnx
│ │ │ │ ├── yolov5n6.onnx
│ │ │ │ └── yolov5s.onnx
│ │ │ ├── result.jpg
│ │ │ └── test.jpg
│ │ ├── Microsoft.ML.OnnxRuntime.dll
│ │ ├── Microsoft.ML.OnnxRuntime.pdb
│ │ ├── OpenCvSharp.Blob.dll
│ │ ├── OpenCvSharp.Blob.pdb
│ │ ├── OpenCvSharp.Blob.xml
│ │ ├── OpenCvSharp.Extensions.dll
│ │ ├── OpenCvSharp.Extensions.pdb
│ │ ├── OpenCvSharp.Extensions.xml
│ │ ├── OpenCvSharp.UserInterface.dll
│ │ ├── OpenCvSharp.UserInterface.pdb
│ │ ├── OpenCvSharp.UserInterface.xml
│ │ ├── OpenCvSharp.dll
│ │ ├── OpenCvSharp.xml
│ │ ├── OpenCvSharpExtern.dll
│ │ ├── System.Buffers.dll
│ │ ├── System.Buffers.xml
│ │ ├── System.Drawing.Common.dll
│ │ ├── System.Memory.dll
│ │ ├── System.Memory.xml
│ │ ├── System.Numerics.Vectors.dll
│ │ ├── System.Numerics.Vectors.xml
│ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ ├── System.Runtime.CompilerServices.Unsafe.xml
│ │ ├── WindowsFormsApp1.exe
│ │ ├── WindowsFormsApp1.exe.config
│ │ ├── WindowsFormsApp1.pdb
│ │ ├── Yolov5Net.Scorer.dll
│ │ ├── dll
│ │ │ ├── x64
│ │ │ │ ├── OpenCvSharpExtern.dll
│ │ │ │ ├── opencv_ffmpeg400_64.dll
│ │ │ │ └── opencv_videoio_ffmpeg455_64.dll
│ │ │ └── x86
│ │ │ ├── OpenCvSharpExtern.dll
│ │ │ ├── opencv_ffmpeg400.dll
│ │ │ └── opencv_videoio_ffmpeg455.dll
│ │ ├── onnxruntime.dll
│ │ ├── onnxruntime_providers_shared.dll
│ │ └── opencv_ffmpeg400.dll
│ ├── obj
│ │ └── Debug
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── Onnx ylov5Net opengcvsharp.csproj.CoreCompileInputs.cache
│ │ ├── TempPE
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── WindowsFormsApp1.Form1.resources
│ │ ├── WindowsFormsApp1.Properties.Resources.resources
│ │ ├── WindowsFormsApp1.csproj.CopyComplete
│ │ ├── WindowsFormsApp1.csproj.CoreCompileInputs.cache
│ │ ├── WindowsFormsApp1.csproj.FileListAbsolute.txt
│ │ ├── WindowsFormsApp1.csproj.GenerateResource.cache
│ │ ├── WindowsFormsApp1.csprojAssemblyReference.cache
│ │ ├── WindowsFormsApp1.exe
│ │ └── WindowsFormsApp1.pdb
│ └── packages.config
└── packages
├── Microsoft.ML.OnnxRuntime.1.9.0
│ ├── LICENSE.txt
│ ├── Microsoft.ML.OnnxRuntime.1.9.0.nupkg
│ ├── Privacy.md
│ ├── ThirdPartyNotices.txt
│ ├── build
│ │ ├── native
│ │ │ ├── Microsoft.ML.OnnxRuntime.props
│ │ │ ├── Microsoft.ML.OnnxRuntime.targets
│ │ │ └── include
│ │ │ ├── cpu_provider_factory.h
│ │ │ ├── onnxruntime_c_api.h
│ │ │ ├── onnxruntime_cxx_api.h
│ │ │ ├── onnxruntime_cxx_inline.h
│ │ │ ├── onnxruntime_run_options_config_keys.h
│ │ │ ├── onnxruntime_session_options_config_keys.h
│ │ │ └── provider_options.h
│ │ ├── netstandard1.1
│ │ │ ├── Microsoft.ML.OnnxRuntime.props
│ │ │ └── Microsoft.ML.OnnxRuntime.targets
│ │ └── netstandard2.0
│ │ ├── Microsoft.ML.OnnxRuntime.props
│ │ └── Microsoft.ML.OnnxRuntime.targets
│ └── runtimes
│ ├── linux-x64
│ │ └── native
│ │ └── libonnxruntime.so
│ ├── osx.10.14-x64
│ │ └── native
│ │ └── libonnxruntime.dylib
│ ├── win-arm
│ │ └── native
│ │ ├── onnxruntime.dll
│ │ ├── onnxruntime.lib
│ │ ├── onnxruntime_providers_shared.dll
│ │ └── onnxruntime_providers_shared.lib
│ ├── win-arm64
│ │ └── native
│ │ ├── onnxruntime.dll
│ │ ├── onnxruntime.lib
│ │ ├── onnxruntime_providers_shared.dll
│ │ └── onnxruntime_providers_shared.lib
│ ├── win-x64
│ │ └── native
│ │ ├── onnxruntime.dll
│ │ ├── onnxruntime.lib
│ │ ├── onnxruntime_providers_shared.dll
│ │ └── onnxruntime_providers_shared.lib
│ └── win-x86
│ └── native
│ ├── onnxruntime.dll
│ ├── onnxruntime.lib
│ ├── onnxruntime_providers_shared.dll
│ └── onnxruntime_providers_shared.lib
├── Microsoft.ML.OnnxRuntime.Managed.1.9.0
│ ├── LICENSE.txt
│ ├── Microsoft.ML.OnnxRuntime.Managed.1.9.0.nupkg
│ ├── Privacy.md
│ ├── ThirdPartyNotices.txt
│ ├── build
│ │ ├── netstandard1.1
│ │ │ └── Microsoft.ML.OnnxRuntime.Managed.targets
│ │ └── netstandard2.0
│ │ └── Microsoft.ML.OnnxRuntime.Managed.targets
│ └── lib
│ ├── netstandard1.1
│ │ ├── Microsoft.ML.OnnxRuntime.dll
│ │ └── Microsoft.ML.OnnxRuntime.pdb
│ └── netstandard2.0
│ ├── Microsoft.ML.OnnxRuntime.dll
│ └── Microsoft.ML.OnnxRuntime.pdb
├── OpenCvSharp3-AnyCPU.4.0.0.20181129
│ ├── OpenCvSharp3-AnyCPU.4.0.0.20181129.nupkg
│ ├── build
│ │ └── OpenCvSharp3-AnyCPU.props
│ ├── lib
│ │ ├── net20
│ │ │ ├── OpenCvSharp.Blob.dll
│ │ │ ├── OpenCvSharp.Blob.pdb
│ │ │ ├── OpenCvSharp.Blob.xml
│ │ │ ├── OpenCvSharp.dll
│ │ │ ├── OpenCvSharp.pdb
│ │ │ └── OpenCvSharp.xml
│ │ ├── net40
│ │ │ ├── OpenCvSharp.Blob.dll
│ │ │ ├── OpenCvSharp.Blob.pdb
│ │ │ ├── OpenCvSharp.Blob.xml
│ │ │ ├── OpenCvSharp.Extensions.dll
│ │ │ ├── OpenCvSharp.Extensions.pdb
│ │ │ ├── OpenCvSharp.Extensions.xml
│ │ │ ├── OpenCvSharp.UserInterface.dll
│ │ │ ├── OpenCvSharp.UserInterface.pdb
│ │ │ ├── OpenCvSharp.UserInterface.xml
│ │ │ ├── OpenCvSharp.dll
│ │ │ ├── OpenCvSharp.pdb
│ │ │ └── OpenCvSharp.xml
│ │ ├── net461
│ │ │ ├── OpenCvSharp.Blob.dll
│ │ │ ├── OpenCvSharp.Blob.pdb
│ │ │ ├── OpenCvSharp.Blob.xml
│ │ │ ├── OpenCvSharp.Extensions.dll
│ │ │ ├── OpenCvSharp.Extensions.pdb
│ │ │ ├── OpenCvSharp.Extensions.xml
│ │ │ ├── OpenCvSharp.UserInterface.dll
│ │ │ ├── OpenCvSharp.UserInterface.pdb
│ │ │ ├── OpenCvSharp.UserInterface.xml
│ │ │ ├── OpenCvSharp.dll
│ │ │ ├── OpenCvSharp.pdb
│ │ │ └── OpenCvSharp.xml
│ │ └── netstandard2.0
│ │ ├── OpenCvSharp.Blob.dll
│ │ ├── OpenCvSharp.Blob.pdb
│ │ ├── OpenCvSharp.Blob.xml
│ │ ├── OpenCvSharp.Extensions.dll
│ │ ├── OpenCvSharp.Extensions.pdb
│ │ ├── OpenCvSharp.Extensions.xml
│ │ ├── OpenCvSharp.dll
│ │ ├── OpenCvSharp.pdb
│ │ └── OpenCvSharp.xml
│ └── runtimes
│ ├── win10-x64
│ │ └── native
│ │ ├── OpenCvSharpExtern.dll
│ │ └── opencv_ffmpeg400_64.dll
│ └── win10-x86
│ └── native
│ ├── OpenCvSharpExtern.dll
│ └── opencv_ffmpeg400.dll
├── OpenCvSharp4.4.6.0.20220608
│ ├── OpenCvSharp4.4.6.0.20220608.nupkg
│ └── lib
│ ├── net48
│ │ ├── OpenCvSharp.dll
│ │ └── OpenCvSharp.xml
│ ├── net6.0
│ │ ├── OpenCvSharp.dll
│ │ └── OpenCvSharp.xml
│ ├── netcoreapp3.1
│ │ ├── OpenCvSharp.dll
│ │ └── OpenCvSharp.xml
│ ├── netstandard2.0
│ │ ├── OpenCvSharp.dll
│ │ └── OpenCvSharp.xml
│ └── netstandard2.1
│ ├── OpenCvSharp.dll
│ └── OpenCvSharp.xml
├── OpenCvSharp4.Windows.4.6.0.20220608
│ └── OpenCvSharp4.Windows.4.6.0.20220608.nupkg
├── OpenCvSharp4.runtime.win.4.6.0.20220608
│ ├── OpenCvSharp4.runtime.win.4.6.0.20220608.nupkg
│ ├── build
│ │ ├── net48
│ │ │ └── OpenCvSharp4.runtime.win.props
│ │ ├── net5.0
│ │ │ └── OpenCvSharp4.runtime.win.props
│ │ ├── netcoreapp
│ │ │ └── OpenCvSharp4.runtime.win.props
│ │ └── netstandard
│ │ └── OpenCvSharp4.runtime.win.props
│ └── runtimes
│ ├── win-x64
│ │ └── native
│ │ ├── OpenCvSharpExtern.dll
│ │ └── opencv_videoio_ffmpeg460_64.dll
│ └── win-x86
│ └── native
│ ├── OpenCvSharpExtern.dll
│ └── opencv_videoio_ffmpeg460.dll
├── System.Buffers.4.5.1
│ ├── LICENSE.TXT
│ ├── System.Buffers.4.5.1.nupkg
│ ├── THIRD-PARTY-NOTICES.TXT
│ ├── lib
│ │ ├── net461
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ ├── netcoreapp2.0
│ │ │ └── _._
│ │ ├── netstandard1.1
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ ├── netstandard2.0
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ └── uap10.0.16299
│ │ └── _._
│ ├── ref
│ │ ├── net45
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ ├── netcoreapp2.0
│ │ │ └── _._
│ │ ├── netstandard1.1
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ ├── netstandard2.0
│ │ │ ├── System.Buffers.dll
│ │ │ └── System.Buffers.xml
│ │ └── uap10.0.16299
│ │ └── _._
│ ├── useSharedDesignerContext.txt
│ └── version.txt
├── System.Drawing.Common.5.0.2
│ ├── Icon.png
│ ├── LICENSE.TXT
│ ├── System.Drawing.Common.5.0.2.nupkg
│ ├── THIRD-PARTY-NOTICES.TXT
│ ├── lib
│ │ ├── MonoAndroid10
│ │ │ └── _._
│ │ ├── MonoTouch10
│ │ │ └── _._
│ │ ├── net461
│ │ │ └── System.Drawing.Common.dll
│ │ ├── netcoreapp3.0
│ │ │ ├── System.Drawing.Common.dll
│ │ │ └── System.Drawing.Common.xml
│ │ ├── netstandard2.0
│ │ │ └── System.Drawing.Common.dll
│ │ ├── xamarinios10
│ │ │ └── _._
│ │ ├── xamarinmac20
│ │ │ └── _._
│ │ ├── xamarintvos10
│ │ │ └── _._
│ │ └── xamarinwatchos10
│ │ └── _._
│ ├── ref
│ │ ├── MonoAndroid10
│ │ │ └── _._
│ │ ├── MonoTouch10
│ │ │ └── _._
│ │ ├── net461
│ │ │ └── System.Drawing.Common.dll
│ │ ├── netcoreapp3.0
│ │ │ ├── System.Drawing.Common.dll
│ │ │ └── System.Drawing.Common.xml
│ │ ├── netstandard2.0
│ │ │ └── System.Drawing.Common.dll
│ │ ├── xamarinios10
│ │ │ └── _._
│ │ ├── xamarinmac20
│ │ │ └── _._
│ │ ├── xamarintvos10
│ │ │ └── _._
│ │ └── xamarinwatchos10
│ │ └── _._
│ ├── runtimes
│ │ ├── unix
│ │ │ └── lib
│ │ │ ├── netcoreapp2.0
│ │ │ │ └── System.Drawing.Common.dll
│ │ │ └── netcoreapp3.0
│ │ │ ├── System.Drawing.Common.dll
│ │ │ └── System.Drawing.Common.xml
│ │ └── win
│ │ └── lib
│ │ ├── netcoreapp2.0
│ │ │ └── System.Drawing.Common.dll
│ │ └── netcoreapp3.0
│ │ ├── System.Drawing.Common.dll
│ │ └── System.Drawing.Common.xml
│ ├── useSharedDesignerContext.txt
│ └── version.txt
├── System.Memory.4.5.4
│ ├── LICENSE.TXT
│ ├── System.Memory.4.5.4.nupkg
│ ├── THIRD-PARTY-NOTICES.TXT
│ ├── lib
│ │ ├── net461
│ │ │ ├── System.Memory.dll
│ │ │ └── System.Memory.xml
│ │ ├── netcoreapp2.1
│ │ │ └── _._
│ │ ├── netstandard1.1
│ │ │ ├── System.Memory.dll
│ │ │ └── System.Memory.xml
│ │ └── netstandard2.0
│ │ ├── System.Memory.dll
│ │ └── System.Memory.xml
│ ├── ref
│ │ └── netcoreapp2.1
│ │ └── _._
│ ├── useSharedDesignerContext.txt
│ └── version.txt
├── System.Numerics.Vectors.4.5.0
│ ├── LICENSE.TXT
│ ├── System.Numerics.Vectors.4.5.0.nupkg
│ ├── THIRD-PARTY-NOTICES.TXT
│ ├── lib
│ │ ├── MonoAndroid10
│ │ │ └── _._
│ │ ├── MonoTouch10
│ │ │ └── _._
│ │ ├── net46
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── netcoreapp2.0
│ │ │ └── _._
│ │ ├── netstandard1.0
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── netstandard2.0
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── portable-net45 win8 wp8 wpa81
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── uap10.0.16299
│ │ │ └── _._
│ │ ├── xamarinios10
│ │ │ └── _._
│ │ ├── xamarinmac20
│ │ │ └── _._
│ │ ├── xamarintvos10
│ │ │ └── _._
│ │ └── xamarinwatchos10
│ │ └── _._
│ ├── ref
│ │ ├── MonoAndroid10
│ │ │ └── _._
│ │ ├── MonoTouch10
│ │ │ └── _._
│ │ ├── net45
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── net46
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── netcoreapp2.0
│ │ │ └── _._
│ │ ├── netstandard1.0
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── netstandard2.0
│ │ │ ├── System.Numerics.Vectors.dll
│ │ │ └── System.Numerics.Vectors.xml
│ │ ├── uap10.0.16299
│ │ │ └── _._
│ │ ├── xamarinios10
│ │ │ └── _._
│ │ ├── xamarinmac20
│ │ │ └── _._
│ │ ├── xamarintvos10
│ │ │ └── _._
│ │ └── xamarinwatchos10
│ │ └── _._
│ ├── useSharedDesignerContext.txt
│ └── version.txt
├── System.Runtime.CompilerServices.Unsafe.6.0.0
│ ├── Icon.png
│ ├── LICENSE.TXT
│ ├── System.Runtime.CompilerServices.Unsafe.6.0.0.nupkg
│ ├── THIRD-PARTY-NOTICES.TXT
│ ├── buildTransitive
│ │ ├── netcoreapp2.0
│ │ │ └── System.Runtime.CompilerServices.Unsafe.targets
│ │ └── netcoreapp3.1
│ │ └── _._
│ ├── lib
│ │ ├── net461
│ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ │ └── System.Runtime.CompilerServices.Unsafe.xml
│ │ ├── net6.0
│ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ │ └── System.Runtime.CompilerServices.Unsafe.xml
│ │ ├── netcoreapp3.1
│ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ │ └── System.Runtime.CompilerServices.Unsafe.xml
│ │ └── netstandard2.0
│ │ ├── System.Runtime.CompilerServices.Unsafe.dll
│ │ └── System.Runtime.CompilerServices.Unsafe.xml
│ └── useSharedDesignerContext.txt
└── Yolov5Net.1.0.9
├── Yolov5Net.1.0.9.nupkg
└── lib
└── netstandard2.0
└── Yolov5Net.Scorer.dll
161 directories, 301 files
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)