C# Onnx 动漫人物人脸检测

article/2025/6/8 20:06:19

目录

效果

模型信息

项目

代码

下载

参考


效果

模型信息

Model Properties
-------------------------
stride:32
names:{0: 'face'}
---------------------------------------------------------------

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/face_detect_v1.4_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/face_detect_v1.4_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


http://www.hkcw.cn/article/ivPlnrDcKB.shtml

相关文章

使用cmd命令行创建数据库和表-简单步骤记录

前提&#xff1a; 已安装MySQL 步骤&#xff1a; 1.WinR&#xff0c;回车&#xff0c;输入cmd&#xff0c;回车 2.输入 mysql -u root -p 后&#xff0c;输入自己的密码&#xff0c;看到welcome等字样就是成功登录了MySQL 3.创建数据库 create database success; &#xff0…

Centos7使用rpm升级glibc2.28

Centos7使用rpm升级glibc2.28 检查glibc版本下载glibc2.28的rpm包使用rpm包升级到glibc-2.28结果验证 检查glibc版本 ldd --version下载glibc2.28的rpm包 参考&#xff1a; https://www.cnblogs.com/caya-yuan/p/10561439.html 下载 glibc、make 的 feroda29(fc29)系统 rpm包…

堆叠弹窗 VS 队列弹窗之争

前言 如果一个页面上有多个弹窗&#xff0c;设计上是把前一个弹窗暂时隐藏还是盖住前一个弹窗多一点&#xff1f; 在多弹窗设计的情境下&#xff0c;最佳实践通常倾向于以下两种处理方式&#xff1a; 1、堆叠弹窗 新弹窗覆盖旧弹窗&#xff0c;但每个弹窗保持完整显示&#…

刷leetcode hot100返航必胜版--链表6/3

链表初始知识 链表种类&#xff1a;单链表&#xff0c;双链表&#xff0c;循环链表 链表初始化 struct ListNode{ int val; ListNode* next; ListNode(int x): val&#xff08;x&#xff09;,next(nullptr) {} }; //初始化 ListNode* head new ListNode(5); 删除节点、添加…

[概率论基本概念4]什么是无偏估计

关键词&#xff1a;Unbiased Estimation 一、说明 对于无偏和有偏估计&#xff0c;需要了解其叙事背景&#xff0c;是指整体和抽样的关系&#xff0c;也就是说整体的叙事是从理论角度的&#xff0c;而估计器原理是从实践角度说事&#xff1b;为了表明概率理论&#xff08;不可…

React-native之Flexbox

本文总结: 我们学到了 React Native 的 Flexbox 布局&#xff0c;它让写样式变得更方便啦&#xff01;&#x1f60a; Flexbox 就像一个有弹性的盒子&#xff0c;有主轴和交叉轴&#xff08;行或列&#xff09;。 在 RN 里写样式要用 StyleSheet.create 对象&#xff0c;属性名…

学习日记-day21-6.3

完成目标&#xff1a; 目录 知识点&#xff1a; 1.集合_哈希表存储过程说明 2.集合_哈希表源码查看 3.集合_哈希表无索引&哈希表有序无序详解 4.集合_TreeSet和TreeMap 5.集合_Hashtable和Vector&Vector源码分析 6.集合_Properties属性集 7.集合_集合嵌套 8.…

ABP-Book Store Application中文讲解 - Part 6: Authors: Domain Layer

ABP-Book Store Application中文讲解 - Part 6: Authors: Domain Layer 1. 汇总 ABP-Book Store Application中文讲解-汇总-CSDN博客 2. 前一章 ABP-Book Store Application中文讲解 - Part 5: Authorization-CSDN博客 项目之间的引用关系。 ​ BookAppService利用的是Cu…

智慧高铁站:数字时代交通枢纽的标杆

智慧高铁站作为现代综合交通体系的核心节点&#xff0c;通过数字技术与基础设施的深度融合&#xff0c;正在重塑旅客出行体验与车站运营模式。这一转型不仅体现在技术应用层面&#xff0c;更代表着交通服务理念的根本性变革&#xff0c;为现代交通枢纽建设树立了全新标杆。 一、…

ARM架构推理Stable Diffusiond

代码仓库&#xff1a; https://github.com/siutin/stable-diffusion-webui-docker.git Docker容器地址&#xff1a; https://hub.docker.com/r/siutin/stable-diffusion-webui-docker/tags git clone https://github.com/siutin/stable-diffusion-webui-docker.git cd stabl…

关于 KWDB 数据存储的几件事儿

邻近粽子节&#xff0c;KWDB 的朋友给我发消息&#xff0c;问我吃过红茶味的粽子没&#xff0c;作为北方人的我一般只吃蜜枣白粽&#xff0c;还没见过茶香粽子&#xff0c;顶多泡碗祁红&#xff0c;就着茶水吃粽子。 她又问道&#xff0c;两个月时间到了&#xff0c;你准备好了…

酵母杂交那些事儿(一)

酵母单杂、酵母双杂、酵母三杂&#xff0c;仅仅一个字的区别&#xff0c;你对它们了解吗&#xff1f;这些经常用到的实验&#xff0c;它们的原理你确定都搞清楚了吗&#xff1f;如果没有&#xff0c;那么今天你就来对地方了&#xff0c;因为伯远生物&#xff08;https://plant.…

sqlite3 命令行工具详细介绍

一、启动与退出 启动数据库连接 sqlite3 [database_file] # 打开/创建数据库文件&#xff08;如 test.db&#xff09; sqlite3 # 启动临时内存数据库 (:memory:) sqlite3 :memory: # 显式启动内存数据库文件不存在时自动创建不指定文件名则使用临时内…

项目开发:【悟空博客】基于SSM框架的博客平台

目录 一.导入 1.Spirng框架 2.SpirngMVC 二.项目介绍 &#xff08;一&#xff09;项目功能 &#xff08;二&#xff09;页面展示 1.注册页面 2.登录页面 3.列表页面 4.详情页面 5.编辑页面 三.准备工作 1.用户表——userinfo 2.文章表——articleinfo 3.插入数…

大话软工笔记—分离之组织和物品

一. 组织 组织在架构中既不属于“业务架构”&#xff0c;也不属于“管理架构”&#xff0c;它是由组织结构、角色、权限等要素构成。 1. 组织的概念 组织&#xff08;名词&#xff09;&#xff0c;将资源按照某个目标构建出一个有层次的集合体&#xff0c;即组织结构。 组织…

伊吖学C笔记(5、数组、表达式、考题设计)

一、数组 数组是由同一种类数据构成的集合。就好比一个班所有同学的身高&#xff0c;一个月的日平均气温&#xff0c;抽样调查的一百个数据...等等&#xff0c;都可以当作一个数组。构建数组是为了对同类的多个数据实行高效管理。 1.数组定义 格式&#xff1a;类型说明 数组…

由docker引入架构简单展开说说技术栈学习之路

想象一下&#xff0c;你开了一家线上小卖部&#xff08;单机版&#xff09;&#xff0c;突然爆单了怎么办&#xff1f;别急&#xff0c;技术架构的升级打怪之路&#xff0c;可比哆啦A梦的口袋还神奇&#xff01; 第1关&#xff1a;单枪匹马的创业初期&#xff08;单机架构&…

Dify知识库下载小程序

一、Dify配置 1.查看或创建知识库的API 二、下载程序配置 1. 安装依赖resquirements.txt ######requirements.txt##### flask2.3.3 psycopg2-binary2.9.9 requests2.31.0 python-dotenv1.0.0#####安装依赖 pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.…

Neovim - 打造一款属于自己的编辑器(一)

前言&#xff08;劝退&#xff09; neovim 是一个现代化&#xff0c;高扩展的 vim 编辑器 fork 版本&#xff0c;适合程序员打造极致高效的开发环境。 在正式开始 neovim 配置之前&#xff0c;我还是要劝退一下的。 很多人说使用 neovim 的都是变成高手&#xff0c;但我认为…

BugKu Web渗透之本地管理员

启动场景后&#xff0c;网页显示如下&#xff1a; 看起来似乎很多n。拷贝n到文件查看器&#xff0c;没有发现异常。 步骤一&#xff1a; 右键显示源码。 暂时没有发现异常。想着拷贝n到文件查看器&#xff0c;发现末尾有注释。 步骤二&#xff1a; 看见有“”&#xff0c;想…