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

MaskRCNN训练自己的数据集

一. 数据标注

1. 安装labelme软件
conda install labelme
2. 运行labelme
# 命令行中直接输入
labelme
3. 标注

在这里插入图片描述
在这里插入图片描述

二、训练数据处理

1. 在根目录下创建datasets/demo1文件夹,创建如下几个文件夹

在这里插入图片描述

2. 将标注好的.json文件放在json文件夹中

在这里插入图片描述

3. 原图放在pic文件夹中

在这里插入图片描述

4. 批量处理JSON文件

现在的.json包含了我们标注的信息,但是还不是可以让代码直接读取的数据格式,对于不同的深度学习代码,数据存放的格式要根据不同代码的写法来定,下面以上述的mask-rcnn为例,将数据修改为我们需要的格式。

在json文件夹中创建test.bat脚本

@echo off
for %%i in (*.json) do labelme_json_to_dataset "%%i"
pause

在json文件夹中运行(要激活maskrcnn虚拟环境)

在这里插入图片描述
批处理生成的文件夹
在这里插入图片描述
在这里插入图片描述

5. 将批处理生成的文件夹复制到labelme_json文件夹中

在这里插入图片描述

6. 将labelme_json文件夹中的label.png复制到cv2_mask中

在这里插入图片描述
单个复制太麻烦,我们写脚本批处理, 创建copy.py

import os 
import shutilfor dir_name in os.listdir('./labelme_json'):pic_name = dir_name[:-5] + '.png'from_dir = './labelme_json/'+dir_name+'./label.png'to_dir = './cv2_mask/'+pic_nameshutil.copyfile(from_dir, to_dir)print (from_dir)print (to_dir)

在这里插入图片描述
在这里插入图片描述

三、训练数据

根目录下创建train_test.py

# -*- coding: utf-8 -*-
'''
Author: qingqingdan 1306047688@qq.com
Date: 2024-11-22 17:48:33
LastEditTime: 2024-11-29 12:16:01
Description: labelme标注图片 训练自己的数据集
'''import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
from mrcnn.config import Config
#import utils
from mrcnn import model as modellib,utils
from mrcnn import visualize
import yaml
from mrcnn.model import log
from PIL import Image
"""
加入自己类别名称
更改类别个数
"""#os.environ["CUDA_VISIBLE_DEVICES"] = "0"
# Root directory of the project
ROOT_DIR = os.getcwd()#ROOT_DIR = os.path.abspath("../")
# 训练后的模型
MODEL_DIR = os.path.join(ROOT_DIR, "logs")iter_num=0# Local path to trained weights file
COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5")
# Download COCO trained weights from Releases if needed
if not os.path.exists(COCO_MODEL_PATH):utils.download_trained_weights(COCO_MODEL_PATH)#基础设置
dataset_root_path="datasets/demo2/"
img_floder = dataset_root_path + "pic"
mask_floder = dataset_root_path + "cv2_mask"
imglist = os.listdir(img_floder)
count = len(imglist)class ShapesConfig(Config):"""Configuration for training on the toy shapes dataset.Derives from the base Config class and overrides values specificto the toy shapes dataset."""# Give the configuration a recognizable nameNAME = "shapes"# Train on 1 GPU and 8 images per GPU. We can put multiple images on each# GPU because the images are small. Batch size is 8 (GPUs * images/GPU).GPU_COUNT = 1IMAGES_PER_GPU = 1# Number of classes (including background)NUM_CLASSES = 1 + 2  # background + 2 shapes# Use small images for faster training. Set the limits of the small side# the large side, and that determines the image shape.IMAGE_MIN_DIM = 320IMAGE_MAX_DIM = 384# Use smaller anchors because our image and objects are smallRPN_ANCHOR_SCALES = (8 * 6, 16 * 6, 32 * 6, 64 * 6, 128 * 6)  # anchor side in pixels# Reduce training ROIs per image because the images are small and have# few objects. Aim to allow ROI sampling to pick 33% positive ROIs.TRAIN_ROIS_PER_IMAGE = 100# Use a small epoch since the data is simpleSTEPS_PER_EPOCH = 100# use small validation steps since the epoch is smallVALIDATION_STEPS = 50config = ShapesConfig()
config.display()class DrugDataset(utils.Dataset):# 得到该图中有多少个实例(物体)def get_obj_index(self, image):n = np.max(image)return n# 解析labelme中得到的yaml文件,从而得到mask每一层对应的实例标签def from_yaml_get_class(self, image_id):info = self.image_info[image_id]with open(info['yaml_path']) as f:temp = yaml.load(f.read(), Loader=yaml.FullLoader)labels = temp['label_names']del labels[0]return labels# 重新写draw_maskdef draw_mask(self, num_obj, mask, image,image_id):info = self.image_info[image_id]for index in range(num_obj):for i in range(info['width']):for j in range(info['height']):at_pixel = image.getpixel((i, j))if at_pixel == index + 1:mask[j, i, index] = 1return mask# 重新写load_shapes,里面包含自己的自己的类别# 并在self.image_info信息中添加了path、mask_path 、yaml_path# yaml_pathdataset_root_path = "/tongue_dateset/"# img_floder = dataset_root_path + "rgb"# mask_floder = dataset_root_path + "mask"# dataset_root_path = "/tongue_dateset/"def load_shapes(self, count, img_floder, mask_floder, imglist, dataset_root_path):"""Generate the requested number of synthetic images.count: number of images to generate.height, width: the size of the generated images."""# Add classes#self.add_class("shapes", 1, "tank") # 黑色素瘤#self.add_class("shapes", 1, "danhe") self.add_class("shapes", 2, "linba")  for i in range(count):# 获取图片宽和高filestr = imglist[i].split(".")[0]mask_path = mask_floder + "/" + filestr + ".png"yaml_path = dataset_root_path + "labelme_json/" + filestr + "_json/info.yaml"print(dataset_root_path + "labelme_json/" + filestr + "_json/img.png")cv_img = cv2.imread(dataset_root_path + "labelme_json/" + filestr + "_json/img.png")self.add_image("shapes", image_id=i, path=img_floder + "/" + imglist[i],width=cv_img.shape[1], height=cv_img.shape[0], mask_path=mask_path, yaml_path=yaml_path)# 重写load_maskdef load_mask(self, image_id):"""Generate instance masks for shapes of the given image ID."""global iter_numprint("image_id",image_id)info = self.image_info[image_id]count = 1  # number of objectimg = Image.open(info['mask_path'])num_obj = self.get_obj_index(img)mask = np.zeros([info['height'], info['width'], num_obj], dtype=np.uint8)mask = self.draw_mask(num_obj, mask, img,image_id)occlusion = np.logical_not(mask[:, :, -1]).astype(np.uint8)for i in range(count - 2, -1, -1):mask[:, :, i] = mask[:, :, i] * occlusionocclusion = np.logical_and(occlusion, np.logical_not(mask[:, :, i]))labels = []labels = self.from_yaml_get_class(image_id)labels_form = []for i in range(len(labels)):if labels[i].find("danhe") != -1:labels_form.append("danhe")if labels[i].find("linba") != -1:labels_form.append("linba")class_ids = np.array([self.class_names.index(s) for s in labels_form])return mask, class_ids.astype(np.int32)def get_ax(rows=1, cols=1, size=8):"""Return a Matplotlib Axes array to be used inall visualizations in the notebook. Provide acentral point to control graph sizes.Change the default size attribute to control the sizeof rendered images"""_, ax = plt.subplots(rows, cols, figsize=(size * cols, size * rows))return ax#train与val数据集准备
dataset_train = DrugDataset()
dataset_train.load_shapes(count, img_floder, mask_floder, imglist,dataset_root_path)
dataset_train.prepare()print("dataset_train-->",dataset_train._image_ids)dataset_val = DrugDataset()
dataset_val.load_shapes(7, img_floder, mask_floder, imglist,dataset_root_path)
dataset_val.prepare()print("dataset_val-->",dataset_val._image_ids)# Load and display random samples
#image_ids = np.random.choice(dataset_train.image_ids, 4)
#for image_id in image_ids:
#    image = dataset_train.load_image(image_id)
#    mask, class_ids = dataset_train.load_mask(image_id)
#    visualize.display_top_masks(image, mask, class_ids, dataset_train.class_names)# Create model in training mode
model = modellib.MaskRCNN(mode="training", config=config,model_dir=MODEL_DIR)# Which weights to start with?
init_with = "coco"  # imagenet, coco, or lastif init_with == "imagenet":model.load_weights(model.get_imagenet_weights(), by_name=True)
elif init_with == "coco":# Load weights trained on MS COCO, but skip layers that# are different due to the different number of classes# See README for instructions to download the COCO weightsmodel.load_weights(COCO_MODEL_PATH, by_name=True,exclude=["mrcnn_class_logits", "mrcnn_bbox_fc","mrcnn_bbox", "mrcnn_mask"])
elif init_with == "last":# Load the last model you trained and continue trainingmodel.load_weights(model.find_last()[1], by_name=True)# Train the head branches
# Passing layers="heads" freezes all layers except the head
# layers. You can also pass a regular expression to select
# which layers to train by name pattern.
model.train(dataset_train, dataset_val,learning_rate=config.LEARNING_RATE,epochs=10,layers='heads')# Fine tune all layers
# Passing layers="all" trains all layers. You can also
# pass a regular expression to select which layers to
# train by name pattern.
model.train(dataset_train, dataset_val,learning_rate=config.LEARNING_RATE / 10,epochs=10,layers="all")

代码有3处需要修改的地方
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、预测数据

1. 训练完成后,会在根目录下生成logs文件夹,选择最后生成的训练模型

在这里插入图片描述

2. 根目录下创建预测脚本 model_test.py
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
import cv2
import time
from mrcnn.config import Config
from datetime import datetime import colorsys
from skimage.measure import find_contoursfrom PIL import Image# Root directory of the project
ROOT_DIR = os.getcwd()# Import Mask RCNN
sys.path.append(ROOT_DIR)  # To find local version of the library
from mrcnn import utils
import mrcnn.model as modellib
from mrcnn import visualize
# Import COCO config
sys.path.append(os.path.join(ROOT_DIR, "samples/coco/"))  # To find local version
from samples.coco import coco# Directory to save logs and trained model
MODEL_DIR = os.path.join(ROOT_DIR, "logs")
MODEL_WEIGHT = './logs/shapes20241122T2251/mask_rcnn_shapes_0010.h5'# 预测结果保存地址
OUTPUT_DIR = "./output_results"
if not os.path.exists(OUTPUT_DIR):os.makedirs(OUTPUT_DIR)# 获取待预测文件名称,用于保存同名文件
def get_last_part_of_string(path):return os.path.basename(path)# 需要预测的数据地址
IMAGE_DIR = os.path.join(ROOT_DIR, "datasets/demo2/pic")class ShapesConfig(Config):"""Configuration for training on the toy shapes dataset.Derives from the base Config class and overrides values specificto the toy shapes dataset."""# Give the configuration a recognizable nameNAME = "shapes"# os.path.exists()# Train on 1 GPU and 8 images per GPU. We can put multiple images on each# GPU because the images are small. Batch size is 8 (GPUs * images/GPU).GPU_COUNT = 1IMAGES_PER_GPU = 1# Number of classes (including background)NUM_CLASSES = 1 + 2  # background + 3 shapes# Use small images for faster training. Set the limits of the small side# the large side, and that determines the image shape.IMAGE_MIN_DIM = 320IMAGE_MAX_DIM = 384# Use smaller anchors because our image and objects are smallRPN_ANCHOR_SCALES = (8 * 6, 16 * 6, 32 * 6, 64 * 6, 128 * 6)  # anchor side in pixels# Reduce training ROIs per image because the images are small and have# few objects. Aim to allow ROI sampling to pick 33% positive ROIs.TRAIN_ROIS_PER_IMAGE =100# Use a small epoch since the data is simpleSTEPS_PER_EPOCH = 100# use small validation steps since the epoch is smallVALIDATION_STEPS = 50#import train_tongue
#class InferenceConfig(coco.CocoConfig):
class InferenceConfig(ShapesConfig):# Set batch size to 1 since we'll be running inference on# one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPUGPU_COUNT = 1IMAGES_PER_GPU = 1# 以下def函数从 mrcnn/visualize.py 中复制过来def apply_mask(image, mask, color, alpha=0.5):"""打上mask图标"""for c in range(3):image[:, :, c] = np.where(mask == 1,image[:, :, c] *(1 - alpha) + alpha * color[c] * 255,image[:, :, c])return imagedef random_colors(N, bright=True):"""生成随机颜色"""brightness = 1.0 if bright else 0.7hsv = [(i / N, 1, brightness) for i in range(N)]colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))return colors# 绘制结果
def display_instances(image, boxes, masks, class_ids, class_names, scores=None, filename="", title="",figsize=(16, 16),show_mask=True, show_bbox=True,colors=None, captions=None):# instance的数量N = boxes.shape[0]if not N:print("\n*** No instances to display *** \n")else:assert boxes.shape[0] == masks.shape[-1] == class_ids.shape[0]colors = colors or random_colors(N)# 当masked_image为原图时是在原图上绘制# 如果不想在原图上绘制,可以把masked_image设置成等大小的全0矩阵masked_image = np.array(image, np.uint8)for i in range(N):color = colors[i]# 该部分用于显示bboxif not np.any(boxes[i]):continuey1, x1, y2, x2 = boxes[i]# 绘制方形边界框if show_bbox:# 打印边界框坐标# print(f"Box {i + 1}: (x1, y1, x2, y2) = ({x1}, {y1}, {x2}, {y2})")cropped_image_rgb = image[y1:y2, x1:x2]image_bgr = cv2.cvtColor(cropped_image_rgb, cv2.COLOR_RGB2BGR)# cv2.rectangle(masked_image, (x1, y1), (x2, y2), (color[0] * 255, color[1] * 255, color[2] * 255), 2)# 该部分用于显示文字与置信度if not captions:class_id = class_ids[i]score = scores[i] if scores is not None else Nonelabel = class_names[class_id]caption = "{} {:.3f}".format(label, score) if score else labelelse:caption = captions[i]# 绘制文字(类别、分数)font = cv2.FONT_HERSHEY_SIMPLEXcv2.putText(masked_image, caption, (x1, y1 + 8), font, 0.5, (255, 255, 255), 1)# 绘制语义分割(遮挡物体面积部分)mask = masks[:, :, i]if show_mask:masked_image = apply_mask(masked_image, mask, color)# 画出语义分割的范围padded_mask = np.zeros((mask.shape[0] + 2, mask.shape[1] + 2), dtype=np.uint8)padded_mask[1:-1, 1:-1] = maskcontours = find_contours(padded_mask, 0.5)# 绘制边缘轮廓for verts in contours:verts = np.fliplr(verts) - 1cv2.polylines(masked_image, [np.array([verts], np.int)], 1,(color[0] * 255, color[1] * 255, color[2] * 255), 1)# 将绘制好的图片保存在制定文件夹中save_path = os.path.join(OUTPUT_DIR, filename)cv2.imwrite(save_path, masked_image)img = Image.fromarray(np.uint8(masked_image))return img# 加载配置
config = InferenceConfig()# 加载模型
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)#  加载权重
model.load_weights(MODEL_WEIGHT, by_name=True)# COCO Class names
# Index of the class in the list is its ID. For example, to get ID of
# the teddy bear class, use: class_names.index('teddy bear')
class_names = ['BG', 'danhe', 'linba']
# Load a random image from the images folder############################## 单张预测图片 ################################
# file_names = next(os.walk(IMAGE_DIR))[2]
# # 随机读取一张图片,进行预测
# image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
# # 当前图片名称
# filename = random.choice(file_names)# a=datetime.now() 
# # Run detection
# results = model.detect([image], verbose=1)
# b=datetime.now() 
# # Visualize results
# print("time:",(b-a).seconds)
# r = results[0]
# display_instances(image, r['rois'], r['masks'], r['class_ids'], class_names, r['scores'], filename)# # 获取物体数量
# num_objects = 0
# for roi, class_id, score, mask in zip(r['rois'],  r['class_ids'], r['scores'], r['masks']):
#     if score > 0.5:  # 设置置信度阈值
#         num_objects += 1# print('Number of objects detected:', num_objects)############################## 批量预测图片 ################################
count = os.listdir(IMAGE_DIR)for i in range(0,len(count)):path = os.path.join(IMAGE_DIR, count[i])if os.path.isfile(path):file_names = next(os.walk(IMAGE_DIR))[2]image = skimage.io.imread(os.path.join(IMAGE_DIR, count[i]))# Run detectionresults = model.detect([image], verbose=1)r = results[0]print('FileNmame: ',count[i])display_instances(image, r['rois'], r['masks'], r['class_ids'], class_names, r['scores'], count[i])

相关文章:

MaskRCNN训练自己的数据集

一. 数据标注 1. 安装labelme软件 conda install labelme2. 运行labelme # 命令行中直接输入 labelme3. 标注 二、训练数据处理 1. 在根目录下创建datasets/demo1文件夹,创建如下几个文件夹 2. 将标注好的.json文件放在json文件夹中 3. 原图放在pic文件夹中 4. …...

metawrap bin_refinement输入checkm数据库地址

这是运行metawrap bin_refinement -o bin_refinement -t 30 -A binning/metabat2_bins/ -B binning/maxbin2_bins/ -C binning/concoct_bins/ -c 50 -x 10 时遇到的报错(在命令行跑的时候遇到的) 参考metaGEM使用小记(解决各种问题)2024 2(三…...

Spring Web MVC其他扩展(详解下)

文章目录 Spring MVC其他扩展(下)异常处理异常处理机制声明式异常好处基于注解异常声明异常处理 拦截器拦截器概念拦截器使用拦截器作用位置图解拦截器案例拦截器工作原理源码 参数校验校验概述操作演示SpringMVC自定义参数验证ValueObject(VO) 文件上传…...

深度学习之 SegNet

可训练的图像分割引擎,包含一个encoder网络,一个对应的decoder网络,衔接像素级分类层,解码网络与VGG16的13层卷积层相同。解码网络是将低分辨率的编码特征图映射到全分辨率的特征图。解码网络使用最大池化层的池化索引进行非线性上…...

Taro React小程序开发框架 总结

目录 一、安装 二、目录结构 三、创建一个自定义页面 四、路由 1、API 2、传参 3、获取路由参数 4、设置TabBar 五、组件 六、API Taro非常好用的小程序框架,React开发者无缝衔接上。 一、安装 官方文档:Taro 文档 注意,项目创建…...

《Django 5 By Example》阅读笔记:p339-p358

《Django 5 By Example》学习第12天,p339-p358总结,总计20页。 一、技术总结 1.项目(购物网站) django-admin startproject myshop 虽然这里只是示例,但我觉得这种命名为 myxxx 的习惯非常不好,因为在实际应用中,是…...

CSS:Web美学的革新之旅

自HTML的诞生之日起,Web页面设计便踏上了一段不断进化的旅程。起初,HTML作为构建网页的骨架,仅承载着最基本的文本结构与少量显示属性。然而,随着互联网的蓬勃发展和用户对视觉体验需求的日益增长,HTML开始不堪重负&am…...

java全栈day10--后端Web基础(基础知识)之续集

一、Servlet执行流程 二、Http协议(相对Tomcat和servlet重要一点) 2.1Http-概叙 2.2Http-请求协议 2.2.3请求数据格式 2.2.3请求数据获取 先启动服务器 访问/hello Servlet 访问浏览器端Http协议数据 查看数据...

MySQL 与 MongoDB 存储差异分析

MySQL 与 MongoDB 存储差异分析:为什么随机生成数据的存储空间不同? 在实际应用中,我们常常需要选择合适的数据库系统来处理不同类型的数据。在这个过程中,数据库的 存储机制 和 性能优化 起着至关重要的作用。对于很多开发者来说…...

【ArcGIS Pro实操第10期】统计某个shp文件中不同区域内的站点数

统计某个shp文件中不同区域内的站点数 方法 1:使用“空间连接 (Spatial Join)”工具方法 2:使用“点计数 (Point Count)”工具方法 3:通过“选择 (Select by Location)”统计方法 4:通过“Python 脚本 (ArcPy)”实现参考 在 ArcGI…...

Django-Vue3-Admin - 现代化的前后端分离权限管理系统

项目介绍 Django-Vue3-Admin是一个基于RBAC(Role-Based Access Control)模型的综合性基础开发平台,专注于权限控制,支持列级别的细粒度权限管理。该项目采用前后端分离架构,技术栈包括: 后端: Django Django REST …...

【Java基础入门篇】二、控制语句和递归算法

Java基础入门篇 二、控制语句和递归算法 2.1 switch-case多分支选择语句 switch执行case语句块时,若没有遇到break,则运行下一个case直到遇到break,最后的default表示当没有case与之匹配时,默认执行的内容,代码示例如…...

PS的功能学习

背景差色较大,就魔棒 魔棒的连续就是倒水点的跨越问题 魔棒的容差的选择就有点看经验了,看颜色的统一程度选择 Ctrl D 取消当前所有的选区 至于快速选择工具,和对象选择工具也差不多,只不过控制范围变成了一块一块的&#x…...

yolov8的深度学习环境安装(cuda12.4、ubuntu22.04)

目录 一、先安装基础环境包 1.首先给Ubuntu安装Chrome浏览器(搜索引擎换成百度即可) 2、ubuntu 22.04中文输入法安装 3、安装 terminator 4、安装WPS for Linux 5、安装其它之前需要先安装anaconda 6、安装配置anaconda 7、安装完成anaconda后创建…...

《JavaEat:探索 Java 在美食世界的奇妙之旅》

在当今数字化的时代,编程语言的应用领域不断拓展,而 Java 作为一种广泛使用且功能强大的编程语言,其影响力早已超越了传统的软件开发范畴。当我们将目光聚焦在美食领域时,会惊喜地发现 Java 也能在其中发挥独特而重要的作用。本文…...

将excel文件中的信息读取后批量生成word文件

在日常办公过程中,可能需要把excel文件中的信息批量生成成百上千份word文档,便于打印、发邮件或存档等,比如根据excel中的合格人员招聘信息生成word合同文件,或是根据excel中的参会人员名单生成word参会通知等。 首先需要制作wor…...

Android 图形系统之三:SurfaceControl

在 Android 系统中,SurfaceControl 是一个关键的类,用于管理应用窗口和屏幕上的显示内容。它与 SurfaceFlinger 紧密交互,通过 BufferQueue 提供高效的图形缓冲区管理能力。SurfaceControl 是 Android 的显示架构中不可或缺的部分&#xff0c…...

Nodemailer使用教程:在Node.js中发送电子邮件

目录 1. 简介 2. 安装 3. 基本配置 3.1 创建传输器 3.2 配置说明 4. 发送邮件 4.1 基本发送示例 4.2 发送验证码示例 5. 常见问题解决 5.1 "Greeting never received" 错误 5.2 安全建议 SMTP与邮件加密协议详解 1. SMTP简介 1.1 基本特点 2. 加密协…...

shell第二次作业

1. 使用case实现成绩优良差的判断 read -p "请输入你的成绩:" score if ! [[ "$score" ~ ^[0-9]$ ]];then echo "请输入数字" exit 1 fi if [ "$score" -lt 0 ] || [ "$score" -gt 100 ];then echo …...

MySQL Linux 离线安装

下载 进入官网,下载对应的需要MySQL版本,这里是历史版本。 官网 选择第一个MySQL Community Sever社区版,因为这个是免费的。 选择需要的对应版本: 安装 1.将下载好的安装包上传到服务器端 使用FinalShell 客户端连接服务器 …...

万字长文解读深度学习——多模态模型BLIP2

🌺历史文章列表🌺 深度学习——优化算法、激活函数、归一化、正则化 深度学习——权重初始化、评估指标、梯度消失和梯度爆炸 深度学习——前向传播与反向传播、神经网络(前馈神经网络与反馈神经网络)、常见算法概要汇总 万字长…...

postman使用正则表达式提取数据实战篇!

之前篇章中postman多接口关联使用的是通过JSON提取器的方式进行提取。 除了JSON提取器提取数据外还可通过另一种方式——正则表达式来提取数据。 1、使用正则表达式提取器实现接口关联,match匹配 正则匹配表达式将需要提取的字段key:value都放入表达式中&#xff…...

Docker for Everyone Plus——Unbreakable!

修改一下telnet的端口配置,访问第二小问,sudo -l命令允许提权执行的命令: 发现多了这两个限制--security-optno-new-privileges,表明docker run命令必须带上--security-optno-new-privileges参数,这可以防止通过suid机…...

龙迅#LT6912适用于HDMI2.0转HDMI+LVDS/MIPI,分辨率高达4K60HZ,支持音频和HDCP2.2

1. 描述 LT6912是一款高性能的HDMI2.0转HDMI和LVDS和MIPI转换器。 HDMI2.0 输入和输出均支持高达 6Gbps 的数据速率,为4k60Hz视频提供足够的带宽。此外,还支持 HDCP2.2 进行数据解密(无数据 加密)。 对于 LVDS 输出&#xff0c…...

Linux自动化部署方法(Linux Automated Deployment Method)

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 本人主要分享计算机核心技…...

Jmeter测试工具的安装和使用,mac版本,jmeter版本5.2.1

Jmeter测试工具的安装和使用JSON格式请求 一、安装1、安装jdk包和设置java环境2、去官网下载Jmeter3、解压后,打开mac终端,进入apache-jmeter的bin文件开启jmeter 二、使用jmeter1、添加线程2、添加HTTP请求3、配置请求的协议、IP地址、端口号、请求方法…...

2024-2025 ICPC, NERC, Southern and Volga Russian Regional Contest(cf)(个人记录)

A: 思路&#xff1a;一开始有点懵逼&#xff0c;理解错题意了}&#xff0c; 由于是顺序分配&#xff0c;因此前面的人可以选择的条件更多&#xff0c;后面的人更少&#xff0c;我们从后向前遍历即可 #include<bits/stdc.h>using namespace std;typedef long long ll; ty…...

009 STM32 HAL库介绍

STM32 HAL库&#xff08;Hardware Abstraction Layer&#xff09;是STMicroelectronics为STM32系列微控制器提供的一套硬件抽象层库&#xff0c;它旨在简化STM32的开发过程&#xff0c;提高代码的可移植性和可维护性。HAL库通过提供一组统一的API接口&#xff0c;使得开发者无需…...

Java的常识

程序员分类 初级程序员(大学毕业一年以内)大概月薪:2-5K 初中级程序员(工作经验2-3年)大概月薪:6-10K 中级程序员(工作经验4-5年)大概月薪:10-15K 高级程序员(工作经验5++)大概月薪:15K++ 普通公司对于程序员的月薪资天花板25K 工作实景 微信小程序、手机APP、写…...

FreeRTOS——列表及列表项

目录 一、概念及其应用 1.1列表List_t 1.2列表项ListItem_t 1.3迷你列表项MiniListItem_t 二、相关API 三、实现原理 3.1列表初始化 3.2列表项初始化 3.3插入列表项 3.4尾插列表项 3.5列表项的删除 3.6列表的遍历 一、概念及其应用 作为多任务的核心&#xff0c;列…...

ChatGPT 网络安全秘籍(三)

第五章&#xff1a;安全意识和培训 在这一章中&#xff0c;我们将深入探讨网络安全培训和教育的迷人领域&#xff0c;强调了 OpenAI 的大型语言模型&#xff08;LLMs&#xff09;在增强和丰富这一关键过程中可以发挥的重要作用。我们将踏上一段旅程&#xff0c;发现 ChatGPT 如…...

深度学习与知识图谱嵌入的结合:从理论到实践

知识图谱嵌入方法主要包括两大类&#xff1a; 方法类型描述矩阵分解类方法基于传统矩阵分解思想&#xff0c;将知识图谱的三元组表示为多个矩阵&#xff0c;并通过分解获得低维向量表示。神经网络方法结合深度学习技术&#xff0c;通过神经网络自动学习知识图谱中实体和关系的…...

Java集成Sa-Token进行认证与授权

引言 软件开发过程中都必须要有的一个功能&#xff0c;那就是认证与授权&#xff0c;经过大佬们的不断更新迭代&#xff0c;使得如今实现认证与授权功能变得相对简单&#xff0c;也许你并不能真正的接触到认证与授权这一功能&#xff0c;除非你接触的项目是从0到1的&#xff0c…...

【附录】Rust国内镜像设置

目录 前言 &#xff08;1&#xff09;设置环境变量 &#xff08;2&#xff09;安装Rust &#xff08;3&#xff09;设置crates镜像 前言 本节课来介绍下如何在国内高速下载安装Rust和Rust依赖&#xff0c;由于网络原因&#xff0c;我们在安装Rust和下载项目依赖时都很慢&am…...

Rust编程语言代码详细运行、编译方法

以下是针对不同类型的 Rust 代码&#xff08;以常见的命令行程序为例&#xff09;详细的运行方法&#xff1a; 前提条件 在运行 Rust 代码之前&#xff0c;确保你已经在系统上安装了 Rust 编程语言环境。如果尚未安装&#xff0c;可以通过以下步骤进行安装&#xff1a; 访问…...

Unity ShaderLab 实现交互地毯

实现思路&#xff1a; 将一个位置坐标值传入到shader的顶点着色器中&#xff0c;和这个值位置相同的顶点沿着法线的y轴方向偏移&#xff0c;然后计算这个值与顶点的距离&#xff0c;在这个范围内的顶点&#xff0c;和凸起的点的位置做插值操作。 Shader Graph实现如下&#x…...

Scala模式匹配——高阶用法

&#xff08;一&#xff09;scala的模式匹配 &#xff08;1&#xff09;常量 &#xff08;2&#xff09;变量 &#xff08;3&#xff09;构造器 &#xff08;4&#xff09;序列 &#xff08;5&#xff09;元组 &#xff08;6&#xff09;类型 &#xff08;7&#xff09;…...

【简单好抄保姆级教学】javascript调用本地exe程序(谷歌,edge,百度,主流浏览器都可以使用....)

javascript调用本地exe程序 详细操作步骤结果 详细操作步骤 在本地创建一个txt文件依次输入 1.指明所使用注册表编程器版本 Windows Registry Editor Version 5.00这是脚本的第一行&#xff0c;指明了所使用的注册表编辑器版本。这是必需的&#xff0c;以确保脚本能够被正确解…...

C#热更原理与HybridCLR

一、Mono的诞生 在Mono之前,C#虽然很好,但是只在windows家族平台上使用,就这点C#与Java就无法比。于是微软公司向ECMA申请将C#作为一种标准。在2001年12月,ECMA发布了ECMA-334 C#语言规范。C#在2003年成为一个ISO标准(ISO/IEC 23270)。意味着只要你遵守CLI(Common Lang…...

arcgis for js点击聚合要素查询其包含的所有要素

功能说明 上一篇讲了实现聚合效果, 但是点击聚合效果无法获取到该聚合点包含的所有点信息 这一篇是对如何实现该功能的案例 实现 各属性说明需要自行去官网查阅 官网案例 聚合API 没空说废话了, 加班到12点,得休息了, 直接运行代码看效果就行, 相关重点和注意事项都在代码注…...

k8s Init:ImagePullBackOff 的解决方法

kubectl describe po (pod名字) -n kube-system 可查看pod所在的节点信息 例如&#xff1a; kubectl describe po calico-node-2lcxx -n kube-system 执行拉取前先把用到的节点的源换了 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-EOF {"re…...

HASH256开源代码计算错误问题

计算量超500KB报错 OTA升级中可能会涉及到CRC、hash校验等算法&#xff0c;小编从网上抄到了HASH256的源码&#xff0c;拿来使用的时候却发现了一个问题&#xff0c;当源文件约大于500KB的时候会发现其计算出的hash值出现错误。 经过实际测试得知&#xff0c;当源文件大于约50…...

对象流—ObjectInputStream 和 ObjectOutputStream

对象流(ObjectInputStream和ObjectOutputStream)是Java中用于读写对象的流&#xff0c;可以将对象直接写入到流中&#xff0c;或者从流中读取对象。 ObjectOutputStream将对象序列化为字节流&#xff0c;可以将对象写入文件或网络流中。ObjectInputStream则将字节流反序列化为…...

【Fargo】27:ffmpeg ffprobe 和python分析h264文件并绘制

从帧和包两个层面进行分析。帧级别分析 ffprobe 可以读取264文件信息 -Y9KP MINGW64 /d/XTRANS/thunderbolt/ayame/zhb-bifrost/player-only (main) $ ffprobe test.h264 ffprobe version N-116778-g7e4784e40c-20240827 Copyright (c) 2007-2024 the FFmpeg developersbuilt …...

Debezium Engine监听binlog实现缓存更新与业务解耦

飞书文档 解决缓存与数据源数据不一致的方案有很多, 各有优缺点; 1.0、旁路缓存策略, 直接同步更新 读取流程&#xff1a; 查询缓存。如果缓存命中&#xff0c;则直接返回结果。如果缓存未命中&#xff0c;则查询数据库。将数据库查询到的数据写入缓存&#xff0c;并设置一个…...

mysql_题库详解

1、如何创建和删除数据库&#xff1f; 1&#xff09;创建数据库 CREATE DATABASE 数据库名; 2&#xff09;删除数据库 drop database 数据库名; 2、MyISAM与InnoDB的区别&#xff1f; 1&#xff09;事务&#xff1a;MyISAM 不支持事务 InnoDB 支持 2&#xff09;行锁/表锁&a…...

docker查询是否运行

您可以通过运行以下命令来检查Docker是否正在运行&#xff1a; docker info 或者&#xff1a; docker ps 如果Docker正在运行&#xff0c;docker info将显示Docker的详细信息&#xff0c;而docker ps将列出当前运行的容器。如果Docker没有运行&#xff0c;这些命令将会返回错误…...

【AI日记】24.11.29 kaggle 比赛 Titanic-2 | 鼓励自己

【AI论文解读】【AI知识点】【AI小项目】【AI战略思考】【AI日记】 核心工作 内容&#xff1a;学习 kaggle 入门比赛 Titanic - Machine Learning from Disaster&#xff0c;学习机器学习课程备注&#xff1a;入门比赛有很多 notebook 适合我这种新手学习&#xff0c;尤其是那…...

SVG无功补偿装置MATLAB仿真模型

“电气仔推送”获得资料&#xff08;专享优惠&#xff09; 模型简介 SVG&#xff08;又称ASVG 或STATCOM&#xff09;是Static Var Generator 的缩写&#xff0c;叫做静止无功发生器。也是做无功补偿的&#xff0c;比SVC 更加先进。其基本原理是将自换相桥式电路通过电抗器或…...

2039:【例5.6】冒泡排序

【题目描述】 编程输入n(1≤n≤20)个小于1000非负整数&#xff0c;然后自动按从大到小的顺序输出。&#xff08;冒泡排序&#xff09; 【输入】 第一行&#xff0c;数的个数n; 第二行&#xff0c;n个非负整数。 【输出】 由大到小的n个非负整数&#xff0c;每个数占一行。 【输…...