C# Onnx segment-anything 分割万物 一键抠图

news2024/9/23 15:31:13

目录

介绍

效果

模型信息

sam_vit_b_decoder.onnx

sam_vit_b_encoder.onnx

项目

代码

下载


C# Onnx segment-anything 分割万物 一键抠图

介绍

github地址:https://github.com/facebookresearch/segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model. 

效果

C# Onnx segment-anything 分割万物

模型信息

sam_vit_b_decoder.onnx

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

Inputs
-------------------------
name:image_embeddings
tensor:Float[1, 256, 64, 64]
name:point_coords
tensor:Float[1, -1, 2]
name:point_labels
tensor:Float[1, -1]
name:mask_input
tensor:Float[1, 1, 256, 256]
name:has_mask_input
tensor:Float[1]
name:orig_im_size
tensor:Float[2]
---------------------------------------------------------------

Outputs
-------------------------
name:masks
tensor:Float[-1, -1, -1, -1]
name:iou_predictions
tensor:Float[-1, 4]
name:low_res_masks
tensor:Float[-1, -1, -1, -1]
---------------------------------------------------------------

sam_vit_b_encoder.onnx

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

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

Outputs
-------------------------
name:image_embeddings
tensor:Float[1, 256, 64, 64]
---------------------------------------------------------------

项目

代码

using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
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 = "";
        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;
        Mat 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;
            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            textBox1.Text = "";
            image = new Mat(image_path);
            pictureBox2.Image = null;
            pictureBox3.Image = null;

            sam.SetImage(image_path);
            image = new Mat(image_path);
            pictureBox1.Image = new Bitmap(image_path);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            pictureBox3.Image = null;
            button2.Enabled = false;
            Application.DoEvents();
            List<MatInfo> masks_list = sam.GetPointMask(roi);
            if (masks_list.Count>0)
            {
                int MaxInde = 0;
                float maxiou_pred = masks_list[0].iou_pred;
                for (int i = 0; i < masks_list.Count; i++)
                {
                    float temp = masks_list[i].iou_pred;
                    if (temp > maxiou_pred)
                    {
                        MaxInde = i;
                    }
                }
                pictureBox3.Image = BitmapConverter.ToBitmap(masks_list[MaxInde].mask);
            }
            button2.Enabled = true;
        }

        SamInferenceSession sam;

        private void Form1_Load(object sender, EventArgs e)
        {

            string encoderPath = "model/sam_vit_b_encoder.onnx";
            string decoderPath = "model/sam_vit_b_decoder.onnx";

            sam = new SamInferenceSession(encoderPath, decoderPath);
            sam.Initialize();

            image_path = "test_img/test.jpg";

            sam.SetImage(image_path);
            image = new Mat(image_path);
            pictureBox1.Image = new Bitmap(image_path);
            
        }

        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);
            }
        }

        bool m_mouseDown = false;
        bool m_mouseMove = false;

        System.Drawing.Point startPoint = new System.Drawing.Point();
        System.Drawing.Point endPoint = new System.Drawing.Point();

        Mat currentFrame = new Mat();
        Rect roi = new Rect();

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (pictureBox1.Image == null)
                return;
            if (!m_mouseDown) return;

            m_mouseMove = true;
            endPoint = e.Location;

            pictureBox1.Invalidate();

        }

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (!m_mouseDown || !m_mouseMove)
                return;
            Graphics g = e.Graphics;
            Pen p = new Pen(Color.Blue, 2);
            Rectangle rect = new Rectangle(startPoint.X, startPoint.Y, (endPoint.X - startPoint.X), (endPoint.Y - startPoint.Y));
            g.DrawRectangle(p, rect);

        }

        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (!m_mouseDown || !m_mouseMove)
                return;
            m_mouseDown = false;
            m_mouseMove = false;

            System.Drawing.Point image_startPoint = ConvertCooridinate(startPoint);
            System.Drawing.Point image_endPoint = ConvertCooridinate(endPoint);
            if (image_startPoint.X < 0)
                image_startPoint.X = 0;
            if (image_startPoint.Y < 0)
                image_startPoint.Y = 0;
            if (image_endPoint.X < 0)
                image_endPoint.X = 0;
            if (image_endPoint.Y < 0)
                image_endPoint.Y = 0;
            if (image_startPoint.X > image.Cols)
                image_startPoint.X = image.Cols;
            if (image_startPoint.Y > image.Rows)
                image_startPoint.Y = image.Rows;
            if (image_endPoint.X > image.Cols)
                image_endPoint.X = image.Cols;
            if (image_endPoint.Y > image.Rows)
                image_endPoint.Y = image.Rows;

            label1.Text = String.Format("ROI:({0},{1})-({2},{3})", image_startPoint.X, image_startPoint.Y, image_endPoint.X, image_endPoint.Y);
            int w = (image_endPoint.X - image_startPoint.X);
            int h = (image_endPoint.Y - image_startPoint.Y);
            if (w > 10 && h > 10)
            {
                roi = new Rect(image_startPoint.X, image_startPoint.Y, w, h);
                //Console.WriteLine(String.Format("ROI:({0},{1})-({2},{3})", image_startPoint.X, image_startPoint.Y, image_endPoint.X, image_endPoint.Y));
                //test
                //OpenCvSharp.Point pointinfo = new OpenCvSharp.Point(910, 641);
                //roi = new Rect(pointinfo.X - 160, pointinfo.Y - 430, 380, 940);
                Mat roi_mat = image[roi];
                pictureBox2.Image = BitmapConverter.ToBitmap(roi_mat);
            }
            //pictureBox1.Invalidate();

        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (pictureBox1.Image == null)
                return;
            m_mouseDown = true;
            startPoint = e.Location;
        }

        private System.Drawing.Point ConvertCooridinate(System.Drawing.Point point)
        {
            System.Reflection.PropertyInfo rectangleProperty = this.pictureBox1.GetType().GetProperty("ImageRectangle", BindingFlags.Instance | BindingFlags.NonPublic);
            Rectangle pictureBox = (Rectangle)rectangleProperty.GetValue(this.pictureBox1, null);

            int zoomedWidth = pictureBox.Width;
            int zoomedHeight = pictureBox.Height;

            int imageWidth = pictureBox1.Image.Width;
            int imageHeight = pictureBox1.Image.Height;

            double zoomRatex = (double)(zoomedWidth) / (double)(imageWidth);
            double zoomRatey = (double)(zoomedHeight) / (double)(imageHeight);
            int black_left_width = (zoomedWidth == this.pictureBox1.Width) ? 0 : (this.pictureBox1.Width - zoomedWidth) / 2;
            int black_top_height = (zoomedHeight == this.pictureBox1.Height) ? 0 : (this.pictureBox1.Height - zoomedHeight) / 2;

            int zoomedX = point.X - black_left_width;
            int zoomedY = point.Y - black_top_height;

            System.Drawing.Point outPoint = new System.Drawing.Point();
            outPoint.X = (int)((double)zoomedX / zoomRatex);
            outPoint.Y = (int)((double)zoomedY / zoomRatey);

            return outPoint;
        }

    }
}

using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
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 = "";
        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;
        Mat 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;
            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            textBox1.Text = "";
            image = new Mat(image_path);
            pictureBox2.Image = null;
            pictureBox3.Image = null;

            sam.SetImage(image_path);
            image = new Mat(image_path);
            pictureBox1.Image = new Bitmap(image_path);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            pictureBox3.Image = null;
            button2.Enabled = false;
            Application.DoEvents();
            List<MatInfo> masks_list = sam.GetPointMask(roi);
            if (masks_list.Count>0)
            {
                int MaxInde = 0;
                float maxiou_pred = masks_list[0].iou_pred;
                for (int i = 0; i < masks_list.Count; i++)
                {
                    float temp = masks_list[i].iou_pred;
                    if (temp > maxiou_pred)
                    {
                        MaxInde = i;
                    }
                }
                pictureBox3.Image = BitmapConverter.ToBitmap(masks_list[MaxInde].mask);
            }
            button2.Enabled = true;
        }

        SamInferenceSession sam;

        private void Form1_Load(object sender, EventArgs e)
        {

            string encoderPath = "model/sam_vit_b_encoder.onnx";
            string decoderPath = "model/sam_vit_b_decoder.onnx";

            sam = new SamInferenceSession(encoderPath, decoderPath);
            sam.Initialize();

            image_path = "test_img/test.jpg";

            sam.SetImage(image_path);
            image = new Mat(image_path);
            pictureBox1.Image = new Bitmap(image_path);
            
        }

        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);
            }
        }

        bool m_mouseDown = false;
        bool m_mouseMove = false;

        System.Drawing.Point startPoint = new System.Drawing.Point();
        System.Drawing.Point endPoint = new System.Drawing.Point();

        Mat currentFrame = new Mat();
        Rect roi = new Rect();

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (pictureBox1.Image == null)
                return;
            if (!m_mouseDown) return;

            m_mouseMove = true;
            endPoint = e.Location;

            pictureBox1.Invalidate();

        }

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (!m_mouseDown || !m_mouseMove)
                return;
            Graphics g = e.Graphics;
            Pen p = new Pen(Color.Blue, 2);
            Rectangle rect = new Rectangle(startPoint.X, startPoint.Y, (endPoint.X - startPoint.X), (endPoint.Y - startPoint.Y));
            g.DrawRectangle(p, rect);

        }

        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (!m_mouseDown || !m_mouseMove)
                return;
            m_mouseDown = false;
            m_mouseMove = false;

            System.Drawing.Point image_startPoint = ConvertCooridinate(startPoint);
            System.Drawing.Point image_endPoint = ConvertCooridinate(endPoint);
            if (image_startPoint.X < 0)
                image_startPoint.X = 0;
            if (image_startPoint.Y < 0)
                image_startPoint.Y = 0;
            if (image_endPoint.X < 0)
                image_endPoint.X = 0;
            if (image_endPoint.Y < 0)
                image_endPoint.Y = 0;
            if (image_startPoint.X > image.Cols)
                image_startPoint.X = image.Cols;
            if (image_startPoint.Y > image.Rows)
                image_startPoint.Y = image.Rows;
            if (image_endPoint.X > image.Cols)
                image_endPoint.X = image.Cols;
            if (image_endPoint.Y > image.Rows)
                image_endPoint.Y = image.Rows;

            label1.Text = String.Format("ROI:({0},{1})-({2},{3})", image_startPoint.X, image_startPoint.Y, image_endPoint.X, image_endPoint.Y);
            int w = (image_endPoint.X - image_startPoint.X);
            int h = (image_endPoint.Y - image_startPoint.Y);
            if (w > 10 && h > 10)
            {
                roi = new Rect(image_startPoint.X, image_startPoint.Y, w, h);
                //Console.WriteLine(String.Format("ROI:({0},{1})-({2},{3})", image_startPoint.X, image_startPoint.Y, image_endPoint.X, image_endPoint.Y));
                //test
                //OpenCvSharp.Point pointinfo = new OpenCvSharp.Point(910, 641);
                //roi = new Rect(pointinfo.X - 160, pointinfo.Y - 430, 380, 940);
                Mat roi_mat = image[roi];
                pictureBox2.Image = BitmapConverter.ToBitmap(roi_mat);
            }
            //pictureBox1.Invalidate();

        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (pictureBox1.Image == null)
                return;
            m_mouseDown = true;
            startPoint = e.Location;
        }

        private System.Drawing.Point ConvertCooridinate(System.Drawing.Point point)
        {
            System.Reflection.PropertyInfo rectangleProperty = this.pictureBox1.GetType().GetProperty("ImageRectangle", BindingFlags.Instance | BindingFlags.NonPublic);
            Rectangle pictureBox = (Rectangle)rectangleProperty.GetValue(this.pictureBox1, null);

            int zoomedWidth = pictureBox.Width;
            int zoomedHeight = pictureBox.Height;

            int imageWidth = pictureBox1.Image.Width;
            int imageHeight = pictureBox1.Image.Height;

            double zoomRatex = (double)(zoomedWidth) / (double)(imageWidth);
            double zoomRatey = (double)(zoomedHeight) / (double)(imageHeight);
            int black_left_width = (zoomedWidth == this.pictureBox1.Width) ? 0 : (this.pictureBox1.Width - zoomedWidth) / 2;
            int black_top_height = (zoomedHeight == this.pictureBox1.Height) ? 0 : (this.pictureBox1.Height - zoomedHeight) / 2;

            int zoomedX = point.X - black_left_width;
            int zoomedY = point.Y - black_top_height;

            System.Drawing.Point outPoint = new System.Drawing.Point();
            outPoint.X = (int)((double)zoomedX / zoomRatex);
            outPoint.Y = (int)((double)zoomedY / zoomRatey);

            return outPoint;
        }

    }
}

下载

源码下载


 

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

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

相关文章

UDP协议和TCP协议详解

文章目录 应用层自定义协议 传输层udp协议TCP协议1.确认应答2.超时重传3.连接管理建立连接, 三次握手断开连接, 四次挥手tcp的状态 4.滑动窗口5.流量控制6.拥塞控制7.延时应答8.携带应答9.面向字节流10.异常情况 应用层 自定义协议 客户端和服务器之间往往要进行交互的是“结构…

115.龙芯2k1000-pmon(14)- pmon编程优化

通过上面的分析&#xff0c;发现&#xff0c;其实gzrom-dtb.bin其实有很多空白区域&#xff0c;而且空白区域填充的都是0&#xff0c;这对flash来说并不友好&#xff0c;能否把填充的位置改为ff呢&#xff0c;这样编程的速度也会加快&#xff0c;对flash来说也是一种保护呢。 …

#QT(DEMO)

1.IDE&#xff1a;QTCreator 2.实验&#xff1a;打印"hello wolrd" 3.记录 &#xff08;1&#xff09;创建一个新工程&#xff1a; 新建好一个工程存放文件夹&#xff08;路径不能有中文&#xff09;,然后按下图配置 &#xff08;2&#xff09;点击widgets.ui拖入以…

活动报名|AutoMQ x 阿里云云原生创新论坛(2024.03.09)见证“新一代云原生 Kafka ”重磅发布!

新一年&#xff0c; AutoMQ 首场线下活动重磅来袭&#xff01;2024年3月9日&#xff0c;由 AutoMQ 与阿里云联合举办的云原生创新论坛将于杭州与大家见面&#xff0c;双方联合重磅发布新一代云原生 Kafka ——AutoMQ On-Prem 版本 &#xff01;现场将会分享如何通过云原生和存算…

美摄科技实时语音数字人解决方案

随着科技的飞速发展&#xff0c;数字人技术已经逐渐渗透到我们生活的各个角落。作为数字人技术的先驱者&#xff0c;美摄科技凭借其卓越的实时语音数字人解决方案&#xff0c;正引领着企业步入一个全新的交互时代。 美摄科技的实时语音数字人解决方案&#xff0c;是基于语音和…

【JavaEE进阶】 Linux常用命令

文章目录 &#x1f343;前言&#x1f334;ls 与 pwd&#x1f6a9;ls&#x1f6a9;pwd &#x1f38d;cd&#x1f6a9;认识Linux目录结构 &#x1f340;touch与cat&#x1f6a9;touch&#x1f6a9;cat &#x1f332;mkdir与rm&#x1f6a9;mkdir&#x1f6a9;rm &#x1f384;cp与…

UCSF DOCK 分子对接详细案例(04)-基于RDKit描述符的分子从头设计DOCK_D3N

欢迎浏览我的CSND博客&#xff01; Blockbuater_drug …点击进入 文章目录 前言一、 软件及操作环境二、研究目的三、结构文件准备四、 DOCK/RDKit中 de novo design4.1 de novo design - refine_D3N4.2 对输出重新评分 总结参考资料 前言 本文是UCSF DOCK的使用案例分享&…

论文阅读:2017MobileNet V1谷歌轻量化卷积神经网络

拓展&#xff1a;贾扬清&#xff1a;深度学习框架caffe&#xff08;Convolutional Architecture for Fast Feature Embedding&#xff09; 主要贡献&#xff1a; 深度可分离卷积&#xff08;Depthwise separable convolution&#xff09;逐点卷积&#xff08;Pointwise convo…

langchain学习笔记(九)

RunnableBranch: Dynamically route logic based on input | &#x1f99c;️&#x1f517; Langchain 基于输入的动态路由逻辑&#xff0c;通过上一步的输出选择下一步操作&#xff0c;允许创建非确定性链。路由保证路由间的结构和连贯。 有以下两种方法执行路由 1、通过Ru…

dvwa靶场xss通关

原理 XSS漏洞是攻击者将恶意代码注入到合法网页中&#xff0c;当用户浏览该页面时&#xff0c;恶意代码会被执行&#xff0c;从而获取用户敏感信息或进行其他攻击。 形成原因 网站对用户输入数据的过滤不严格或不完备&#xff0c;攻击者可以根据这个漏洞向网站提交恶意代码&am…

白银投资可以买涨买跌吗?

在金融市场中&#xff0c;投资者总是在寻找机会以实现资产增值。白银作为一种贵金属和投资产品&#xff0c;历来被视作避险工具和保值手段。那么&#xff0c;白银投资能否买涨买跌&#xff1f;白银投资是可以通过伦敦银、白银期货、白银ETFs交易所交易基金等来进行买涨买跌操作…

甘特图资源视图和任务视图的区别

甘特图(Gantt chart)是一种常用的项目管理工具,用于直观地展示项目的进度和各项任务的时间安排。甘特图包含资源视图和任务视图两种视角。 一个项目的甘特图demo &#xff1a; https://zz-plan.com/share/87f1340286f1343ba5 资源视图主要显示项目中不同资源的分配和利用情况…

JAVA内存模型与JVM内存结构

注意区分Java内存模型&#xff08;Java Memory Model&#xff0c;简称JMM&#xff09;与Jvm内存结构&#xff0c;前者与多线程相关&#xff0c;后者与JVM内部存储相关。本文会对两者进行简单介绍。 一、JAVA内存模型(JMM) 1. 概念 说来话长&#xff0c;由于在不同硬件厂商和…

Java多线程——如何控制线程顺序执行,如何控制线程同时执行

目录 引出如何控制线程执行顺序&#xff1f;多个线程在某一时刻同时开始执行&#xff1f; Redis冲冲冲——缓存三兄弟&#xff1a;缓存击穿、穿透、雪崩缓存击穿缓存穿透缓存雪崩 总结 引出 Java多线程——如何控制线程顺序执行&#xff0c;如何控制线程同时执行 如何控制线程…

JS正则03——js正则的贪婪匹配模式与非贪婪匹配模式➕正向预测匹配和负向预测匹配的详细使用及例子

JS正则03——js正则的贪婪匹配模式与非贪婪匹配模式➕正向预测匹配和负向预测匹配的详细使用及例子 1. 前言1.1 js正则的基本使用 2. 贪婪匹配模式 与 非贪婪匹配模式2.1 引例2.2 贪婪模式2.3 非贪婪模式2.4 原理——参考 3. 预测匹配方式3.1 正向预测匹配3.2 负向预测匹配3.2.…

试手一下CameraX(APP)

书接上回。 首先还是看谷歌的官方文档&#xff1a; https://developer.android.com/media/camera/camerax?hlzh-cn https://developer.android.com/codelabs/camerax-getting-started?hlzh-cn#1 注&#xff1a;这里大部分内容也来自谷歌文档。 官方文档用的是Kotlin&…

Window下编写的sh文件在Linux/Docker中无法使用

Window下编写的sh文件在Linux/Docker中无法使用 一、sh文件目的1.1 初始状态1.2 目的 二、过程与异常2.1 首先获取标准ubuntu20.04 - 正常2.2 启动ubuntu20.04容器 - 正常2.3 执行windows下写的preInstall文件 - 报错 三、检查和处理3.1 评估异常3.2 处理异常3.3 调整后运行测试…

不知道RAID/SAN/NAS的小可爱来看看这个吧!

RAID RAID&#xff08;冗余阵列的独立磁盘&#xff0c;Redundant Array of Independent Disks&#xff09;是一种将多个磁盘驱动器组合成一个或多个单元的技术&#xff0c;目的是在提高数据可靠性和/或提升性能的同时&#xff0c;对操作系统隐藏底层的复杂性。简而言之&#x…

Vue3中Vuex状态管理库学习笔记

1.什么是状态管理 在开发中&#xff0c;我们会的应用程序需要处理各种各样的数据&#xff0c;这些数据需要保存在我们应用程序的某个位置&#xff0c;对于这些数据的管理我们就称之为状态管理。 在之前我们如何管理自己的状态呢&#xff1f; 在Vue开发中&#xff0c;我们使用…

“比特币暴拉冲破6.5万美元”!超罕见指标揭示牛市信号,18万美元目标能否实现?

比特币&#xff08;BTC&#xff09;周末持续在6.2万美元反复震荡之后&#xff0c;今&#xff08;4&#xff09;晨再次强势拉涨&#xff0c;早上8&#xff1a;45左右最高触及64268美元&#xff0c;随后插针盘整&#xff0c;下午5点30分左右突破65500美元&#xff0c;再创今年新高…