进入官网查看,网站优化 价格,成都网站建设 小兵cms,大型网站seo方法【算法介绍】基于YOLOv11的淡水鱼种类检测系统是一种利用深度学习技术#xff0c;特别是YOLOv11目标检测算法#xff0c;实现对淡水鱼种类进行自动识别的高效系统#xff0c;其支持识别的目标种类涵盖#xff1a;孟加拉鲳鱼#xff08;Bangus#xff09;、鳙鱼#xff0…【算法介绍】基于YOLOv11的淡水鱼种类检测系统是一种利用深度学习技术特别是YOLOv11目标检测算法实现对淡水鱼种类进行自动识别的高效系统其支持识别的目标种类涵盖孟加拉鲳鱼Bangus、鳙鱼Big Head Carp、黑斑鲃Black Spotted Barb、鲶鱼Catfish、攀鲈Climbing Perch、四指马鲅Fourfinger Threadfish、淡水鳗鲡Freshwater Eel、玻璃鲈鱼Glass Perchlet、虾虎鱼Goby、金鱼Gold Fish、吻口鱼Gourami、草鱼Grass Carp、绿斑河豚Green Spotted Puffer、印度鲤Indian Carp、印度鲮Indo-Pacific Tarpon、美洲鲈Jaguar Gapote、清道夫鱼Janitor Fish、刀鱼Knifefish、长吻管鳚Long-Snouted Pipefish、食蚊鱼Mosquito Fish、塘鳢Mudfish、鲻鱼Mullet、湄公鱼Pangasius、鲈鱼Perch、油鱼Scat Fish、银鲃Silver Barb、银鲫Silver Carp、银鲈Silver Perch、黑鱼Snakehead、巨鲶Tenpounder及罗非鱼Tilapia。该系统的工作原理是通过训练YOLOv11模型使其能够准确识别淡水图像或视频中的鱼类种类。YOLOv11作为YOLO系列的最新版本具有强大的特征提取能力和高效的推理速度这使得它能够在复杂的水下环境中快速、准确地检测出淡水鱼并标注出其种类和位置。在构建该系统时首先需要准备一个包含各种淡水鱼图像的数据集并对这些图像进行标注包括鱼类的位置和类别信息。然后使用这些数据对YOLOv11模型进行训练使其学习到淡水鱼的特征。训练完成后系统就可以对输入的淡水鱼图像或视频进行实时检测并输出检测结果。该系统可以广泛应用于淡水渔业资源管理、生态保护、水产养殖等领域。例如在水产养殖中通过该系统可以实时监测鱼塘中的鱼类种类和数量为养殖者提供决策依据。在生态保护方面该系统可以帮助科研人员更好地了解淡水鱼类的分布和数量为生态保护提供数据支持。总之基于YOLOv11的淡水鱼种类检测系统是一种高效、准确的目标检测系统具有广泛的应用前景。【效果展示】【测试环境】windows10 x64系统VS2019netframework4.7.2opencvsharp4.9.0onnxruntime1.22.0注意使用CPU推理没有使用cuda推理因此不需要电脑具有nvidia显卡无需安装安装cudadunn【训练数据集介绍】数据集格式Pascal VOC格式YOLO格式(不包含分割路径的txt文件仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件)图片数量(jpg文件个数)2967标注数量(xml文件个数)2967标注数量(txt文件个数)2967标注类别数31标注类别名称(注意yolo格式类别顺序不和这个对应而以labels文件夹classes.txt为准):[Bangus,Big Head Carp,Black Spotted Barb,Catfish,Climbing Perch,Fourfinger Threadfish,Freshwater Eel,Glass Perchlet,Goby,Gold Fish,Gourami,Grass Carp,Green Spotted Puffer,Indian Carp,Indo-Pacific Tarpon,Jaguar Gapote,Janitor Fish,Knifefish,Long-Snouted Pipefish,Mosquito Fish,Mudfish,Mullet,Pangasius,Perch,Scat Fish,Silver Barb,Silver Carp,Silver Perch,Snakehead,Tenpounder,Tilapia]每个类别标注的框数Bangus 框数 81Big Head Carp 框数 77Black Spotted Barb 框数 76Catfish 框数 84Climbing Perch 框数 91Fourfinger Threadfish 框数 55Freshwater Eel 框数 77Glass Perchlet 框数 89Goby 框数 118Gold Fish 框数 81Gourami 框数 87Grass Carp 框数 170Green Spotted Puffer 框数 60Indian Carp 框数 75Indo-Pacific Tarpon 框数 86Jaguar Gapote 框数 75Janitor Fish 框数 88Knifefish 框数 83Long-Snouted Pipefish 框数 84Mosquito Fish 框数 91Mudfish 框数 55Mullet 框数 86Pangasius 框数 87Perch 框数 81Scat Fish 框数 67Silver Barb 框数 98Silver Carp 框数 74Silver Perch 框数 80Snakehead 框数 81Tenpounder 框数 104Tilapia 框数 1763总框数4304使用标注工具labelImg标注规则对类别进行画矩形框重要说明暂无特别声明本数据集不对训练的模型或者权重文件精度作任何保证数据集只提供准确且合理标注图片预览标注例子【训练信息】参数值训练集图片数2003验证集图片数760训练map75.6%训练精度(Precision)75.6%训练召回率(Recall)69.8%验证集评估精度信息ClassImagesInstancesPRmAP50mAP50-95all7609660.7560.6980.7560.628Bangus8120.5850.4170.4620.418Big Head Carp15150.7250.4670.5610.511Black Spotted Barb12130.6060.5930.5840.513Catfish11110.5460.6360.5310.345Climbing Perch12120.7130.9170.8820.713Fourfinger Threadfish990.3320.8890.6850.546Freshwater Eel14140.7860.8570.870.726Glass Perchlet13130.610.7230.6630.565Goby51540.8880.4390.790.645Gold Fish660.90410.9950.94Gourami990.96210.9950.83Grass Carp22220.6180.8640.7460.655Green Spotted Puffer15150.9550.9330.9880.829Indian Carp11110.3930.5450.3890.311Indo-Pacific Tarpon890.1240.3330.1560.139Jaguar Gapote11110.7710.9210.9680.906Janitor Fish19210.840.6190.7490.543Knifefish10100.96310.9950.87Long-Snouted Pipefish18200.9290.6510.8230.561Mosquito Fish131410.6270.7860.595Mudfish13130.3610.4620.4990.413Mullet13160.6910.6250.6440.589Pangasius12120.880.9170.9510.837Perch292910.870.980.917Scat Fish46460.9870.8480.9810.811Silver Barb52540.870.3710.6930.585Silver Carp16160.7780.9380.7860.71Silver Perch39400.8010.650.8080.652Snakehead46490.9160.4470.7880.507Tenpounder75800.980.2750.7930.668Tilapia1303100.9210.790.9060.602【界面代码】using DeploySharp.Data; using OpenCvSharp; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace FIRC { public partial class Form1 : Form { public bool videoStart false;//视频停止标志 string weightsPath Application.StartupPath \\weights;//模型目录 YoloDetector detetor new YoloDetector();//推理引擎 public Form1() { InitializeComponent(); CheckForIllegalCrossThreadCalls false;//线程更新控件不报错 } private void LoadWeightsFromDir() { var di new DirectoryInfo(weightsPath); foreach(var fi in di.GetFiles(*.onnx)) { comboBox1.Items.Add(fi.Name); } if(comboBox1.Items.Count0) { comboBox1.SelectedIndex 0; } else { tssl_show.Text 未找到模型,请关闭程序放入模型到weights文件夹!; tsb_pic.Enabled false; tsb_video.Enabled false; tsb_camera.Enabled false; } } private void Form1_Load(object sender, EventArgs e) { LoadWeightsFromDir();//从目录加载模型 } public string GetResultString(DetResult[] result) { Dictionarystring, int resultDict new Dictionarystring, int(); for (int i 0; i result.Length; i) { if(resultDict.ContainsKey( result[i].Category) ) { resultDict[result[i].Category]; } else { resultDict[result[i].Category] 1; } } var resultStr ; foreach(var item in resultDict) { resultStr string.Format({0}:{1}\r\n,item.Key,item.Value); } return resultStr; } private void tsb_pic_Click(object sender, EventArgs e) { OpenFileDialog ofd new OpenFileDialog(); ofd.Filter *.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png; if (ofd.ShowDialog() ! DialogResult.OK) return; tssl_show.Text 正在检测中...; Task.Run(() { var sw new Stopwatch(); sw.Start(); Mat image Cv2.ImRead(ofd.FileName); detetor.SetParams(Convert.ToSingle(numericUpDown1.Value), Convert.ToSingle(numericUpDown2.Value)); var resultsdetetor.Inference(image); var resultImage detetor.DrawImage(image, results); sw.Stop(); pb_show.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultImage); tb_res.Text GetResultString(results); tssl_show.Text 检测已完成!总计耗时sw.Elapsed.TotalSeconds秒; }); } public void VideoProcess(string videoPath) { Task.Run(() { detetor.SetParams(Convert.ToSingle(numericUpDown1.Value), Convert.ToSingle(numericUpDown2.Value)); VideoCapture capture new VideoCapture(videoPath); if (!capture.IsOpened()) { tssl_show.Text视频打开失败!; return; } Mat frame new Mat(); var sw new Stopwatch(); int fps 0; while (videoStart) { capture.Read(frame); if (frame.Empty()) { Console.WriteLine(data is empty!); break; } sw.Start(); var results detetor.Inference(frame); var resultImg detetor.DrawImage(frame,results); sw.Stop(); fps Convert.ToInt32(1 / sw.Elapsed.TotalSeconds); sw.Reset(); Cv2.PutText(resultImg, FPS fps, new OpenCvSharp.Point(30, 30), HersheyFonts.HersheyComplex, 1.0, new Scalar(255, 0, 0), 3); //显示结果 pb_show.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultImg); tb_res.Text GetResultString(results); Thread.Sleep(5); } capture.Release(); pb_show.Image null; tssl_show.Text 视频已停止!; tsb_video.Text 选择视频; }); } public void CameraProcess(int cameraIndex0) { Task.Run(() { detetor.SetParams(Convert.ToSingle(numericUpDown1.Value), Convert.ToSingle(numericUpDown2.Value)); VideoCapture capture new VideoCapture(cameraIndex); if (!capture.IsOpened()) { tssl_show.Text 摄像头打开失败!; return; } Mat frame new Mat(); var sw new Stopwatch(); int fps 0; while (videoStart) { capture.Read(frame); if (frame.Empty()) { Console.WriteLine(data is empty!); break; } sw.Start(); var results detetor.Inference(frame); var resultImg detetor.DrawImage(frame, results); sw.Stop(); fps Convert.ToInt32(1 / sw.Elapsed.TotalSeconds); sw.Reset(); Cv2.PutText(resultImg, FPS fps, new OpenCvSharp.Point(30, 30), HersheyFonts.HersheyComplex, 1.0, new Scalar(255, 0, 0), 3); //显示结果 pb_show.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultImg); tb_res.Text GetResultString(results); Thread.Sleep(5); } capture.Release(); pb_show.Image null; tssl_show.Text 摄像头已停止!; tsb_camera.Text 打开摄像头; }); } private void tsb_video_Click(object sender, EventArgs e) { if(tsb_video.Text选择视频) { OpenFileDialog ofd new OpenFileDialog(); ofd.Filter 视频文件(*.*)|*.mp4;*.avi; if (ofd.ShowDialog() ! DialogResult.OK) return; videoStart true; VideoProcess(ofd.FileName); tsb_video.Text 停止; tssl_show.Text 视频正在检测中...; } else { videoStart false; } } private void tsb_camera_Click(object sender, EventArgs e) { if (tsb_camera.Text 打开摄像头) { videoStart true; CameraProcess(0); tsb_camera.Text 停止; tssl_show.Text 摄像头正在检测中...; } else { videoStart false; } } private void tsb_exit_Click(object sender, EventArgs e) { videoStart false; this.Close(); } private void trackBar1_Scroll(object sender, EventArgs e) { numericUpDown1.Value Convert.ToDecimal(trackBar1.Value / 100.0f); } private void trackBar2_Scroll(object sender, EventArgs e) { numericUpDown2.Value Convert.ToDecimal(trackBar2.Value / 100.0f); } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { trackBar1.Value (int)(Convert.ToSingle(numericUpDown1.Value) * 100); } private void numericUpDown2_ValueChanged(object sender, EventArgs e) { trackBar2.Value (int)(Convert.ToSingle(numericUpDown2.Value) * 100); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { tssl_show.Text加载模型:comboBox1.Text; detetor.LoadWeights(weightsPath\\comboBox1.Text); tssl_show.Text 模型加载已完成!; } } }【常用评估参数介绍】在目标检测任务中评估模型的性能是至关重要的。你提到的几个术语是评估模型性能的常用指标。下面是对这些术语的详细解释Class这通常指的是模型被设计用来检测的目标类别。例如一个模型可能被训练来检测车辆、行人或动物等不同类别的对象。Images表示验证集中的图片数量。验证集是用来评估模型性能的数据集与训练集分开以确保评估结果的公正性。Instances在所有图片中目标对象的总数。这包括了所有类别对象的总和例如如果验证集包含100张图片每张图片平均有5个目标对象则Instances为500。P精确度Precision精确度是模型预测为正样本的实例中真正为正样本的比例。计算公式为Precision TP / (TP FP)其中TP表示真正例True PositivesFP表示假正例False Positives。R召回率Recall召回率是所有真正的正样本中被模型正确预测为正样本的比例。计算公式为Recall TP / (TP FN)其中FN表示假负例False Negatives。mAP50表示在IoU交并比阈值为0.5时的平均精度mean Average Precision。IoU是衡量预测框和真实框重叠程度的指标。mAP是一个综合指标考虑了精确度和召回率用于评估模型在不同召回率水平上的性能。在IoU0.5时如果预测框与真实框的重叠程度达到或超过50%则认为该预测是正确的。mAP50-95表示在IoU从0.5到0.95间隔0.05的范围内模型的平均精度。这是一个更严格的评估标准要求预测框与真实框的重叠程度更高。在目标检测任务中更高的IoU阈值意味着模型需要更准确地定位目标对象。mAP50-95的计算考虑了从宽松到严格的多个IoU阈值因此能够更全面地评估模型的性能。这些指标共同构成了评估目标检测模型性能的重要框架。通过比较不同模型在这些指标上的表现可以判断哪个模型在实际应用中可能更有效。【使用步骤】使用步骤1首先根据官方框架ultralytics安装教程安装好yolov11环境并根据官方export命令将自己pt模型转成onnx模型,然后去github仓库futureflsl/firc-csharp-projects找到源码2使用vs2019打开sln项目选择x64 release并且修改一些必要的参数比如输入shape等点击运行即可查看最后效果特别注意如果运行报错了请参考我的博文进行重新引用我源码的DLL[C#]opencvsharp报错System.MemoryVersion4.0.1.2CultureneutralPublicKeyTokencc7b13fcd2ddd51“版本高于所引_未能加载文件或程序集“system.memory, version4.0.1.2, culture-CSDN博客【提供文件】C#源码yolo11n.onnx模型提供pytorch模型训练的map,P,R曲线图(在weights\results.png)测试图片在test_img文件夹下面特别注意这里不提供训练数据集