C# Onnx 使用onnxruntime部署实时视频帧插值

news2024/9/21 18:48:44

目录

介绍

效果

模型信息

项目

代码

下载


C# Onnx 使用onnxruntime部署实时视频帧插值

介绍

github地址:https://github.com/google-research/frame-interpolation

FILM: Frame Interpolation for Large Motion, In ECCV 2022.

The official Tensorflow 2 implementation of our high quality frame interpolation neural network. We present a unified single-network approach that doesn't use additional pre-trained networks, like optical flow or depth, and yet achieve state-of-the-art results. We use a multi-scale feature extractor that shares the same convolution weights across the scales. Our model is trainable from frame triplets alone.

FILM transforms near-duplicate photos into a slow motion footage that look like it is shot with a video camera.

效果

模型信息

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:I0
tensor:Float[1, 3, -1, -1]
name:I1
tensor:Float[1, 3, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:merged
tensor:Float[1, -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.Linq;
using System.Numerics;
using System.Windows.Forms;

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

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";
        string startupPath;
        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;
        string model_path;
        Mat image;
        Mat result_image;

        SessionOptions options;
        InferenceSession onnx_session;
        Tensor<float> input_tensor;
        Tensor<float> input_tensor2;
        List<NamedOnnxValue> input_container;
        IDisposableReadOnlyCollection<DisposableNamedOnnxValue> result_infer;
        DisposableNamedOnnxValue[] results_onnxvalue;

        Tensor<float> result_tensors;
        float[] result_array;

        float[] input1_image;
        float[] input2_image;

        int inpWidth;
        int inpHeight;

        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 = "";
            image = new Mat(image_path);
            pictureBox2.Image = null;
        }

        void Preprocess(Mat img, ref float[] input_img)
        {
            Mat rgbimg = new Mat();
            Cv2.CvtColor(img, rgbimg, ColorConversionCodes.BGR2RGB);
            int h = rgbimg.Rows;
            int w = rgbimg.Cols;
            int align = 32;
            if (h % align != 0 || w % align != 0)
            {
                int ph = ((h - 1) / align + 1) * align;
                int pw = ((w - 1) / align + 1) * align;

                Cv2.CopyMakeBorder(rgbimg, rgbimg, 0, ph - h, 0, pw - w, BorderTypes.Constant, 0);
            }

            inpHeight = rgbimg.Rows;
            inpWidth = rgbimg.Cols;

            rgbimg.ConvertTo(rgbimg, MatType.CV_32FC3, 1 / 255.0);

            int image_area = rgbimg.Rows * rgbimg.Cols;

            //input_img = new float[3 * image_area];

            input_img = Common.ExtractMat(rgbimg);

        }

        Mat Interpolate(Mat srcimg1, Mat srcimg2)
        {
            int srch = srcimg1.Rows;
            int srcw = srcimg1.Cols;

            Preprocess(srcimg1, ref input1_image);
            Preprocess(srcimg2, ref input2_image);

            // 输入Tensor
            input_tensor = new DenseTensor<float>(input1_image, new[] { 1, 3, inpHeight, inpWidth });
            input_tensor2 = new DenseTensor<float>(input2_image, new[] { 1, 3, inpHeight, inpWidth });

            //将tensor 放入一个输入参数的容器,并指定名称
            input_container.Add(NamedOnnxValue.CreateFromTensor("I0", input_tensor));
            input_container.Add(NamedOnnxValue.CreateFromTensor("I1", input_tensor2));

            //运行 Inference 并获取结果
            result_infer = onnx_session.Run(input_container);

            // 将输出结果转为DisposableNamedOnnxValue数组
            results_onnxvalue = result_infer.ToArray();

            // 读取第一个节点输出并转为Tensor数据
            result_tensors = results_onnxvalue[0].AsTensor<float>();

            int out_h = results_onnxvalue[0].AsTensor<float>().Dimensions[2];
            int out_w = results_onnxvalue[0].AsTensor<float>().Dimensions[3];

            result_array = result_tensors.ToArray();

            for (int i = 0; i < result_array.Length; i++)
            {
                result_array[i] = result_array[i] * 255;

                if (result_array[i] < 0)
                {
                    result_array[i] = 0;
                }
                else if (result_array[i] > 255)
                {
                    result_array[i] = 255;
                }

                result_array[i] = result_array[i] + 0.5f;
            }

            float[] temp_r = new float[out_h * out_w];
            float[] temp_g = new float[out_h * out_w];
            float[] temp_b = new float[out_h * out_w];

            Array.Copy(result_array, temp_r, out_h * out_w);
            Array.Copy(result_array, out_h * out_w, temp_g, 0, out_h * out_w);
            Array.Copy(result_array, out_h * out_w * 2, temp_b, 0, out_h * out_w);

            Mat rmat = new Mat(out_h, out_w, MatType.CV_32F, temp_r);
            Mat gmat = new Mat(out_h, out_w, MatType.CV_32F, temp_g);
            Mat bmat = new Mat(out_h, out_w, MatType.CV_32F, temp_b);

            result_image = new Mat();
            Cv2.Merge(new Mat[] { bmat, gmat, rmat }, result_image);

            result_image.ConvertTo(result_image, MatType.CV_8UC3);

            Mat mid_img = new Mat(result_image, new Rect(0, 0, srcw, srch));

            return mid_img;

        }

        private void button2_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            pictureBox2.Image = null;
            textBox1.Text = "正在运行,请稍后……";
            Application.DoEvents();

            dt1 = DateTime.Now;

            List<String> inputs_imgpath = new List<String>() { "test_img/frame07.png", "test_img/frame08.png", "test_img/frame09.png", "test_img/frame10.png", "test_img/frame11.png", "test_img/frame12.png", "test_img/frame13.png", "test_img/frame14.png" };

            int imgnum = inputs_imgpath.Count();

            for (int i = 0; i < imgnum - 1; i++)
            {
                Mat srcimg1 = Cv2.ImRead(inputs_imgpath[i]);
                Mat srcimg2 = Cv2.ImRead(inputs_imgpath[i + 1]);

                Mat mid_img = Interpolate(srcimg1, srcimg2);

                string save_imgpath = "imgs_results/mid" + i + ".jpg";
                Cv2.ImWrite(save_imgpath, mid_img);
            }

            dt2 = DateTime.Now;

            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
            button2.Enabled = true;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            model_path = "model/RIFE_HDv3.onnx";

            // 创建输出会话,用于输出模型读取信息
            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_container = new List<NamedOnnxValue>();

            pictureBox1.Image = new Bitmap("test_img/frame11.png");
            pictureBox3.Image = new Bitmap("test_img/frame12.png");

        }

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

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

        SaveFileDialog sdf = new SaveFileDialog();
        private void button3_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Image == null)
            {
                return;
            }
            Bitmap output = new Bitmap(pictureBox2.Image);
            sdf.Title = "保存";
            sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp|Images (*.emf)|*.emf|Images (*.exif)|*.exif|Images (*.gif)|*.gif|Images (*.ico)|*.ico|Images (*.tiff)|*.tiff|Images (*.wmf)|*.wmf";
            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;
                        }
                    case 4:
                        {
                            output.Save(sdf.FileName, ImageFormat.Emf);
                            break;
                        }
                    case 5:
                        {
                            output.Save(sdf.FileName, ImageFormat.Exif);
                            break;
                        }
                    case 6:
                        {
                            output.Save(sdf.FileName, ImageFormat.Gif);
                            break;
                        }
                    case 7:
                        {
                            output.Save(sdf.FileName, ImageFormat.Icon);
                            break;
                        }

                    case 8:
                        {
                            output.Save(sdf.FileName, ImageFormat.Tiff);
                            break;
                        }
                    case 9:
                        {
                            output.Save(sdf.FileName, ImageFormat.Wmf);
                            break;
                        }
                }
                MessageBox.Show("保存成功,位置:" + sdf.FileName);
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            pictureBox2.Image = null;
            textBox1.Text = "正在运行,请稍后……";
            Application.DoEvents();

            dt1 = DateTime.Now;

            Mat srcimg1 = Cv2.ImRead("test_img/frame11.png");
            Mat srcimg2 = Cv2.ImRead("test_img/frame12.png");

            Mat mid_img = Interpolate(srcimg1, srcimg2);

            dt2 = DateTime.Now;

            pictureBox2.Image = new Bitmap(mid_img.ToMemoryStream());

            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
            button2.Enabled = true;
        }
    }
}

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.Linq;
using System.Numerics;
using System.Windows.Forms;

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

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";
        string startupPath;
        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;
        string model_path;
        Mat image;
        Mat result_image;

        SessionOptions options;
        InferenceSession onnx_session;
        Tensor<float> input_tensor;
        Tensor<float> input_tensor2;
        List<NamedOnnxValue> input_container;
        IDisposableReadOnlyCollection<DisposableNamedOnnxValue> result_infer;
        DisposableNamedOnnxValue[] results_onnxvalue;

        Tensor<float> result_tensors;
        float[] result_array;

        float[] input1_image;
        float[] input2_image;

        int inpWidth;
        int inpHeight;

        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 = "";
            image = new Mat(image_path);
            pictureBox2.Image = null;
        }

        void Preprocess(Mat img, ref float[] input_img)
        {
            Mat rgbimg = new Mat();
            Cv2.CvtColor(img, rgbimg, ColorConversionCodes.BGR2RGB);
            int h = rgbimg.Rows;
            int w = rgbimg.Cols;
            int align = 32;
            if (h % align != 0 || w % align != 0)
            {
                int ph = ((h - 1) / align + 1) * align;
                int pw = ((w - 1) / align + 1) * align;

                Cv2.CopyMakeBorder(rgbimg, rgbimg, 0, ph - h, 0, pw - w, BorderTypes.Constant, 0);
            }

            inpHeight = rgbimg.Rows;
            inpWidth = rgbimg.Cols;

            rgbimg.ConvertTo(rgbimg, MatType.CV_32FC3, 1 / 255.0);

            int image_area = rgbimg.Rows * rgbimg.Cols;

            //input_img = new float[3 * image_area];

            input_img = Common.ExtractMat(rgbimg);

        }

        Mat Interpolate(Mat srcimg1, Mat srcimg2)
        {
            int srch = srcimg1.Rows;
            int srcw = srcimg1.Cols;

            Preprocess(srcimg1, ref input1_image);
            Preprocess(srcimg2, ref input2_image);

            // 输入Tensor
            input_tensor = new DenseTensor<float>(input1_image, new[] { 1, 3, inpHeight, inpWidth });
            input_tensor2 = new DenseTensor<float>(input2_image, new[] { 1, 3, inpHeight, inpWidth });

            //将tensor 放入一个输入参数的容器,并指定名称
            input_container.Add(NamedOnnxValue.CreateFromTensor("I0", input_tensor));
            input_container.Add(NamedOnnxValue.CreateFromTensor("I1", input_tensor2));

            //运行 Inference 并获取结果
            result_infer = onnx_session.Run(input_container);

            // 将输出结果转为DisposableNamedOnnxValue数组
            results_onnxvalue = result_infer.ToArray();

            // 读取第一个节点输出并转为Tensor数据
            result_tensors = results_onnxvalue[0].AsTensor<float>();

            int out_h = results_onnxvalue[0].AsTensor<float>().Dimensions[2];
            int out_w = results_onnxvalue[0].AsTensor<float>().Dimensions[3];

            result_array = result_tensors.ToArray();

            for (int i = 0; i < result_array.Length; i++)
            {
                result_array[i] = result_array[i] * 255;

                if (result_array[i] < 0)
                {
                    result_array[i] = 0;
                }
                else if (result_array[i] > 255)
                {
                    result_array[i] = 255;
                }

                result_array[i] = result_array[i] + 0.5f;
            }

            float[] temp_r = new float[out_h * out_w];
            float[] temp_g = new float[out_h * out_w];
            float[] temp_b = new float[out_h * out_w];

            Array.Copy(result_array, temp_r, out_h * out_w);
            Array.Copy(result_array, out_h * out_w, temp_g, 0, out_h * out_w);
            Array.Copy(result_array, out_h * out_w * 2, temp_b, 0, out_h * out_w);

            Mat rmat = new Mat(out_h, out_w, MatType.CV_32F, temp_r);
            Mat gmat = new Mat(out_h, out_w, MatType.CV_32F, temp_g);
            Mat bmat = new Mat(out_h, out_w, MatType.CV_32F, temp_b);

            result_image = new Mat();
            Cv2.Merge(new Mat[] { bmat, gmat, rmat }, result_image);

            result_image.ConvertTo(result_image, MatType.CV_8UC3);

            Mat mid_img = new Mat(result_image, new Rect(0, 0, srcw, srch));

            return mid_img;

        }

        private void button2_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            pictureBox2.Image = null;
            textBox1.Text = "正在运行,请稍后……";
            Application.DoEvents();

            dt1 = DateTime.Now;

            List<String> inputs_imgpath = new List<String>() { "test_img/frame07.png", "test_img/frame08.png", "test_img/frame09.png", "test_img/frame10.png", "test_img/frame11.png", "test_img/frame12.png", "test_img/frame13.png", "test_img/frame14.png" };

            int imgnum = inputs_imgpath.Count();

            for (int i = 0; i < imgnum - 1; i++)
            {
                Mat srcimg1 = Cv2.ImRead(inputs_imgpath[i]);
                Mat srcimg2 = Cv2.ImRead(inputs_imgpath[i + 1]);

                Mat mid_img = Interpolate(srcimg1, srcimg2);

                string save_imgpath = "imgs_results/mid" + i + ".jpg";
                Cv2.ImWrite(save_imgpath, mid_img);
            }

            dt2 = DateTime.Now;

            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
            button2.Enabled = true;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            model_path = "model/RIFE_HDv3.onnx";

            // 创建输出会话,用于输出模型读取信息
            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_container = new List<NamedOnnxValue>();

            pictureBox1.Image = new Bitmap("test_img/frame11.png");
            pictureBox3.Image = new Bitmap("test_img/frame12.png");

        }

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

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

        SaveFileDialog sdf = new SaveFileDialog();
        private void button3_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Image == null)
            {
                return;
            }
            Bitmap output = new Bitmap(pictureBox2.Image);
            sdf.Title = "保存";
            sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp|Images (*.emf)|*.emf|Images (*.exif)|*.exif|Images (*.gif)|*.gif|Images (*.ico)|*.ico|Images (*.tiff)|*.tiff|Images (*.wmf)|*.wmf";
            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;
                        }
                    case 4:
                        {
                            output.Save(sdf.FileName, ImageFormat.Emf);
                            break;
                        }
                    case 5:
                        {
                            output.Save(sdf.FileName, ImageFormat.Exif);
                            break;
                        }
                    case 6:
                        {
                            output.Save(sdf.FileName, ImageFormat.Gif);
                            break;
                        }
                    case 7:
                        {
                            output.Save(sdf.FileName, ImageFormat.Icon);
                            break;
                        }

                    case 8:
                        {
                            output.Save(sdf.FileName, ImageFormat.Tiff);
                            break;
                        }
                    case 9:
                        {
                            output.Save(sdf.FileName, ImageFormat.Wmf);
                            break;
                        }
                }
                MessageBox.Show("保存成功,位置:" + sdf.FileName);
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            pictureBox2.Image = null;
            textBox1.Text = "正在运行,请稍后……";
            Application.DoEvents();

            dt1 = DateTime.Now;

            Mat srcimg1 = Cv2.ImRead("test_img/frame11.png");
            Mat srcimg2 = Cv2.ImRead("test_img/frame12.png");

            Mat mid_img = Interpolate(srcimg1, srcimg2);

            dt2 = DateTime.Now;

            pictureBox2.Image = new Bitmap(mid_img.ToMemoryStream());

            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
            button2.Enabled = true;
        }
    }
}

下载

源码下载

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1464619.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Linux】一站式教会:Ubuntu(无UI界面)使用apache-jmeter进行压测

&#x1f3e1;浩泽学编程&#xff1a;个人主页 &#x1f525; 推荐专栏&#xff1a;《深入浅出SpringBoot》《java对AI的调用开发》 《RabbitMQ》《Spring》《SpringMVC》 &#x1f6f8;学无止境&#xff0c;不骄不躁&#xff0c;知行合一 文章目录 前言一、Java…

基于java+springboot+vue实现的美食信息推荐系统(文末源码+Lw)23-170

1 摘 要 使用旧方法对美食信息推荐系统的信息进行系统化管理已经不再让人们信赖了&#xff0c;把现在的网络信息技术运用在美食信息推荐系统的管理上面可以解决许多信息管理上面的难题&#xff0c;比如处理数据时间很长&#xff0c;数据存在错误不能及时纠正等问题。这次开发…

运维SRE-19 网站Web中间件服务-http-nginx

Ans自动化流程 1.网站集群核心协议&#xff1a;HTTP 1.1概述 web服务&#xff1a;网站服务&#xff0c;网站协议即可. 协议&#xff1a;http协议,https协议 服务&#xff1a;Nginx服务&#xff0c;Tengine服务....1.2 HTTP协议 http超文本传输协议&#xff0c;负责数据在网站…

【思扬赠书 | 第3期】由面试题“Redis是否为单线程”引发的思考

⛳️ 写在前面参与规则&#xff01;&#xff01;&#xff01; ✅参与方式&#xff1a;关注博主、点赞、收藏、评论&#xff0c;任意评论&#xff08;每人最多评论三次&#xff09; ⛳️本次送书1~4本【取决于阅读量&#xff0c;阅读量越多&#xff0c;送的越多】 很多人都遇到…

Day10-面向对象-抽象类和接口

文章目录 学习目标1. 抽象类1.1 抽象类注意事项1.2 修饰符的使用 2. 接口2.1 定义接口2.2 接口里可以定义的成员2.2 实现接口2.2.1 实现接口语法格式2.2.2 如何调用对应的方法2.2.3 练习 2.3 接口的多实现2.3.1 练习 2.4 冲突问题2.5 接口的多继承(了解)2.6 部分内置接口 学习目…

2024转行要趁早!盘点网络安全的岗位汇总

前段时间&#xff0c;知名机构麦可思研究院发布了《2024年中国本科生就业报告》&#xff0c;其中详细列出近五年的本科绿牌专业&#xff0c;信息安全位列第一。 对于网络安全的发展与就业前景&#xff0c;知了姐说过很多&#xff0c;作为当下应届生收入较高的专业之一&#xf…

【Python笔记-设计模式】对象池模式

一、说明 用于管理对象的生命周期&#xff0c;重用已经创建的对象&#xff0c;从而减少资源消耗和创建对象的开销 (一) 解决问题 主要解决频繁创建和销毁对象所带来的性能开销问题。如数据库连接、线程管理、网络连接等&#xff0c;对象的创建和销毁成本相对较高&#xff0c…

C 语言基本语法及实用案例分享

一、什么是 C 语言&#xff1f; C语言是一种较早的程序设计语言&#xff0c;诞生于1972年的贝尔实验室。1972 年&#xff0c;Dennis Ritchie 设计了C语言&#xff0c;它继承了B语言的许多思想&#xff0c;并加入了数据类型的概念及其他特性。C语言是一门面向过程的计算机编程语…

基于单片机和LabVIEW的多路数据采集系统设计

摘 要:以8位高速、低功耗微控制器STC12C5A60S2为硬件控制核心,以Labview为上位机软件开发平台,设计了一个多路数据采集系统。由下位机单片机对多路模拟信号量进行数据采集,通过串口将采集的模拟量信息上传到上位机,上位机Labview对采集的数据进行存储、显示及处理、分析…

Node.js中如何处理异步编程

在Node.js中&#xff0c;处理异步编程是至关重要的技能。由于Node.js的单线程执行模型&#xff0c;异步编程可以极大地提高程序的性能和响应速度。本文将介绍几种常见的异步编程处理方式&#xff0c;并附上示例代码&#xff0c;帮助您更好地理解和应用异步编程技术。 回调函数…

GitLab代码库提交量统计工具

1.说明 统计公司所有项目的提交情况&#xff0c;可指定分支和时间段&#xff0c;返回每个人的提交新增数、删除数和总数。 2.API 文档地址&#xff1a;http://公司gitlab域名/help/api/README.md 项目列表查询 返回示例&#xff1a; [{"id": 1, //项目ID"http…

软考29-上午题-【数据结构】-排序

一、排序的基本概念 1-1、稳定性 稳定性指的是相同的数据所在的位置经过排序后是否发生变化。若是排序后&#xff0c;次序不变&#xff0c;则是稳定的。 1-2、归位 每一趟排序能确定一个元素的最终位置。 1-3、内部排序 排序记录全部存放在内存中进行排序的过程。 1-4、外部…

TF-A之供应链威胁模型分析

目录 一、简介 二、TF-A 概述 2.1、TF-A 存储库 2.2、外部依赖 2.3、附加二进制文件 2.4、TF-A工具链 2.5、基础设施 三、TF-A数据流 四、攻击树 五、威胁评估与缓解 5.1、影响和可能性评级 5.2、威胁和缓解措施 六、附录 一、简介 软件供应链攻击旨在向软件产品…

《深入浅出 Spring Boot 3.x》预计3月份发版

各位&#xff0c;目前本来新书《深入浅出 Spring Boot 3.x》已经到了最后编辑排版阶段&#xff0c;即将在3月份发布。 目录&#xff1a; 现在把目录截取给大家&#xff1a; 主要内容&#xff1a; 本书内容安排如下。 ● 第 1 章和第 2 章讲解 Spring Boot 和传统 Spri…

IT资讯——全速推进“AI+鸿蒙”战略布局!

文章目录 每日一句正能量前言坚持长期研发投入全速推进“AI鸿蒙”战略 人才战略新章落地持续加码核心技术生态建设 后记 每日一句正能量 人总要咽下一些委屈&#xff0c;然后一字不提的擦干眼泪往前走&#xff0c;没有人能像白纸一样没有故事&#xff0c;成长的代价就是失去原来…

【东京都立大学主办多重会议奖项】第六届计算机通信与互联网国际会议

ICCCI 2024 - Hosted by Tokyo Metropolitan University, Japanhttps://www.iccci.org/ 会议简介 第六届计算机通信与互联网国际会议将于2024年6月14-16日在日本东京都立大学举行。ICCCI 2024由东京都立大学主办&#xff0c;华中师范大学和美国科学工程学会联合赞助、并得到了…

Curfew e-Pass 管理系统存在Sql注入漏洞 附源代码

免责声明&#xff1a;本文所涉及的信息安全技术知识仅供参考和学习之用&#xff0c;并不构成任何明示或暗示的保证。读者在使用本文提供的信息时&#xff0c;应自行判断其适用性&#xff0c;并承担由此产生的一切风险和责任。本文作者对于读者基于本文内容所做出的任何行为或决…

使用备份工具xtrabackup进行增量备份详细讲解

增量备份 第一次修改数据 mysql> insert into tb_user values (4,sxx,0); Query OK, 1 row affected (0.01 sec)mysql> select * from tb_user; ------------------- | id | name | sex | ------------------- | 1 | Tom | 1 | | 2 | Trigger | 0 | | …

深入学习TS的高阶语法(泛型、类型检测、内置工具)

文章目录 概要一.TS的类型检测1.鸭子类型2.严格的字面量类型检测 二.TS的泛型1.基本使用2.传递多个参数3.泛型接口4.泛型类5.泛型约束6.映射类型&#xff08;了解&#xff09; 三.TS的知识扩展1.模块的使用-- 内置类型导入 2.类型的查找3.第三方库的类型导入4.declare 声明文件…

深度学习中的样本分类:如何区分正样本、负样本、困难样本和简单样本?

深度学习中的样本分类&#xff1a;如何区分正样本、负样本、困难样本和简单样本&#xff1f; &#x1f308; 个人主页&#xff1a;高斯小哥 &#x1f525; 高质量专栏&#xff1a;Matplotlib之旅&#xff1a;零基础精通数据可视化、Python基础【高质量合集】、PyTorch零基础入…