【官方框架地址】
https://github.com/ultralytics/ultralytics.git
【算法介绍】
YOLOv8 抛弃了前几代模型的 Anchor-Base。
YOLO 是一种基于图像全局信息进行预测的目标检测系统。自 2015 年 Joseph Redmon、Ali Farhadi 等人提出初代模型以来,领域内的研究者们已经对 YOLO 进行了多次更新迭代,模型性能越来越强大。现在,YOLOv8 已正式发布。
YOLOv8 是由小型初创公司 Ultralytics 创建并维护的,值得注意的是 YOLOv5 也是由该公司创建的。
【效果展示】
【实现部分代码】
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenCvSharp;
namespace FIRC
{
public partial class Form1 : Form
{
Mat src = new Mat();
Yolov8ClsManager ym = new Yolov8ClsManager();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "图文件(*.*)|*.jpg;*.png;*.jpeg;*.bmp";
openFileDialog.RestoreDirectory = true;
openFileDialog.Multiselect = false;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
src = Cv2.ImRead(openFileDialog.FileName);
pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src);
}
}
private void button2_Click(object sender, EventArgs e)
{
if(pictureBox1.Image==null)
{
return;
}
Stopwatch sw = new Stopwatch();
sw.Start();
var result = ym.Inference(src);
sw.Stop();
this.Text = "耗时" + sw.Elapsed.TotalSeconds + "秒";
var resultMat = ym.DrawImage(src,result);
pictureBox2.Image= OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultMat); //Mat转Bitmap
}
private void Form1_Load(object sender, EventArgs e)
{
ym.LoadWeights(Application.StartupPath+ "\\weights\\yolov8l-cls.onnx", Application.StartupPath + "\\weights\\labels.txt");
}
private void btn_video_Click(object sender, EventArgs e)
{
}
}
}
【视频演示】
https://www.bilibili.com/video/BV1uN4y1q7iu/
【源码下载】
https://download.csdn.net/download/FL1623863129/88698695?spm=1001.2014.3001.5501
【测试环境】
vs2019
netframework4.8
opencvsharp4.8.0
openvinosharp
注意无需额外安装openvino运行库直接可以运行