# Yolov8.Net
https://github.com/sstainba/Yolov8.Net
This is a .NET interface for using Yolov5 and Yolov8 models on the ONNX runtime.
NOTE: If you want to use the GPU, you must have BOTH the CUDA drivers AND CUDNN installed!!!!!!
This was tested with cuDNN 9.3 + CUDA 11.8
Loading the model is time consuming, so initial predictions will be slow. Subsequent
predictions will be significantly faster.

```csharp
// Create new Yolov8 predictor, specifying the model (in ONNX format)
// If you are using a custom trained model, you can provide an array of labels. Otherwise, the standard Coco labels are used.
using var yolo = YoloV8Predictor.Create("./assets/yolov8m.onnx");
// Provide an input image. Image will be resized to model input if needed.
using var image = Image.FromFile("Assets/rufus.jpg");
var predictions = yolo.Predict(image);
// Draw your boxes
using var graphics = Graphics.FromImage(image);
foreach (var pred in predictions)
{
var originalImageHeight = image.Height;
var originalImageWidth = image.Width;
var x = Math.Max(pred.Rectangle.X, 0);
var y = Math.Max(pred.Rectangle.Y, 0);
var width = Math.Min(originalImageWidth - x, pred.Rectangle.Width);
var height = Math.Min(originalImageHeight - y, pred.Rectangle.Height);
////////////////////////////////////////////////////////////////////////////////////////////
// *** Note that the output is already scaled to the original image height and width. ***
////////////////////////////////////////////////////////////////////////////////////////////
// Bounding Box Text
string text = $"{pred.Label.Name} [{pred.Score}]";
using (Graphics graphics = Graphics.FromImage(image))
{
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
// Define Text Options
Font drawFont = new Font("consolas", 11, FontStyle.Regular);
SizeF size = graphics.MeasureString(text, drawFont);
SolidBrush fontBrush = new SolidBrush(Color.Black);
Point atPoint = new Point((int)x, (int)y - (int)size.Height - 1);
// Define BoundingBox options
Pen pen = new Pen(Color.Yellow, 2.0f);
SolidBrush colorBrush = new SolidBrush(Color.Yellow);
// Draw text on image
graphics.FillRectangle(colorBrush, (int)x, (int)(y - size.Height - 1), (int)size.Width, (int)size.Height);
graphics.DrawString(text, drawFont, fontBrush, atPoint);
// Draw bounding box on image
graphics.DrawRectangle(pen, x, y, width, height);
}
}
```

# References
https://github.com/ultralytics/yolov8
https://github.com/mentalstack/yolov5-net
没有合适的资源?快使用搜索试试~ 我知道了~
通过 ONNX Runtime 使用 Yolov5 和 Yolov8 模型的 .net 6 实现.zip

共48个文件
jpg:23个
cs:11个
onnx:4个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 4 浏览量
2024-11-27
00:26:56
上传
评论
收藏 320.86MB ZIP 举报
温馨提示
通过 ONNX Runtime 使用 Yolov5 和 Yolov8 模型的 .net 6 实现Yolov8网站https://github.com/sstainba/Yolov8.Net这是在 ONNX 运行时使用 Yolov5 和 Yolov8 模型的 .NET 接口。注意如果要使用 GPU,则必须同时安装 CUDA 驱动程序和 CUDNN!!!!这是使用 cuDNN 9.3 + CUDA 11.8 测试的。加载模型很耗时,因此初始预测会很慢。后续预测将明显更快。// Create new Yolov8 predictor, specifying the model (in ONNX format)// If you are using a custom trained model, you can provide an array of labels. Otherwise, the standard Coco labels are used.using var yolo = YoloV8Predictor.Create("./assets/yolov8m.o
资源推荐
资源详情
资源评论



















收起资源包目录























































共 48 条
- 1
资源评论


赵闪闪168
- 粉丝: 1745
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 酒店ITM网络技术大比武题库.doc
- 《软件工程与项目管理》第10章软件项目管理.ppt
- (源码)基于PythonDjango框架的疫情信息综合管理系统.zip
- 价值工程在压力容器制造行业项目管理中的应用.docx
- 《网络安全协议IPSec》教学设计.docx
- 当前计算机辅助教学的实践与思考.docx
- 专升本互联网软件应用与开发模拟试题试卷复习资料.doc
- Asp的求职招聘网站设计方案与开发.doc
- 大数据背景下的税收治理问题.docx
- 安徽专升本安大高升计算机基础提高班测试卷(附标准标准答案).doc
- ASP.NET开发大全第23章.登录模块方案设计书.doc
- 探索党员档案信息化的管理新途径.docx
- 新经济时代云计算下会计信息化的应用.docx
- 对网络安全等级保护设计方案的探讨.docx
- (源码)基于Django框架的智能电表数据采集系统.zip
- 软件工程项目思想——C--面向对象程序设计.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
