C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测

本文主要是介绍C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

效果

模型信息

项目

代码

下载


C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测

效果

模型信息

Inputs
-------------------------
name:images
tensor:Float[1, 3, 1024, 1024]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[1, 64512, 11]
---------------------------------------------------------------

项目

代码

using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Windows.Forms;

namespace OpenCvSharp_DNN_Demo
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";

        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;

        float confThreshold;
        float nmsThreshold;
        float objThreshold;

        float[,] anchors = new float[3, 6] {
                                           {31, 30, 28, 49, 50, 31},
                                           {46, 45, 58, 58, 74, 74},
                                           {94, 94, 115, 115, 151, 151}
                                           };

        float[] stride = new float[3] { 8.0f, 16.0f, 32.0f };

        string modelpath;

        int inpHeight;
        int inpWidth;

        List<string> class_names;
        int num_class;

        Net opencv_net;
        Mat BN_image;

        Mat image;
        Mat result_image;

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;
            pictureBox2.Image = null;
            textBox1.Text = "";

            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            confThreshold = 0.5f;
            nmsThreshold = 0.5f;
            objThreshold = 0.5f;

            modelpath = "model/best.onnx";

            inpHeight = 1024;
            inpWidth = 1024;

            opencv_net = CvDnn.ReadNetFromOnnx(modelpath);

            class_names = new List<string>();
            StreamReader sr = new StreamReader("model/coco.names");
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                class_names.Add(line);
            }
            num_class = class_names.Count();

            image_path = "test_img/1.png";
            pictureBox1.Image = new Bitmap(image_path);

        }

        float sigmoid(float x)
        {
            return (float)(1.0 / (1 + Math.Exp(-x)));
        }

        Mat ResizeImage(Mat srcimg, out int newh, out int neww, out int top, out int left)
        {
            int srch = srcimg.Rows, srcw = srcimg.Cols;
            top = 0;
            left = 0;
            newh = inpHeight;
            neww = inpWidth;
            Mat dstimg = new Mat();
            if (srch != srcw)
            {
                float hw_scale = (float)srch / srcw;
                if (hw_scale > 1)
                {
                    newh = inpHeight;
                    neww = (int)(inpWidth / hw_scale);
                    Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);
                    left = (int)((inpWidth - neww) * 0.5);
                    Cv2.CopyMakeBorder(dstimg, dstimg, 0, 0, left, inpWidth - neww - left, BorderTypes.Constant);
                }
                else
                {
                    newh = (int)(inpHeight * hw_scale);
                    neww = inpWidth;
                    Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);
                    top = (int)((inpHeight - newh) * 0.5);
                    Cv2.CopyMakeBorder(dstimg, dstimg, top, inpHeight - newh - top, 0, 0, BorderTypes.Constant);
                }
            }
            else
            {
                Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh));
            }
            return dstimg;
        }

        float IoU(BoxInfo polya, BoxInfo polyb, int max_w, int max_h)
        {
            List<List<OpenCvSharp.Point>> poly_array0 = new List<List<OpenCvSharp.Point>>();
            List<List<OpenCvSharp.Point>> poly_array1 = new List<List<OpenCvSharp.Point>>();
            poly_array0.Add(polya.pts);
            poly_array1.Add(polyb.pts);

            Mat _poly0 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);
            Mat _poly1 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);
            Mat _result = new Mat();

            List<List<OpenCvSharp.Point>> _pts0 = new List<List<OpenCvSharp.Point>>();
            List<int> _npts0 = new List<int>();

            foreach (var item in poly_array0)
            {
                if (item.Count < 3)//invalid poly
                    return -1f;

                _pts0.Add(item);
                _npts0.Add(item.Count);

            }

            List<List<OpenCvSharp.Point>> _pts1 = new List<List<OpenCvSharp.Point>>();
            List<int> _npts1 = new List<int>();

            foreach (var item in poly_array1)
            {
                if (item.Count < 3)//invalid poly
                    return -1f;

                _pts1.Add(item);
                _npts1.Add(item.Count);

            }

            Cv2.FillPoly(_poly0, _pts0, new Scalar(1));
            Cv2.FillPoly(_poly1, _pts1, new Scalar(1));

            Cv2.BitwiseAnd(_poly0, _poly1, _result);

            int _area0 = Cv2.CountNonZero(_poly0);
            int _area1 = Cv2.CountNonZero(_poly1);
            int _intersection_area = Cv2.CountNonZero(_result);
            float _iou = (float)_intersection_area / (float)(_area0 + _area1 - _intersection_area);
            return _iou;
        }

        void nms(List<BoxInfo> input_boxes, int max_w, int max_h)
        {
            input_boxes.Sort((a, b) => { return a.score > b.score ? -1 : 1; });

            bool[] isSuppressed = new bool[input_boxes.Count];

            for (int i = 0; i < input_boxes.Count(); ++i)
            {
                if (isSuppressed[i]) { continue; }
                for (int j = i + 1; j < input_boxes.Count(); ++j)
                {
                    if (isSuppressed[j]) { continue; }
                    float ovr = IoU(input_boxes[i], input_boxes[j], max_w, max_h);
                    if (ovr >= nmsThreshold)
                    {
                        isSuppressed[j] = true;
                    }
                }
            }

            for (int i = isSuppressed.Length - 1; i >= 0; i--)
            {
                if (isSuppressed[i])
                {
                    input_boxes.RemoveAt(i);
                }
            }

        }

        private unsafe void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }
            textBox1.Text = "检测中,请稍等……";
            pictureBox2.Image = null;
            Application.DoEvents();

            image = new Mat(image_path);

            int newh = 0, neww = 0, padh = 0, padw = 0;
            Mat dstimg = ResizeImage(image, out newh, out neww, out padh, out padw);

            BN_image = CvDnn.BlobFromImage(dstimg, 1 / 255.0, new OpenCvSharp.Size(inpWidth, inpHeight), new Scalar(0, 0, 0), true, false);

            //配置图片输入数据
            opencv_net.SetInput(BN_image);

            //模型推理,读取推理结果
            Mat[] outs = new Mat[3] { new Mat(), new Mat(), new Mat() };
            string[] outBlobNames = opencv_net.GetUnconnectedOutLayersNames().ToArray();

            dt1 = DateTime.Now;

            opencv_net.Forward(outs, outBlobNames);

            dt2 = DateTime.Now;

            int num_proposal = outs[0].Size(1);
            int nout = outs[0].Size(2);

            if (outs[0].Dims > 2)
            {
                outs[0] = outs[0].Reshape(0, num_proposal);
            }

            float ratioh = 1.0f * image.Rows / newh, ratiow = 1.0f * image.Cols / neww;

            float* pdata = (float*)outs[0].Data;

            List<BoxInfo> generate_boxes = new List<BoxInfo>();

            int row_ind = 0;

            for (int n = 0; n < 3; n++)
            {

                int num_grid_x = (int)(inpWidth / stride[n]);
                int num_grid_y = (int)(inpHeight / stride[n]);

                for (int q = 0; q < 3; q++)    //anchor
                {
                    float anchor_w = anchors[n, q * 2];
                    float anchor_h = anchors[n, q * 2 + 1];
                    for (int i = 0; i < num_grid_y; i++)
                    {
                        for (int j = 0; j < num_grid_x; j++)
                        {
                            float box_score = sigmoid(pdata[8]);
                            if (box_score > objThreshold)
                            {

                                Mat scores = outs[0].Row(row_ind).ColRange(9, 9 + num_class);
                                double minVal, max_class_socre;
                                OpenCvSharp.Point minLoc, classIdPoint;
                                // Get the value and location of the maximum score
                                Cv2.MinMaxLoc(scores, out minVal, out max_class_socre, out minLoc, out classIdPoint);

                                int class_idx = classIdPoint.X;
                                max_class_socre = sigmoid((float)max_class_socre) * box_score;
                                if (max_class_socre > confThreshold)
                                {
                                    List<OpenCvSharp.Point> pts = new List<OpenCvSharp.Point>();
                                    for (int k = 0; k < 8; k += 2)
                                    {
                                        float x = (pdata[k] + j) * stride[n];  //x
                                        float y = (pdata[k + 1] + i) * stride[n];   //y
                                        x = (x - padw) * ratiow;
                                        y = (y - padh) * ratioh;
                                        pts.Add(new OpenCvSharp.Point(x, y));
                                    }

                                    Rect r = Cv2.BoundingRect(pts);

                                    generate_boxes.Add(new BoxInfo(pts, (float)max_class_socre, class_idx));
                                }
                            }
                            row_ind++;
                            pdata += nout;
                        }
                    }

                }

            }

            nms(generate_boxes, image.Cols, image.Rows);

            result_image = image.Clone();

            for (int ii = 0; ii < generate_boxes.Count; ++ii)
            {
                int idx = generate_boxes[ii].label;

                for (int jj = 0; jj < 4; jj++)
                {
                    Cv2.Line(result_image, generate_boxes[ii].pts[jj], generate_boxes[ii].pts[(jj + 1) % 4], new Scalar(0, 0, 255), 2);
                }

                string label = class_names[idx] + ":" + generate_boxes[ii].score.ToString("0.00");

                int xmin = (int)generate_boxes[ii].pts[0].X;
                int ymin = (int)generate_boxes[ii].pts[0].Y - 10;

                Cv2.PutText(result_image, label, new OpenCvSharp.Point(xmin, ymin - 5), HersheyFonts.HersheySimplex, 0.75, new Scalar(0, 0, 255), 1);
            }

            pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());
            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
        }

        private void pictureBox2_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox2.Image);
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox1.Image);
        }
    }
}

using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Windows.Forms;namespace OpenCvSharp_DNN_Demo
{public partial class frmMain : Form{public frmMain(){InitializeComponent();}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";DateTime dt1 = DateTime.Now;DateTime dt2 = DateTime.Now;float confThreshold;float nmsThreshold;float objThreshold;float[,] anchors = new float[3, 6] {{31, 30, 28, 49, 50, 31},{46, 45, 58, 58, 74, 74},{94, 94, 115, 115, 151, 151}};float[] stride = new float[3] { 8.0f, 16.0f, 32.0f };string modelpath;int inpHeight;int inpWidth;List<string> class_names;int num_class;Net opencv_net;Mat BN_image;Mat image;Mat result_image;private void button1_Click(object sender, EventArgs e){OpenFileDialog ofd = new OpenFileDialog();ofd.Filter = fileFilter;if (ofd.ShowDialog() != DialogResult.OK) return;pictureBox1.Image = null;pictureBox2.Image = null;textBox1.Text = "";image_path = ofd.FileName;pictureBox1.Image = new Bitmap(image_path);image = new Mat(image_path);}private void Form1_Load(object sender, EventArgs e){confThreshold = 0.5f;nmsThreshold = 0.5f;objThreshold = 0.5f;modelpath = "model/best.onnx";inpHeight = 1024;inpWidth = 1024;opencv_net = CvDnn.ReadNetFromOnnx(modelpath);class_names = new List<string>();StreamReader sr = new StreamReader("model/coco.names");string line;while ((line = sr.ReadLine()) != null){class_names.Add(line);}num_class = class_names.Count();image_path = "test_img/1.png";pictureBox1.Image = new Bitmap(image_path);}float sigmoid(float x){return (float)(1.0 / (1 + Math.Exp(-x)));}Mat ResizeImage(Mat srcimg, out int newh, out int neww, out int top, out int left){int srch = srcimg.Rows, srcw = srcimg.Cols;top = 0;left = 0;newh = inpHeight;neww = inpWidth;Mat dstimg = new Mat();if (srch != srcw){float hw_scale = (float)srch / srcw;if (hw_scale > 1){newh = inpHeight;neww = (int)(inpWidth / hw_scale);Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);left = (int)((inpWidth - neww) * 0.5);Cv2.CopyMakeBorder(dstimg, dstimg, 0, 0, left, inpWidth - neww - left, BorderTypes.Constant);}else{newh = (int)(inpHeight * hw_scale);neww = inpWidth;Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);top = (int)((inpHeight - newh) * 0.5);Cv2.CopyMakeBorder(dstimg, dstimg, top, inpHeight - newh - top, 0, 0, BorderTypes.Constant);}}else{Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh));}return dstimg;}float IoU(BoxInfo polya, BoxInfo polyb, int max_w, int max_h){List<List<OpenCvSharp.Point>> poly_array0 = new List<List<OpenCvSharp.Point>>();List<List<OpenCvSharp.Point>> poly_array1 = new List<List<OpenCvSharp.Point>>();poly_array0.Add(polya.pts);poly_array1.Add(polyb.pts);Mat _poly0 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);Mat _poly1 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);Mat _result = new Mat();List<List<OpenCvSharp.Point>> _pts0 = new List<List<OpenCvSharp.Point>>();List<int> _npts0 = new List<int>();foreach (var item in poly_array0){if (item.Count < 3)//invalid polyreturn -1f;_pts0.Add(item);_npts0.Add(item.Count);}List<List<OpenCvSharp.Point>> _pts1 = new List<List<OpenCvSharp.Point>>();List<int> _npts1 = new List<int>();foreach (var item in poly_array1){if (item.Count < 3)//invalid polyreturn -1f;_pts1.Add(item);_npts1.Add(item.Count);}Cv2.FillPoly(_poly0, _pts0, new Scalar(1));Cv2.FillPoly(_poly1, _pts1, new Scalar(1));Cv2.BitwiseAnd(_poly0, _poly1, _result);int _area0 = Cv2.CountNonZero(_poly0);int _area1 = Cv2.CountNonZero(_poly1);int _intersection_area = Cv2.CountNonZero(_result);float _iou = (float)_intersection_area / (float)(_area0 + _area1 - _intersection_area);return _iou;}void nms(List<BoxInfo> input_boxes, int max_w, int max_h){input_boxes.Sort((a, b) => { return a.score > b.score ? -1 : 1; });bool[] isSuppressed = new bool[input_boxes.Count];for (int i = 0; i < input_boxes.Count(); ++i){if (isSuppressed[i]) { continue; }for (int j = i + 1; j < input_boxes.Count(); ++j){if (isSuppressed[j]) { continue; }float ovr = IoU(input_boxes[i], input_boxes[j], max_w, max_h);if (ovr >= nmsThreshold){isSuppressed[j] = true;}}}for (int i = isSuppressed.Length - 1; i >= 0; i--){if (isSuppressed[i]){input_boxes.RemoveAt(i);}}}private unsafe void button2_Click(object sender, EventArgs e){if (image_path == ""){return;}textBox1.Text = "检测中,请稍等……";pictureBox2.Image = null;Application.DoEvents();image = new Mat(image_path);int newh = 0, neww = 0, padh = 0, padw = 0;Mat dstimg = ResizeImage(image, out newh, out neww, out padh, out padw);BN_image = CvDnn.BlobFromImage(dstimg, 1 / 255.0, new OpenCvSharp.Size(inpWidth, inpHeight), new Scalar(0, 0, 0), true, false);//配置图片输入数据opencv_net.SetInput(BN_image);//模型推理,读取推理结果Mat[] outs = new Mat[3] { new Mat(), new Mat(), new Mat() };string[] outBlobNames = opencv_net.GetUnconnectedOutLayersNames().ToArray();dt1 = DateTime.Now;opencv_net.Forward(outs, outBlobNames);dt2 = DateTime.Now;int num_proposal = outs[0].Size(1);int nout = outs[0].Size(2);if (outs[0].Dims > 2){outs[0] = outs[0].Reshape(0, num_proposal);}float ratioh = 1.0f * image.Rows / newh, ratiow = 1.0f * image.Cols / neww;float* pdata = (float*)outs[0].Data;List<BoxInfo> generate_boxes = new List<BoxInfo>();int row_ind = 0;for (int n = 0; n < 3; n++){int num_grid_x = (int)(inpWidth / stride[n]);int num_grid_y = (int)(inpHeight / stride[n]);for (int q = 0; q < 3; q++)    //anchor{float anchor_w = anchors[n, q * 2];float anchor_h = anchors[n, q * 2 + 1];for (int i = 0; i < num_grid_y; i++){for (int j = 0; j < num_grid_x; j++){float box_score = sigmoid(pdata[8]);if (box_score > objThreshold){Mat scores = outs[0].Row(row_ind).ColRange(9, 9 + num_class);double minVal, max_class_socre;OpenCvSharp.Point minLoc, classIdPoint;// Get the value and location of the maximum scoreCv2.MinMaxLoc(scores, out minVal, out max_class_socre, out minLoc, out classIdPoint);int class_idx = classIdPoint.X;max_class_socre = sigmoid((float)max_class_socre) * box_score;if (max_class_socre > confThreshold){List<OpenCvSharp.Point> pts = new List<OpenCvSharp.Point>();for (int k = 0; k < 8; k += 2){float x = (pdata[k] + j) * stride[n];  //xfloat y = (pdata[k + 1] + i) * stride[n];   //yx = (x - padw) * ratiow;y = (y - padh) * ratioh;pts.Add(new OpenCvSharp.Point(x, y));}Rect r = Cv2.BoundingRect(pts);generate_boxes.Add(new BoxInfo(pts, (float)max_class_socre, class_idx));}}row_ind++;pdata += nout;}}}}nms(generate_boxes, image.Cols, image.Rows);result_image = image.Clone();for (int ii = 0; ii < generate_boxes.Count; ++ii){int idx = generate_boxes[ii].label;for (int jj = 0; jj < 4; jj++){Cv2.Line(result_image, generate_boxes[ii].pts[jj], generate_boxes[ii].pts[(jj + 1) % 4], new Scalar(0, 0, 255), 2);}string label = class_names[idx] + ":" + generate_boxes[ii].score.ToString("0.00");int xmin = (int)generate_boxes[ii].pts[0].X;int ymin = (int)generate_boxes[ii].pts[0].Y - 10;Cv2.PutText(result_image, label, new OpenCvSharp.Point(xmin, ymin - 5), HersheyFonts.HersheySimplex, 0.75, new Scalar(0, 0, 255), 1);}pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";}private void pictureBox2_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox2.Image);}private void pictureBox1_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox1.Image);}}
}

下载

源码下载

这篇关于C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/488871

相关文章

OpenCV实现实时颜色检测的示例

《OpenCV实现实时颜色检测的示例》本文主要介绍了OpenCV实现实时颜色检测的示例,通过HSV色彩空间转换和色调范围判断实现红黄绿蓝颜色检测,包含视频捕捉、区域标记、颜色分析等功能,具有一定的参考... 目录一、引言二、系统概述三、代码解析1. 导入库2. 颜色识别函数3. 主程序循环四、HSV色彩空间

C#如何去掉文件夹或文件名非法字符

《C#如何去掉文件夹或文件名非法字符》:本文主要介绍C#如何去掉文件夹或文件名非法字符的问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录C#去掉文件夹或文件名非法字符net类库提供了非法字符的数组这里还有个小窍门总结C#去掉文件夹或文件名非法字符实现有输入字

C#之List集合去重复对象的实现方法

《C#之List集合去重复对象的实现方法》:本文主要介绍C#之List集合去重复对象的实现方法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录C# List集合去重复对象方法1、测试数据2、测试数据3、知识点补充总结C# List集合去重复对象方法1、测试数据

C#实现将Office文档(Word/Excel/PDF/PPT)转为Markdown格式

《C#实现将Office文档(Word/Excel/PDF/PPT)转为Markdown格式》Markdown凭借简洁的语法、优良的可读性,以及对版本控制系统的高度兼容性,逐渐成为最受欢迎的文档格式... 目录为什么要将文档转换为 Markdown 格式使用工具将 Word 文档转换为 Markdown(.

Java调用C#动态库的三种方法详解

《Java调用C#动态库的三种方法详解》在这个多语言编程的时代,Java和C#就像两位才华横溢的舞者,各自在不同的舞台上展现着独特的魅力,然而,当它们携手合作时,又会碰撞出怎样绚丽的火花呢?今天,我们... 目录方法1:C++/CLI搭建桥梁——Java ↔ C# 的“翻译官”步骤1:创建C#类库(.NET

C#代码实现解析WTGPS和BD数据

《C#代码实现解析WTGPS和BD数据》在现代的导航与定位应用中,准确解析GPS和北斗(BD)等卫星定位数据至关重要,本文将使用C#语言实现解析WTGPS和BD数据,需要的可以了解下... 目录一、代码结构概览1. 核心解析方法2. 位置信息解析3. 经纬度转换方法4. 日期和时间戳解析5. 辅助方法二、L

使用C#删除Excel表格中的重复行数据的代码详解

《使用C#删除Excel表格中的重复行数据的代码详解》重复行是指在Excel表格中完全相同的多行数据,删除这些重复行至关重要,因为它们不仅会干扰数据分析,还可能导致错误的决策和结论,所以本文给大家介绍... 目录简介使用工具C# 删除Excel工作表中的重复行语法工作原理实现代码C# 删除指定Excel单元

C#使用MQTTnet实现服务端与客户端的通讯的示例

《C#使用MQTTnet实现服务端与客户端的通讯的示例》本文主要介绍了C#使用MQTTnet实现服务端与客户端的通讯的示例,包括协议特性、连接管理、QoS机制和安全策略,具有一定的参考价值,感兴趣的可... 目录一、MQTT 协议简介二、MQTT 协议核心特性三、MQTTNET 库的核心功能四、服务端(BR

Web技术与Nginx网站环境部署教程

《Web技术与Nginx网站环境部署教程》:本文主要介绍Web技术与Nginx网站环境部署教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Web基础1.域名系统DNS2.Hosts文件3.DNS4.域名注册二.网页与html1.网页概述2.HTML概述3.

C#继承之里氏替换原则分析

《C#继承之里氏替换原则分析》:本文主要介绍C#继承之里氏替换原则,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录C#里氏替换原则一.概念二.语法表现三.类型检查与转换总结C#里氏替换原则一.概念里氏替换原则是面向对象设计的基本原则之一:核心思想:所有引py