赞
踩
【官方框架地址】
https://github.com/ultralytics/ultralytics
【openvino介绍】
OpenVINO(Open Visual Inference & Neural Network Optimization)是由Intel推出的,用于加速深度学习模型推理的工具套件。它旨在提高计算机视觉和深度学习应用的性能,特别是在边缘计算和实时推理场景中。
OpenVINO的核心功能包括对多种深度学习框架的支持、高效的模型优化和推理引擎,以及跨多种硬件平台的可扩展性。它支持包括TensorFlow、Caffe、PyTorch等在内的主流深度学习框架,并能够将这些框架的模型转换为OpenVINO的中间表示格式(Intermediate Representation,IR),从而实现对模型的优化和加速。
优化过程包括对模型的剪枝、量化、压缩等操作,以减小模型大小、降低计算复杂度,并提高推理速度。推理引擎则负责将优化后的模型部署到实际的硬件平台上,如Intel的处理器、GPU、FPGA等,实现高效的推理计算。
此外,OpenVINO还提供了一系列的工具和库,如Inference Engine、Media SDK等,用于简化深度学习应用的开发和部署。这些工具和库提供了丰富的计算机视觉和深度学习算法库,以及对音频、视频、图像等多媒体数据的处理能力,使得开发者能够更加便捷地构建各种智能应用。
总的来说,OpenVINO是一个功能强大、易用性强的工具套件,它为开发者提供了从模型训练到推理的一站式解决方案,使得深度学习技术能够更好地应用于实际场景中,提高计算机视觉和人工智能应用的性能和效率。
【效果展示】
【实现部分代码】
- 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();
- Yolov8Manager detector = new Yolov8Manager();
- 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;
- }
-
- var result = detector.Inference(src);
- var resultMat = detector.DrawImage(result,src);
- pictureBox2.Image= OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultMat); //Mat转Bitmap
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
- detector.LoadWeights(Application.StartupPath+ "\\weights\\yolov8n.xml");
- }
-
- private void button3_Click(object sender, EventArgs e)
- {
- VideoCapture capture = new VideoCapture(0);
- if (!capture.IsOpened())
- {
- Console.WriteLine("video not open!");
- return;
- }
- Mat frame = new Mat();
- var sw = new Stopwatch();
- int fps = 0;
- while (true)
- {
-
- capture.Read(frame);
- if (frame.Empty())
- {
- Console.WriteLine("data is empty!");
- break;
- }
- sw.Start();
- var result = detector.Inference(src);
- var resultMat = detector.DrawImage(result, src);
- sw.Stop();
- fps = Convert.ToInt32(1 / sw.Elapsed.TotalSeconds);
- sw.Reset();
- Cv2.PutText(resultMat, "FPS=" + fps, new OpenCvSharp.Point(30, 30), HersheyFonts.HersheyComplex, 1.0, new Scalar(255, 0, 0), 3);
- //显示结果
- Cv2.ImShow("Result", resultMat);
- int key = Cv2.WaitKey(10);
- if (key == 27)
- break;
- }
-
- capture.Release();
- }
- }
- }

【视频演示】
https://www.bilibili.com/video/BV16e41117rM/?vd_source=989ae2b903ea1b5acebbe2c4c4a635ee
【测试环境】
vs2019,opencvsharp4.8.0,netframework4.7.2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。