当前位置: 首页 > article >正文

C# Onnx 动漫人物头部检测

 目录

效果

模型信息

项目

代码

下载

参考


效果

模型信息

Model Properties
-------------------------
date:2024-10-19T12:32:20.920471
description:Ultralytics best model trained on /root/datasets/yolo/anime_head_detection/data.yaml
author:Ultralytics
task:detect
license:AGPL-3.0 https://ultralytics.com/license
version:8.0.196
stride:32
batch:1
imgsz:[640, 640]
names:{0: 'head'}
---------------------------------------------------------------

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

Outputs
-------------------------
name:output0
tensor:Float[-1, -1, -1]
---------------------------------------------------------------
 

项目

代码

using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;
using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Onnx_Demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";
        string model_path;
        string classer_path;
        public string[] class_names;
        public int class_num;

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

        int input_height;
        int input_width;
        float ratio_height;
        float ratio_width;

        InferenceSession onnx_session;

        int box_num;
        float conf_threshold;
        float nms_threshold;

        /// <summary>
        /// 选择图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;

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

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

        /// <summary>
        /// 推理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            button2.Enabled = false;
            pictureBox2.Image = null;
            textBox1.Text = "";
            Application.DoEvents();

            Mat image = new Mat(image_path);

            //图片缩放
            int height = image.Rows;
            int width = image.Cols;
            Mat temp_image = image.Clone();
            if (height > input_height || width > input_width)
            {
                float scale = Math.Min((float)input_height / height, (float)input_width / width);
                OpenCvSharp.Size new_size = new OpenCvSharp.Size((int)(width * scale), (int)(height * scale));
                Cv2.Resize(image, temp_image, new_size);
            }
            ratio_height = (float)height / temp_image.Rows;
            ratio_width = (float)width / temp_image.Cols;
            Mat input_img = new Mat();
            Cv2.CopyMakeBorder(temp_image, input_img, 0, input_height - temp_image.Rows, 0, input_width - temp_image.Cols, BorderTypes.Constant, 0);

            //Cv2.ImShow("input_img", input_img);

            //输入Tensor
            Tensor<float> input_tensor = new DenseTensor<float>(new[] { 1, 3, 640, 640 });
            for (int y = 0; y < input_img.Height; y++)
            {
                for (int x = 0; x < input_img.Width; x++)
                {
                    input_tensor[0, 0, y, x] = input_img.At<Vec3b>(y, x)[0] / 255f;
                    input_tensor[0, 1, y, x] = input_img.At<Vec3b>(y, x)[1] / 255f;
                    input_tensor[0, 2, y, x] = input_img.At<Vec3b>(y, x)[2] / 255f;
                }
            }

            List<NamedOnnxValue> input_container = new List<NamedOnnxValue>
            {
                NamedOnnxValue.CreateFromTensor("images", input_tensor)
            };

            //推理
            dt1 = DateTime.Now;
            var ort_outputs = onnx_session.Run(input_container).ToArray();
            dt2 = DateTime.Now;

            float[] data = Transpose(ort_outputs[0].AsTensor<float>().ToArray(), 4 + class_num, box_num);

            float[] confidenceInfo = new float[class_num];
            float[] rectData = new float[4];

            List<DetectionResult> detResults = new List<DetectionResult>();

            for (int i = 0; i < box_num; i++)
            {
                Array.Copy(data, i * (class_num + 4), rectData, 0, 4);
                Array.Copy(data, i * (class_num + 4) + 4, confidenceInfo, 0, class_num);

                float score = confidenceInfo.Max(); // 获取最大值

                int maxIndex = Array.IndexOf(confidenceInfo, score); // 获取最大值的位置

                int _centerX = (int)(rectData[0] * ratio_width);
                int _centerY = (int)(rectData[1] * ratio_height);
                int _width = (int)(rectData[2] * ratio_width);
                int _height = (int)(rectData[3] * ratio_height);

                detResults.Add(new DetectionResult(
                   maxIndex,
                   class_names[maxIndex],
                   new Rect(_centerX - _width / 2, _centerY - _height / 2, _width, _height),
                   score));
            }

            //NMS
            CvDnn.NMSBoxes(detResults.Select(x => x.Rect), detResults.Select(x => x.Confidence), conf_threshold, nms_threshold, out int[] indices);
            detResults = detResults.Where((x, index) => indices.Contains(index)).ToList();

            //绘制结果
            Mat result_image = image.Clone();
            foreach (DetectionResult r in detResults)
            {
                Cv2.PutText(result_image, $"{r.Class}:{r.Confidence:P0}", new OpenCvSharp.Point(r.Rect.TopLeft.X, r.Rect.TopLeft.Y - 10), HersheyFonts.HersheySimplex, 1, Scalar.Red, 2);
                Cv2.Rectangle(result_image, r.Rect, Scalar.Red, thickness: 2);
            }

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

            button2.Enabled = true;
        }

        /// <summary>
        ///窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            model_path = "model/head_detect_v2.0_s.onnx";

            //创建输出会话,用于输出模型读取信息
            SessionOptions options = new SessionOptions();
            options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_INFO;
            options.AppendExecutionProvider_CPU(0);// 设置为CPU上运行

            // 创建推理模型类,读取模型文件
            onnx_session = new InferenceSession(model_path, options);//model_path 为onnx模型文件的路径

            input_height = 640;
            input_width = 640;

            box_num = 8400;
            conf_threshold = 0.25f;
            nms_threshold = 0.5f;

            classer_path = "model/lable.txt";
            class_names = File.ReadAllLines(classer_path, Encoding.UTF8);
            class_num = class_names.Length;

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

        }

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Image == null)
            {
                return;
            }
            Bitmap output = new Bitmap(pictureBox2.Image);
            SaveFileDialog sdf = new SaveFileDialog();
            sdf.Title = "保存";
            sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp";
            if (sdf.ShowDialog() == DialogResult.OK)
            {
                switch (sdf.FilterIndex)
                {
                    case 1:
                        {
                            output.Save(sdf.FileName, ImageFormat.Jpeg);
                            break;
                        }
                    case 2:
                        {
                            output.Save(sdf.FileName, ImageFormat.Png);
                            break;
                        }
                    case 3:
                        {
                            output.Save(sdf.FileName, ImageFormat.Bmp);
                            break;
                        }
                }
                MessageBox.Show("保存成功,位置:" + sdf.FileName);
            }
        }

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

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

        public void ShowNormalImg(Image img)
        {
            if (img == null) return;

            frmShow frm = new frmShow();

            frm.Width = Screen.PrimaryScreen.Bounds.Width;
            frm.Height = Screen.PrimaryScreen.Bounds.Height;

            if (frm.Width > img.Width)
            {
                frm.Width = img.Width;
            }

            if (frm.Height > img.Height)
            {
                frm.Height = img.Height;
            }

            bool b = frm.richTextBox1.ReadOnly;
            Clipboard.SetDataObject(img, true);
            frm.richTextBox1.ReadOnly = false;
            frm.richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Bitmap));
            frm.richTextBox1.ReadOnly = b;

            frm.ShowDialog();

        }

        public unsafe float[] Transpose(float[] tensorData, int rows, int cols)
        {
            float[] transposedTensorData = new float[tensorData.Length];

            fixed (float* pTensorData = tensorData)
            {
                fixed (float* pTransposedData = transposedTensorData)
                {
                    for (int i = 0; i < rows; i++)
                    {
                        for (int j = 0; j < cols; j++)
                        {
                            int index = i * cols + j;
                            int transposedIndex = j * rows + i;
                            pTransposedData[transposedIndex] = pTensorData[index];
                        }
                    }
                }
            }
            return transposedTensorData;
        }
    }

    public class DetectionResult
    {
        public DetectionResult(int ClassId, string Class, Rect Rect, float Confidence)
        {
            this.ClassId = ClassId;
            this.Confidence = Confidence;
            this.Rect = Rect;
            this.Class = Class;
        }

        public string Class { get; set; }

        public int ClassId { get; set; }

        public float Confidence { get; set; }

        public Rect Rect { get; set; }

    }

}
 

using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;
using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace Onnx_Demo
{public partial class Form1 : Form{public Form1(){InitializeComponent();}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";string model_path;string classer_path;public string[] class_names;public int class_num;DateTime dt1 = DateTime.Now;DateTime dt2 = DateTime.Now;int input_height;int input_width;float ratio_height;float ratio_width;InferenceSession onnx_session;int box_num;float conf_threshold;float nms_threshold;/// <summary>/// 选择图片/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button1_Click(object sender, EventArgs e){OpenFileDialog ofd = new OpenFileDialog();ofd.Filter = fileFilter;if (ofd.ShowDialog() != DialogResult.OK) return;pictureBox1.Image = null;image_path = ofd.FileName;pictureBox1.Image = new Bitmap(image_path);textBox1.Text = "";pictureBox2.Image = null;}/// <summary>/// 推理/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button2_Click(object sender, EventArgs e){if (image_path == ""){return;}button2.Enabled = false;pictureBox2.Image = null;textBox1.Text = "";Application.DoEvents();Mat image = new Mat(image_path);//图片缩放int height = image.Rows;int width = image.Cols;Mat temp_image = image.Clone();if (height > input_height || width > input_width){float scale = Math.Min((float)input_height / height, (float)input_width / width);OpenCvSharp.Size new_size = new OpenCvSharp.Size((int)(width * scale), (int)(height * scale));Cv2.Resize(image, temp_image, new_size);}ratio_height = (float)height / temp_image.Rows;ratio_width = (float)width / temp_image.Cols;Mat input_img = new Mat();Cv2.CopyMakeBorder(temp_image, input_img, 0, input_height - temp_image.Rows, 0, input_width - temp_image.Cols, BorderTypes.Constant, 0);//Cv2.ImShow("input_img", input_img);//输入TensorTensor<float> input_tensor = new DenseTensor<float>(new[] { 1, 3, 640, 640 });for (int y = 0; y < input_img.Height; y++){for (int x = 0; x < input_img.Width; x++){input_tensor[0, 0, y, x] = input_img.At<Vec3b>(y, x)[0] / 255f;input_tensor[0, 1, y, x] = input_img.At<Vec3b>(y, x)[1] / 255f;input_tensor[0, 2, y, x] = input_img.At<Vec3b>(y, x)[2] / 255f;}}List<NamedOnnxValue> input_container = new List<NamedOnnxValue>{NamedOnnxValue.CreateFromTensor("images", input_tensor)};//推理dt1 = DateTime.Now;var ort_outputs = onnx_session.Run(input_container).ToArray();dt2 = DateTime.Now;float[] data = Transpose(ort_outputs[0].AsTensor<float>().ToArray(), 4 + class_num, box_num);float[] confidenceInfo = new float[class_num];float[] rectData = new float[4];List<DetectionResult> detResults = new List<DetectionResult>();for (int i = 0; i < box_num; i++){Array.Copy(data, i * (class_num + 4), rectData, 0, 4);Array.Copy(data, i * (class_num + 4) + 4, confidenceInfo, 0, class_num);float score = confidenceInfo.Max(); // 获取最大值int maxIndex = Array.IndexOf(confidenceInfo, score); // 获取最大值的位置int _centerX = (int)(rectData[0] * ratio_width);int _centerY = (int)(rectData[1] * ratio_height);int _width = (int)(rectData[2] * ratio_width);int _height = (int)(rectData[3] * ratio_height);detResults.Add(new DetectionResult(maxIndex,class_names[maxIndex],new Rect(_centerX - _width / 2, _centerY - _height / 2, _width, _height),score));}//NMSCvDnn.NMSBoxes(detResults.Select(x => x.Rect), detResults.Select(x => x.Confidence), conf_threshold, nms_threshold, out int[] indices);detResults = detResults.Where((x, index) => indices.Contains(index)).ToList();//绘制结果Mat result_image = image.Clone();foreach (DetectionResult r in detResults){Cv2.PutText(result_image, $"{r.Class}:{r.Confidence:P0}", new OpenCvSharp.Point(r.Rect.TopLeft.X, r.Rect.TopLeft.Y - 10), HersheyFonts.HersheySimplex, 1, Scalar.Red, 2);Cv2.Rectangle(result_image, r.Rect, Scalar.Red, thickness: 2);}pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";button2.Enabled = true;}/// <summary>///窗体加载/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void Form1_Load(object sender, EventArgs e){model_path = "model/head_detect_v2.0_s.onnx";//创建输出会话,用于输出模型读取信息SessionOptions options = new SessionOptions();options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_INFO;options.AppendExecutionProvider_CPU(0);// 设置为CPU上运行// 创建推理模型类,读取模型文件onnx_session = new InferenceSession(model_path, options);//model_path 为onnx模型文件的路径input_height = 640;input_width = 640;box_num = 8400;conf_threshold = 0.25f;nms_threshold = 0.5f;classer_path = "model/lable.txt";class_names = File.ReadAllLines(classer_path, Encoding.UTF8);class_num = class_names.Length;image_path = "test_img/1.jpg";pictureBox1.Image = new Bitmap(image_path);}/// <summary>/// 保存/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button3_Click(object sender, EventArgs e){if (pictureBox2.Image == null){return;}Bitmap output = new Bitmap(pictureBox2.Image);SaveFileDialog sdf = new SaveFileDialog();sdf.Title = "保存";sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp";if (sdf.ShowDialog() == DialogResult.OK){switch (sdf.FilterIndex){case 1:{output.Save(sdf.FileName, ImageFormat.Jpeg);break;}case 2:{output.Save(sdf.FileName, ImageFormat.Png);break;}case 3:{output.Save(sdf.FileName, ImageFormat.Bmp);break;}}MessageBox.Show("保存成功,位置:" + sdf.FileName);}}private void pictureBox1_DoubleClick(object sender, EventArgs e){ShowNormalImg(pictureBox1.Image);}private void pictureBox2_DoubleClick(object sender, EventArgs e){ShowNormalImg(pictureBox2.Image);}public void ShowNormalImg(Image img){if (img == null) return;frmShow frm = new frmShow();frm.Width = Screen.PrimaryScreen.Bounds.Width;frm.Height = Screen.PrimaryScreen.Bounds.Height;if (frm.Width > img.Width){frm.Width = img.Width;}if (frm.Height > img.Height){frm.Height = img.Height;}bool b = frm.richTextBox1.ReadOnly;Clipboard.SetDataObject(img, true);frm.richTextBox1.ReadOnly = false;frm.richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Bitmap));frm.richTextBox1.ReadOnly = b;frm.ShowDialog();}public unsafe float[] Transpose(float[] tensorData, int rows, int cols){float[] transposedTensorData = new float[tensorData.Length];fixed (float* pTensorData = tensorData){fixed (float* pTransposedData = transposedTensorData){for (int i = 0; i < rows; i++){for (int j = 0; j < cols; j++){int index = i * cols + j;int transposedIndex = j * rows + i;pTransposedData[transposedIndex] = pTensorData[index];}}}}return transposedTensorData;}}public class DetectionResult{public DetectionResult(int ClassId, string Class, Rect Rect, float Confidence){this.ClassId = ClassId;this.Confidence = Confidence;this.Rect = Rect;this.Class = Class;}public string Class { get; set; }public int ClassId { get; set; }public float Confidence { get; set; }public Rect Rect { get; set; }}}

下载

源码下载

参考

https://github.com/deepghs

相关文章:

C# Onnx 动漫人物头部检测

目录 效果 模型信息 项目 代码 下载 参考 效果 模型信息 Model Properties ------------------------- date&#xff1a;2024-10-19T12:32:20.920471 description&#xff1a;Ultralytics best model trained on /root/datasets/yolo/anime_head_detection/data.yaml au…...

【Ragflow】24.Ragflow-plus开发日志:增加分词逻辑,修复关键词检索失效问题

概述 在RagflowPlus v0.3.0 版本推出之后&#xff0c;反馈比较多的问题是&#xff1a;检索时&#xff0c;召回块显著变少了。 如上图所示&#xff0c;进行检索测试时&#xff0c;关键词相似度得分为0&#xff0c;导致混合相似度(加权相加得到)也被大幅拉低&#xff0c;低于设定…...

gin 常见中间件配置

这里主要配置 请求日志中间件、跨域中间件、trace_id 中间件、安全头中间件 一般来说&#xff0c;这个中间件的信息 就是放在 middlewares/* 里面的*.go 进行操作 ➜ middlewares git:(main) tree . ├── cors.go ├── logging.go ├── request_id.go └── securit…...

蚂蚁森林自动收能量助手:Ant_Forest_1_5_4_3绿色行动新选择

先放软件下载链接:夸克网盘下载 便捷助力绿色生活&#xff1a;蚂蚁森林收能量脚本_Ant_Forest_1_5_4_3 在倡导绿色环保的当下&#xff0c;蚂蚁森林成为众多用户践行低碳生活的热门平台。而蚂蚁森林收能量脚本_Ant_Forest_1_5_4_3 这款软件&#xff0c;为用户在蚂蚁森林的体验…...

Zookeeper 集群部署与故障转移

Zookeeper 介绍 Zookeeper 是一个开源的分布式协调服务&#xff0c;由Apache基金会维护&#xff0c;专为分布式应用提供高可用、强一致性的核心基础能力。它通过简单的树形命名空间&#xff08;称为ZNode树&#xff09;存储数据节点&#xff08;ZNode&#xff09;&#xff0c;…...

Redis最佳实践——电商应用的性能监控与告警体系设计详解

Redis 在电商应用的性能监控与告警体系设计 一、原子级监控指标深度拆解 1. 内存维度监控 核心指标&#xff1a; # 实时内存组成分析&#xff08;单位字节&#xff09; used_memory: 物理内存总量 used_memory_dataset: 数据集占用量 used_memory_overhead: 管理开销内存 us…...

区域徘徊检测算法AI智能分析网关V4助力公共场所/工厂等多场景安全升级

一、项目背景 随着数字化安全管理需求激增&#xff0c;重点场所急需强化人员异常行为监测。区域徘徊作为潜在安全威胁的早期征兆&#xff0c;例如校园围墙外的陌生逗留者&#xff0c;都可能引发安全隐患。传统人工监控模式效率低、易疏漏&#xff0c;AI智能分析网关V4的区域徘…...

修复与升级suse linux

suse linux enterprise desktop 10提示&#xff1a;xxx service failed when loaded shared lib . error ibgobject.so.2.0:no such file or directory. suse linux enterprise server 12.iso 通过第一启动项引导&#xff0c;按照如下方式直接升级解决。...

电力高空作业安全检测(2)数据集构建

数据集构建的重要性 在电力高空作业安全检测领域&#xff0c;利用 计算机视觉技术 进行安全监测需要大量的图像数据&#xff0c;这些数据需要准确标注不同的安全设备与作业人员行为。只有构建出包含真实场景的高质量数据集&#xff0c;才能通过深度学习等算法对高空作业中的潜…...

嵌入式开发之STM32学习笔记day18

STM32F103C8T6 SPI通信读写W25Q64 1 W25Q64简介 W25Qxx系列是一种低成本、小型化且易于使用的非易失性存储器&#xff08;NOR Flash&#xff09;&#xff0c;它广泛应用于需要持久化存储数据的各种场景&#xff0c;如数据存储、字库存储以及固件程序存储等。该系列存储器采用…...

[论文阅读]PPT: Backdoor Attacks on Pre-trained Models via Poisoned Prompt Tuning

PPT: Backdoor Attacks on Pre-trained Models via Poisoned Prompt Tuning PPT: Backdoor Attacks on Pre-trained Models via Poisoned Prompt Tuning | IJCAI IJCAI-22 发表于2022年的论文&#xff0c;当时大家还都在做小模型NLP的相关工作&#xff08;BERT&#xff0c;Ro…...

一键 Ubuntu、Debian、Centos 换源(阿里源、腾讯源等)

网上各种办法都不行&#xff0c;使用这个工具可以了。 我用的是腾讯云源 配置系统源 bash <(curl -sSL https://linuxmirrors.cn/main.sh)配置 docker 源 bash <(curl -sSL https://linuxmirrors.cn/docker.sh)...

汽车安全:功能安全FuSa、预期功能安全SOTIF与网络安全Cybersecurity 解析

汽车安全的三重防线&#xff1a;深入解析FuSa、SOTIF与网络安全技术 现代汽车已成为装有数千个传感器的移动计算机&#xff0c;安全挑战比传统车辆复杂百倍。 随着汽车智能化、网联化飞速发展&#xff0c;汽车电子电气架构已从简单的分布式控制系统演变为复杂的移动计算平台。现…...

【C++高级主题】虚继承

目录 一、菱形继承&#xff1a;虚继承的 “导火索” 1.1 菱形继承的结构与问题 1.2 菱形继承的核心矛盾&#xff1a;多份基类实例 1.3 菱形继承的具体问题&#xff1a;二义性与数据冗余 二、虚继承的语法与核心目标 2.1 虚继承的声明方式 2.2 虚继承的核心目标 三、虚继…...

基于 ZYNQ 的实时运动目标检测系统设计

摘 要: 传统视频监控系统在实时运动目标检测时&#xff0c;存在目标检测不完整和目标检测错误的局限 性 。 本研究基于体积小 、 实时性高的需求&#xff0c;提出了一种将动态三帧差分法与 Sobel 边缘检测算法结 合的实时目标检测方法&#xff0c;并基于 ZYNQ 构建了视频…...

数据结构(JAVA版)练习题

&#xff08;题目难易程度与题号顺序无关哦&#xff09; 目录 1、多关键字排序 2、集合类的综合应用问题 3、数组排序 4、球的相关计算问题 5、利用类对象计算日期 6、日期计算问题 7、星期日期的计算 8、计算坐标平面上两点距离 9、异常处理设计问题 10、Java源文件…...

C#编程过程中变量用中文有啥影响?

一、C#语言对中文变量名的支持规则 技术可行性 C#编译器基于Unicode标准&#xff08;UTF-16编码&#xff09;&#xff0c;支持包括中文在内的非ASCII字符作为变量名。变量名规则允许字母、数字、下划线及Unicode字符&#xff08;如汉字&#xff09;&#xff0c;但不能以数字开头…...

哈希表入门:用 C 语言实现简单哈希表(开放寻址法解决冲突)

目录 一、引言 二、代码结构与核心概念解析 1. 数据结构定义 2. 初始化函数 initList 3. 哈希函数 hash 4. 插入函数 put&#xff08;核心逻辑&#xff09; 开放寻址法详解&#xff1a; 三、主函数验证与运行结果 1. 测试逻辑 2. 运行结果分析 四、完整代码 五、优…...

[华为eNSP] 在eNSP上实现IPv4地址以及IPv4静态路由的配置

设备名称配置 重命名设备以及关闭信息提示 此处以R1演示&#xff0c;R2R3以此类推 <Huawei>system-view [Huawei]sysname R1#关闭提示 undo info-center enable 配置路由接口IP地址 R1 [R1]interface GigabitEthernet 0/0/1[R1-GigabitEthernet0/0/1]ip address 10.0.…...

2024年第十五届蓝桥杯青少组c++国赛真题——快速分解质因数

2024年第十五届蓝桥杯青少组c国赛真题——快速分解质因数 题目可点下方去处&#xff0c;支持在线编程&#xff0c;在线测评&#xff5e; 快速分解质因数_C_少儿编程题库学习中心-嗨信奥 题库收集了历届各白名单赛事真题和权威机构考级真题&#xff0c;覆盖初赛—省赛—国赛&am…...

【动手学MCP从0到1】2.1 SDK介绍和第一个MCP创建的步骤详解

SDK介绍和第一个MCP 1. 安装SDK2. MCP通信协议3. 基于stdio通信3.1 服务段脚本代码3.2 客户端执行代码3.2.1 客户端的初始化设置3.2.2 创建执行进行的函数3.2.3 代码优化 4. 基于SSE协议通信 1. 安装SDK 开发mcp项目&#xff0c;既可以使用Anthropic官方提供的SDK&#xff0c;…...

基于MyBatis插件实现动态表名解决多环境单一数据库问题

业务场景 在为某新能源汽车厂商进行我司系统私有化部署时&#xff0c;在预演环境和生产环境中&#xff0c;客户仅提供了一个 MySQL 数据库实例。为了确保数据隔离并避免不同环境之间的数据冲突&#xff0c;常规做法是为每个环境创建独立的表&#xff08;如通过添加环境前缀或后…...

测试面试题总结一

目录 列表、元组、字典的区别 nvicat连接出现问题如何排查 mysql性能调优 python连接mysql数据库方法 参数化 pytest.mark.parametrize 装饰器 list1 [1,7,4,5,5,6] for i in range(len(list1): assert list1[i] < list1[i1] 这段程序有问题嘛&#xff1f; pytest.i…...

Spring Boot应用多环境打包与Shell自动化部署实践

一、多环境配置管理&#xff08;Profile方案&#xff09; 推荐方案&#xff1a;通过Maven Profiles实现环境隔离 在pom.xml中定义不同环境配置&#xff0c;避免硬编码在application.yml中&#xff1a; <profiles><!-- 默认环境 --><profile><id>node…...

【深度学习】14. DL在CV中的应用章:目标检测: R-CNN, Fast R-CNN, Faster R-CNN, MASK R-CNN

深度学习在计算机视觉中的应用介绍 深度卷积神经网络&#xff08;Deep convolutional neural network&#xff0c; DCNN&#xff09;是将深度学习引入计算机视觉发展的关键概念。通过模仿生物神经系统&#xff0c;深度神经网络可以提供前所未有的能力来解释复杂的数据模式&…...

grpc的二进制序列化与http的文本协议对比

grpc的二进制序列化与http的文本协议对比 1. 二进制格式 vs 文本格式2. 编码机制&#xff1a;Varint 与固定长度3. 没有字段名与标点4. 较少的元信息开销4.1 HTTP/1.1 请求的元信息组成与开销4.1.1 各部分字节数示例 4.2 HTTP/2 帧结构与 HPACK 头部压缩4.2.1 HEADERS 开销对比…...

Linux 环境下 PPP 拨号的嵌入式开发实现

一、PPP 协议基础与嵌入式应用场景 PPP (Point-to-Point Protocol) 是一种在串行线路上传输多协议数据包的通信协议&#xff0c;广泛应用于拨号上网、VPN 和嵌入式系统的远程通信场景。在嵌入式开发中&#xff0c;PPP 常用于 GPRS/3G/4G 模块、工业路由器和物联网设备的网络连接…...

UE 材质基础第三天

飘动的旗帜 错乱的贴图排序&#xff0c;创建一个材质函数 可以用在地面材质 体积云材质制作 通过网盘分享的文件&#xff1a;虚幻引擎材质宝典.rar 链接: https://pan.baidu.com/s/1AYRz2V5zQFaitNPA5_JbJw 提取码: cz1q --来自百度网盘超级会员v6的分享...

【Github/Gitee Webhook触发自动部署-Jenkins】

Github/Gitee Webhook触发自动部署-Jenkins #mermaid-svg-hRyAcESlyk5R2rDn {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-hRyAcESlyk5R2rDn .error-icon{fill:#552222;}#mermaid-svg-hRyAcESlyk5R2rDn .error-tex…...

软件工程专业本科毕业论文模板

以下是软件工程专业本科毕业论文的通用模板框架&#xff0c;结合学术规范与工程实践要求&#xff0c;涵盖从需求分析到测试验证的全流程结构&#xff0c;并附格式说明与写作建议&#xff1a; 一、前置部分 1. 封面 - 包含论文标题&#xff08;简明反映研究核心&#xff0c;如“…...