基于YOLOv5模型的火焰识别系统
大家好,YOLOv5模型能够快速准确地检测到火灾火焰,在火灾初期甚至是刚刚出现火苗时就发出警报。这为及时采取灭火措施争取了宝贵的时间,极大地降低了火灾造成的损失。系统可以对特定区域进行持续实时监测,无论白天还是夜晚,都能及时察觉火灾的发生。相比传统的人工巡检或基于传感器的检测方法,具有更高的时效性和可靠性。本文将介绍基YOLOv5模型的火灾火焰检测系统,涵盖准备工作、模型训练等方面。
1.准备工作
在PC机上配置环境,即正常按照requirements安装依赖包,根据实际情况可以自身爬取图片。通过网上的资料下载相关数据集,大部分数据集是无标注的数据集。如下载的数据集无标注,那么使用lableImg进行标注,且将标注文件的保存格式设置为PascalVOC的类型,即xml格式的label文件,而后通过脚本将标签格式转换为.txt文件,并在文件上添加类别信息和对数据进行归一化。脚本脚本代码如下:
import os
import xml.etree.ElementTree as ET
from decimal import Decimaldirpath = '/home/jiu/data_change/label_0' # 原来存放xml文件的目录
newdir = '/home/jiu/data_change/labels' # 修改label后形成的txt目录if not os.path.exists(newdir):os.makedirs(newdir)for fp in os.listdir(dirpath):root = ET.parse(os.path.join(dirpath, fp)).getroot()xmin, ymin, xmax, ymax = 0, 0, 0, 0sz = root.find('size')width = float(sz[0].text)height = float(sz[1].text)filename = root.find('filename').textprint(fp)with open(os.path.join(newdir, fp.split('.')[0] + '.txt'), 'a+') as f:for child in root.findall('object'): # 找到图片中的所有框sub = child.find('bndbox') # 找到框的标注值并进行读取sub_label = child.find('name')xmin = float(sub[0].text)ymin = float(sub[1].text)xmax = float(sub[2].text)ymax = float(sub[3].text)try: # 转换成yolov的标签格式,需要归一化到(0-1)的范围内x_center = Decimal(str(round(float((xmin + xmax) / (2 * width)),6))).quantize(Decimal('0.000000'))y_center = Decimal(str(round(float((ymin + ymax) / (2 * height)),6))).quantize(Decimal('0.000000'))w = Decimal(str(round(float((xmax - xmin) / width),6))).quantize(Decimal('0.000000'))h = Decimal(str(round(float((ymax - ymin) / height),6))).quantize(Decimal('0.000000'))print(str(x_center) + ' ' + str(y_center)+ ' '+str(w)+ ' '+str(h))#读取需要的标签if sub_label.text == 'fire':f.write(' '.join([str(0), str(x_center), str(y_center), str(w), str(h) + '\n']))except ZeroDivisionError:print(filename, '的 width有问题')
此处提供本人所使用的火焰数据集,该数据集一共2059张带火焰的图片,并将其分为训练集和测试集,其中训练集1442张,测试集617张;同样的将label也分为训练集和测试集,其图片和其label相对应。
txt标签:
2.项目实现
对配置文件修改,新建一个.yaml文件,在其中添加(根据实际情况修改文件路径):
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: D:\a\fire_yolo_format\images\train
val: D:\a\fire_yolo_format\images\val# number of classes
nc: 2# class names
names: ['fire', 'nofire']
在train.py的parse_opt()函数中,修改’–weights’、‘–data’、'–imgsz’等配置,其如下所示:
def parse_opt(known=False):parser = argparse.ArgumentParser()parser.add_argument('--weights', type=str, default=ROOT / 'pretrained/yolov5s.pt', help='initial weights path')parser.add_argument('--cfg', type=str, default=ROOT / 'models/yolov5s.yaml', help='model.yaml path')parser.add_argument('--data', type=str, default=ROOT / 'data/data.yaml', help='dataset.yaml path')parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch.yaml', help='hyperparameters path')parser.add_argument('--epochs', type=int, default=300)parser.add_argument('--batch-size', type=int, default=4, help='total batch size for all GPUs, -1 for autobatch')parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)')parser.add_argument('--rect', action='store_true', help='rectangular training')parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')parser.add_argument('--noval', action='store_true', help='only validate final epoch')parser.add_argument('--noautoanchor', action='store_true', help='disable autoanchor check')parser.add_argument('--evolve', type=int, nargs='?', const=300, help='evolve hyperparameters for x generations')parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')parser.add_argument('--cache', type=str, nargs='?', const='ram', help='--cache images in "ram" (default) or "disk"')parser.add_argument('--image-weights', action='store_true', help='use weighted image selection for training')parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')# parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%')parser.add_argument('--multi-scale', default=True, help='vary img-size +/- 50%%')parser.add_argument('--single-cls', action='store_true', help='train multi-class data as single-class')parser.add_argument('--adam', action='store_true', help='use torch.optim.Adam() optimizer')parser.add_argument('--sync-bn', action='store_true', help='use SyncBatchNorm, only available in DDP mode')parser.add_argument('--workers', type=int, default=0, help='max dataloader workers (per RANK in DDP mode)')parser.add_argument('--project', default=ROOT / 'runs/train', help='save to project/name')parser.add_argument('--name', default='exp', help='save to project/name')parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')parser.add_argument('--quad', action='store_true', help='quad dataloader')parser.add_argument('--linear-lr', action='store_true', help='linear LR')parser.add_argument('--label-smoothing', type=float, default=0.0, help='Label smoothing epsilon')parser.add_argument('--patience', type=int, default=100, help='EarlyStopping patience (epochs without improvement)')parser.add_argument('--freeze', type=int, default=0, help='Number of layers to freeze. backbone=10, all=24')parser.add_argument('--save-period', type=int, default=-1, help='Save checkpoint every x epochs (disabled if < 1)')parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify')# Weights & Biases argumentsparser.add_argument('--entity', default=None, help='W&B: Entity')parser.add_argument('--upload_dataset', action='store_true', help='W&B: Upload dataset as artifact table')parser.add_argument('--bbox_interval', type=int, default=-1, help='W&B: Set bounding-box image logging interval')parser.add_argument('--artifact_alias', type=str, default='latest', help='W&B: Version of dataset artifact to use')opt = parser.parse_known_args()[0] if known else parser.parse_args()return opt
’–weights’:添加yolov5的预训练权重文件,此处使用的是yolov5s.pt。如使用其他预训练权重文件,则在val.py中也应当相应修改
‘–data’:数据集的配置文件,即上面定义的.yaml文件
‘–imgsz’:输入图片的大小
在detect.py的parse_opt()函数中,同样修改’–weights’、‘–source’、'–imgsz’等配置,其如下所示:
def parse_opt():parser = argparse.ArgumentParser()parser.add_argument('--weights', nargs='+', type=str, default=ROOT / 'yolov5s.pt', help='model path(s)')parser.add_argument('--source', type=str, default=ROOT / 'data/images', help='file/dir/URL/glob, 0 for webcam')parser.add_argument('--imgsz', '--img', '--img-size', nargs='+', type=int, default=[640], help='inference size h,w')parser.add_argument('--conf-thres', type=float, default=0.5, help='confidence threshold')parser.add_argument('--iou-thres', type=float, default=0.45, help='NMS IoU threshold')parser.add_argument('--max-det', type=int, default=1000, help='maximum detections per image')parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')parser.add_argument('--view-img', action='store_true', help='show results')parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')parser.add_argument('--save-crop', action='store_true', help='save cropped prediction boxes')parser.add_argument('--nosave', action='store_true', help='do not save images/videos')parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --classes 0, or --classes 0 2 3')parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')parser.add_argument('--augment', action='store_true', help='augmented inference')parser.add_argument('--visualize', action='store_true', help='visualize features')parser.add_argument('--update', action='store_true', help='update all models')parser.add_argument('--project', default=ROOT / 'runs/detect', help='save results to project/name')parser.add_argument('--name', default='exp', help='save results to project/name')parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')parser.add_argument('--line-thickness', default=3, type=int, help='bounding box thickness (pixels)')parser.add_argument('--hide-labels', default=False, action='store_true', help='hide labels')parser.add_argument('--hide-conf', default=False, action='store_true', help='hide confidences')parser.add_argument('--half', action='store_true', help='use FP16 half-precision inference')parser.add_argument('--dnn', action='store_true', help='use OpenCV DNN for ONNX inference')opt = parser.parse_args()opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expandprint_args(FILE.stem, opt)return opt
即’–weights’:添加训练好的权重文件
‘–source’:测试图片的路径或测试视频的路径
‘–imgsz’:输入图片的大小
3.训练与测试
如在pycharm中运行,可直接运行train.py文件;如使用终端运行,则运行指令为:
python train.py --img 320 --batch 16 --epoch 300 --data data/coco128.yaml --cfg models/yolov5s.yaml --weights weights/yolov5s.pt --device '0'
图片测试:
# -*- coding: UTF-8 -*-
import time
import cv2
import torch
import copy
from models.experimental import attempt_load
from utils.datasets import letterbox
from utils.general import check_img_size, non_max_suppression, scale_coords, xyxy2xywhdef load_model(weights, device):model = attempt_load(weights, map_location=device) # load FP32 modelreturn modeldef show_results(img, xywh, conf, class_num):h, w, c = img.shapelabels = ['fire']tl = 1 or round(0.002 * (h + w) / 2) + 1 # line/font thicknessx1 = int(xywh[0] * w - 0.5 * xywh[2] * w)y1 = int(xywh[1] * h - 0.5 * xywh[3] * h)x2 = int(xywh[0] * w + 0.5 * xywh[2] * w)y2 = int(xywh[1] * h + 0.5 * xywh[3] * h)cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), thickness=tl, lineType=cv2.LINE_AA)tf = max(tl - 1, 1) # font thicknesslabel = str(labels[int(class_num)]) + ': ' + str(conf)[:5]cv2.putText(img, label, (x1, y1 - 2), 0, tl / 3, [0, 0, 255], thickness=tf, lineType=cv2.LINE_AA)return imgdef detect_one(model, image_path, device):# Load modelimg_size = 320conf_thres = 0.3iou_thres = 0.2orgimg = cv2.imread(image_path) # BGR# orgimg = image_pathimg0 = copy.deepcopy(orgimg)assert orgimg is not None, 'Image Not Found ' + image_pathh0, w0 = orgimg.shape[:2] # orig hwr = img_size / max(h0, w0) # resize image to img_sizeif r != 1: # always resize down, only resize up if training with augmentationinterp = cv2.INTER_AREA if r < 1 else cv2.INTER_LINEARimg0 = cv2.resize(img0, (int(w0 * r), int(h0 * r)), interpolation=interp)imgsz = check_img_size(img_size, s=model.stride.max()) # check img_sizeimg = letterbox(img0, new_shape=imgsz)[0]# Convertimg = img[:, :, ::-1].transpose(2, 0, 1).copy() # BGR to RGB, to 3x416x416# Run inferencet0 = time.time()img = torch.from_numpy(img).to(device)img = img.float() # uint8 to fp16/32img /= 255.0 # 0 - 255 to 0.0 - 1.0if img.ndimension() == 3:img = img.unsqueeze(0)# Inferencepred = model(img)[0]# Apply NMSpred = non_max_suppression(pred, conf_thres, iou_thres)print('pred: ', pred)print('img.shape: ', img.shape)print('orgimg.shape: ', orgimg.shape)# Process detectionsfor i, det in enumerate(pred): # detections per imagegn = torch.tensor(orgimg.shape)[[1, 0, 1, 0]].to(device) # normalization gain whwhif len(det):# Rescale boxes from img_size to im0 sizedet[:, :4] = scale_coords(img.shape[2:], det[:, :4], orgimg.shape).round()# Print resultsfor c in det[:, -1].unique():n = (det[:, -1] == c).sum() # detections per classfor j in range(det.size()[0]):xywh = (xyxy2xywh(torch.tensor(det[j, :4]).view(1, 4)) / gn).view(-1).tolist()conf = det[j, 4].cpu().numpy()class_num = det[j, 4].cpu().numpy()orgimg = show_results(orgimg, xywh, conf, class_num)# Stream resultsprint(f'Done. ({time.time() - t0:.3f}s)')cv2.imshow('orgimg', orgimg)cv2.imwrite('filename.jpg',orgimg)if cv2.waitKey(0) == ord('q'): # q to quitraise StopIterationif __name__ == '__main__':device = torch.device("cuda" if torch.cuda.is_available() else "cpu")weights = '/home/jiu/project/fire_detect/runs/train/exp/weights/best.pt'model = load_model(weights, device)# using imagesimage_path = '/home/jiu/project/fire_detect/test_images/1.jpg'detect_one(model, image_path, device)print('over')
运行结果:
摄像头测试:
# -*- coding: UTF-8 -*-
import time
import cv2
import torch
import copy
from models.experimental import attempt_load
from utils.datasets import letterbox
from utils.general import check_img_size, non_max_suppression, scale_coords, xyxy2xywhdef load_model(weights, device):model = attempt_load(weights, map_location=device) # load FP32 modelreturn modeldef show_results(img, xywh, conf, class_num):h, w, c = img.shapelabels = ['fire']tl = 1 or round(0.002 * (h + w) / 2) + 1 # line/font thicknessx1 = int(xywh[0] * w - 0.5 * xywh[2] * w)y1 = int(xywh[1] * h - 0.5 * xywh[3] * h)x2 = int(xywh[0] * w + 0.5 * xywh[2] * w)y2 = int(xywh[1] * h + 0.5 * xywh[3] * h)cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), thickness=tl, lineType=cv2.LINE_AA)tf = max(tl - 1, 1) # font thicknesslabel = str(labels[int(class_num)]) + ': ' + str(conf)[:5]cv2.putText(img, label, (x1, y1 - 2), 0, tl / 3, [0, 0, 255], thickness=tf, lineType=cv2.LINE_AA)return imgdef detect_one(model, image_path, device):# Load modelimg_size = 320conf_thres = 0.3iou_thres = 0.2orgimg = image_pathimg0 = copy.deepcopy(orgimg)assert orgimg is not None, 'Image Not Found ' + image_pathh0, w0 = orgimg.shape[:2] # orig hwr = img_size / max(h0, w0) # resize image to img_sizeif r != 1: # always resize down, only resize up if training with augmentationinterp = cv2.INTER_AREA if r < 1 else cv2.INTER_LINEARimg0 = cv2.resize(img0, (int(w0 * r), int(h0 * r)), interpolation=interp)imgsz = check_img_size(img_size, s=model.stride.max()) # check img_sizeimg = letterbox(img0, new_shape=imgsz)[0]# Convertimg = img[:, :, ::-1].transpose(2, 0, 1).copy() # BGR to RGB, to 3x416x416# Run inferencet0 = time.time()img = torch.from_numpy(img).to(device)img = img.float() # uint8 to fp16/32img /= 255.0 # 0 - 255 to 0.0 - 1.0if img.ndimension() == 3:img = img.unsqueeze(0)# Inferencepred = model(img)[0]# Apply NMSpred = non_max_suppression(pred, conf_thres, iou_thres)print('pred: ', pred)print('img.shape: ', img.shape)print('orgimg.shape: ', orgimg.shape)# Process detectionsfor i, det in enumerate(pred): # detections per imagegn = torch.tensor(orgimg.shape)[[1, 0, 1, 0]].to(device) # normalization gain whwhif len(det):# Rescale boxes from img_size to im0 sizedet[:, :4] = scale_coords(img.shape[2:], det[:, :4], orgimg.shape).round()# Print resultsfor c in det[:, -1].unique():n = (det[:, -1] == c).sum() # detections per classfor j in range(det.size()[0]):xywh = (xyxy2xywh(torch.tensor(det[j, :4]).view(1, 4)) / gn).view(-1).tolist()conf = det[j, 4].cpu().numpy()class_num = det[j, 4].cpu().numpy()orgimg = show_results(orgimg, xywh, conf, class_num)# Stream resultsprint(f'Done. ({time.time() - t0:.3f}s)')return orgimgif __name__ == '__main__':device = torch.device("cuda" if torch.cuda.is_available() else "cpu")weights = '/home/jiu/project/fire_detect/runs/train/exp/weights/best.pt'model = load_model(weights, device)# using cameracap = cv2.VideoCapture(0)while cap.isOpened():_, frame = cap.read()frame = detect_one(model, frame, device)cv2.imshow("img", frame)cv2.waitKey(1)print('over')
相关文章:

基于YOLOv5模型的火焰识别系统
大家好,YOLOv5模型能够快速准确地检测到火灾火焰,在火灾初期甚至是刚刚出现火苗时就发出警报。这为及时采取灭火措施争取了宝贵的时间,极大地降低了火灾造成的损失。系统可以对特定区域进行持续实时监测,无论白天还是夜晚…...

多模态AI:开启人工智能的新纪元
在人工智能的璀璨星河中,多模态AI技术正逐渐成为一颗耀眼的明星。随着科技的飞速发展,AI技术正以前所未有的速度迈向新的高峰,其中多模态AI的兴起尤为引人注目。本文将深入探讨多模态AI的定义、技术原理、应用场景以及未来发展趋势。 ps.图…...

麒麟信安支撑2024年电力监控系统网络安全加固培训护航电力网络安全!
在网络安全形势日益复杂的今天,电力行业的网络安全尤为重要。为提升电力监控系统网络安全运维人员的专业技能,由国调中心网安处精心策划,国家电网技术学院组织开展的“2024年电力监控系统网络安全加固培训”于近日圆满结束。麒麟信安作为重要…...

横表和纵表 中的横表
图1 图2...

7个常用的JavaScript数组操作进阶用法
文章目录 1、查找数组中的最大值方法一:使用 Math.max 和展开运算符方法二:使用 for 循环逐一比较 2、查找数组中的第二大值方法一:排序后取第二大值方法二:遍历找到第二大值 3、去除数组中的重复项4、合并两个有序数组并保持有序5、旋转数组…...

Spark的Standalone集群环境安装
一.简介 与MR对比: 概念MRYARNSpark Standalone主节点ResourceManagerMaster从节点NodeManagerWorker计算进程MapTask,ReduceTaskExecutor 架构:普通分布式主从架构 主:Master:管理节点:管理从节点、接…...
Android Glide动态apply centerCropTransform(),transition withCrossFade动画,Kotlin
Android Glide动态apply centerCropTransform(),transition withCrossFade动画,Kotlin import android.graphics.Bitmap import android.os.Bundle import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import com.bumptech.glide.Glide import …...

shukla方差和相对平均偏差
参考资料:实用统计学【李奉令】 Eberhart-Russell模型、Shukla模型、相对平均偏差稳定性分析比较 相对平均偏差在品种稳定性分析中的作用 1、Shukla方差 生物统计中,用于描述一个群体离散程度的统计量有离差、方差、极差等, 国内品种区域试…...

双指针(二)双指针到底是怎么个事
一.有效的三角形个数 有效的三角形个数 class Solution {public int triangleNumber(int[] nums) {Arrays.sort(nums);int i0,end nums.length-1;int count 0;for( i end;i>2;i--){int left 0;int right i-1;while(left<right){if(nums[left]nums[right]>nums…...

vscode通过remote-ssh连接远程开发机
文章目录 安装扩展注意事项:tips其他参数安装扩展 安装VS Code和SSH-Remote扩展:首先,需要确保你已经在本地计算机上安装了VS Code,并且在扩展市场中搜索并安装了"Remote - SSH"扩展。配置SSH:在本地计算机上,打开VS Code的命令面板(使用快捷键"Ctrl+Shi…...

uniapp实现H5和微信小程序获取当前位置(腾讯地图)
之前的一个老项目,使用 uniapp 的 uni.getLocation 发现H5端定位不准确,比如余杭区会定位到临平区,根据官方文档初步判断是项目的uniapp的版本太低。 我选择的方式不是区更新uniapp的版本,是直接使用高德地图的api获取定位。 1.首…...

SQL HAVING子句
SQL 是一种基于“面向集合”思想设计的语言。HAVING 子句是一个聚合函数,用于过滤分组结果。 1 实践 1.1 缺失的编号 图 连续编号记录表t_seq_record 需求:判断seq 列编号是否有缺失。 SELECT 存在缺失的编号 AS res FROM t_seq_record HAVING COUN…...
计算机视觉基础:OpenCV库详解
💓 博客主页:瑕疵的CSDN主页 📝 Gitee主页:瑕疵的gitee主页 ⏩ 文章专栏:《热点资讯》 计算机视觉基础:OpenCV库详解 计算机视觉基础:OpenCV库详解 计算机视觉基础:OpenCV库详解 引…...

UI自动化测试工具(超详细总结)
🍅 点击文末小卡片 ,免费获取软件测试全套资料,资料在手,涨薪更快 常用工具 1、QTP:商业化的功能测试工具,收费,可用于web自动化测试 2、Robot Framework:基于Python可扩展的关…...

AJAX 全面教程:从基础到高级
AJAX 全面教程:从基础到高级 目录 什么是 AJAXAJAX 的工作原理AJAX 的主要对象AJAX 的基本用法AJAX 与 JSONAJAX 的高级用法AJAX 的错误处理AJAX 的性能优化AJAX 的安全性AJAX 的应用场景总结与展望 什么是 AJAX AJAX(Asynchronous JavaScript and XML…...

ONLYOFFICE 8.2测评:功能增强与体验优化,打造高效办公新体验
引言 随着数字化办公需求的不断增长,在线办公软件市场竞争愈加激烈。在众多办公软件中,ONLYOFFICE 无疑是一个颇具特色的选择。它不仅支持文档、表格和演示文稿的在线编辑,还通过开放的接口与强大的协作功能,吸引了众多企业和个人…...

Science Robotics 综述揭示演化研究新范式,从机器人复活远古生物!
在地球46亿年的漫长历史长河中,生命的演化过程充满着未解之谜。如何从零散的化石证据中还原古生物的真实面貌?如何理解关键演化节点的具体过程?10月23日,Science Robotics发表重磅综述,首次系统性提出"古生物启发…...
uni-app表格带分页,后端处理过每页显示多少条
uni-app表格带分页,后端处理过每页可以显示多少条,一句设置好了每页显示的数据量,不需要钱的在进行操作,在进行对数据的截取 <th-table :column"column" :listData"data" :checkSort"checkSort"…...
基于STM32设计的矿山环境监测系统(NBIOT)_262
文章目录 一、前言1.1 项目介绍【1】开发背景【2】研究的意义【3】最终实现需求【4】项目硬件模块组成1.2 设计思路【1】整体设计思路【2】上位机开发思路1.3 项目开发背景【1】选题的意义【2】摘要【3】国内外相关研究现状【5】参考文献1.4 开发工具的选择【1】设备端开发【2】…...

【初阶数据结构与算法】线性表之链表的分类以及双链表的定义与实现
文章目录 一、链表的分类二、双链表的实现1.双链表结构的定义2.双链表的初始化和销毁初始化函数1初始化函数2销毁函数 3.双链表的打印以及节点的申请打印函数节点的申请 4.双链表的头插和尾插头插函数尾插函数 5.双链表的查找和判空查找函数判空函数 6.双链表的头删和尾删头删函…...

《Qt C++ 与 OpenCV:解锁视频播放程序设计的奥秘》
引言:探索视频播放程序设计之旅 在当今数字化时代,多媒体应用已渗透到我们生活的方方面面,从日常的视频娱乐到专业的视频监控、视频会议系统,视频播放程序作为多媒体应用的核心组成部分,扮演着至关重要的角色。无论是在个人电脑、移动设备还是智能电视等平台上,用户都期望…...

React第五十七节 Router中RouterProvider使用详解及注意事项
前言 在 React Router v6.4 中,RouterProvider 是一个核心组件,用于提供基于数据路由(data routers)的新型路由方案。 它替代了传统的 <BrowserRouter>,支持更强大的数据加载和操作功能(如 loader 和…...
电脑插入多块移动硬盘后经常出现卡顿和蓝屏
当电脑在插入多块移动硬盘后频繁出现卡顿和蓝屏问题时,可能涉及硬件资源冲突、驱动兼容性、供电不足或系统设置等多方面原因。以下是逐步排查和解决方案: 1. 检查电源供电问题 问题原因:多块移动硬盘同时运行可能导致USB接口供电不足&#x…...

多种风格导航菜单 HTML 实现(附源码)
下面我将为您展示 6 种不同风格的导航菜单实现,每种都包含完整 HTML、CSS 和 JavaScript 代码。 1. 简约水平导航栏 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport&qu…...

Yolov8 目标检测蒸馏学习记录
yolov8系列模型蒸馏基本流程,代码下载:这里本人提交了一个demo:djdll/Yolov8_Distillation: Yolov8轻量化_蒸馏代码实现 在轻量化模型设计中,**知识蒸馏(Knowledge Distillation)**被广泛应用,作为提升模型…...

使用Spring AI和MCP协议构建图片搜索服务
目录 使用Spring AI和MCP协议构建图片搜索服务 引言 技术栈概览 项目架构设计 架构图 服务端开发 1. 创建Spring Boot项目 2. 实现图片搜索工具 3. 配置传输模式 Stdio模式(本地调用) SSE模式(远程调用) 4. 注册工具提…...
MySQL 8.0 事务全面讲解
以下是一个结合两次回答的 MySQL 8.0 事务全面讲解,涵盖了事务的核心概念、操作示例、失败回滚、隔离级别、事务性 DDL 和 XA 事务等内容,并修正了查看隔离级别的命令。 MySQL 8.0 事务全面讲解 一、事务的核心概念(ACID) 事务是…...

Ubuntu系统复制(U盘-电脑硬盘)
所需环境 电脑自带硬盘:1块 (1T) U盘1:Ubuntu系统引导盘(用于“U盘2”复制到“电脑自带硬盘”) U盘2:Ubuntu系统盘(1T,用于被复制) !!!建议“电脑…...
pycharm 设置环境出错
pycharm 设置环境出错 pycharm 新建项目,设置虚拟环境,出错 pycharm 出错 Cannot open Local Failed to start [powershell.exe, -NoExit, -ExecutionPolicy, Bypass, -File, C:\Program Files\JetBrains\PyCharm 2024.1.3\plugins\terminal\shell-int…...

WebRTC调研
WebRTC是什么,为什么,如何使用 WebRTC有什么优势 WebRTC Architecture Amazon KVS WebRTC 其它厂商WebRTC 海康门禁WebRTC 海康门禁其他界面整理 威视通WebRTC 局域网 Google浏览器 Microsoft Edge 公网 RTSP RTMP NVR ONVIF SIP SRT WebRTC协…...