YOLO11改进-模块-引入Histogram Transformer Block(HTB)解决恶劣天气(雨雾雪)

本篇文章将介绍一个新的改进机制——HTB,并阐述如何将其应用于YOLOv11中,显著提升模型性能。在现代计算机视觉任务中,尤其是在目标检测领域,YOLO系列模型因其快速和准确的检测性能而备受关注。随着YOLOv11的提出,我们迎来了更强大的特征提取能力和更高效的检测架构。然而,如何在复杂的天气条件下(如雨、雾、雪)保持高质量的检测结果仍然是一个挑战。为了解决这一问题,我们尝试将Histogram Transformer Block(HTB)与YOLOv11结合,以提高模型在天气退化图像上的鲁棒性和检测性能。

1. Histogram Transformer Block(HTB)结构介绍  

      Histogram Transformer Block(HTB)是一个专门为解决恶劣天气图像退化问题设计的模块,其核心思想是利用动态范围直方图自注意力机制来对图像中的退化区域进行有效处理。HTB是Histoformer模型的关键组成部分,主要包括两个模块:动态范围直方图自注意力(DHSA)双尺度门控前馈网络(DGFF),它们共同用于从受天气影响的图像中提取特征。

  1. 动态范围直方图自注意力(DHSA)

    • 直方图分类:根据像素的强度值将其分类到不同的直方图箱中,从而在这些强度基础的箱内和箱间应用自注意力机制。这种方法提高了注意力机制,使其能够集中关注具有相似退化模式的区域(例如,雨、雾或雪造成的影响)。
    • 动态范围卷积:在应用注意力之前,通过对特征进行垂直和水平排序来重新组织空间特征。这种重组方式使卷积操作能够更好地关注动态分布的退化模式,而不是固定的邻近像素。
  2. 双尺度门控前馈网络(DGFF)

    • DGFF模块集成了两条独立的多尺度和多范围深度卷积路径,以增强特征提取能力。在特征转换过程中,使用5×5和膨胀3×3的深度卷积来提取多范围和多尺度信息。通过门控机制,将第二个分支的输出作为另一个分支的门控图,从而实现特征融合。

2. YOLOv11与HTB的结合

        1.  backbone引入:我们在YOLOv11的主干网络中C2PSA模块中插入DHSA模块,以代替传统的attention。使其能够集中关注具有相似退化模式的区域(例如,雨、雾或雪造成的影响)。

        2.  backbone引入:  我们在YOLOv11的主干网络中C2PSA模块中插入HTB模块,以代替传统的PSABlock。通过结合动态范围卷积和双分支直方图自注意力,有效地建模了长距离空间特征,使得模型在去除天气退化时表现出更好的性能。

        3.  head引入:在YOLOv11的预测头部分,我们引入HTB,使得预测头能够更有效地聚焦于退化区域中的重要目标,提升检测精度。

3. Histogram Transformer Block(HTB)代码部分

import numbers
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrangefrom .block import  PSABlock, C2PSAConv2d = nn.Conv2d## Layer Norm
def to_2d(x):return rearrange(x, 'b c h w -> b (h w c)')def to_3d(x):
#    return rearrange(x, 'b c h w -> b c (h w)')return rearrange(x, 'b c h w -> b (h w) c')def to_4d(x,h,w):
#    return rearrange(x, 'b c (h w) -> b c h w',h=h,w=w)return rearrange(x, 'b (h w) c -> b c h w',h=h,w=w)class BiasFree_LayerNorm(nn.Module):def __init__(self, normalized_shape):super(BiasFree_LayerNorm, self).__init__()if isinstance(normalized_shape, numbers.Integral):normalized_shape = (normalized_shape,)normalized_shape = torch.Size(normalized_shape)assert len(normalized_shape) == 1self.normalized_shape = normalized_shapedef forward(self, x):sigma = x.var(-1, keepdim=True, unbiased=False)return x / torch.sqrt(sigma+1e-5) #* self.weightclass WithBias_LayerNorm(nn.Module):def __init__(self, normalized_shape):super(WithBias_LayerNorm, self).__init__()if isinstance(normalized_shape, numbers.Integral):normalized_shape = (normalized_shape,)normalized_shape = torch.Size(normalized_shape)assert len(normalized_shape) == 1self.normalized_shape = normalized_shapedef forward(self, x):mu = x.mean(-1, keepdim=True)sigma = x.var(-1, keepdim=True, unbiased=False)return (x - mu) / torch.sqrt(sigma+1e-5) #* self.weight + self.biasclass LayerNorm(nn.Module):def __init__(self, dim, LayerNorm_type="WithBias"):super(LayerNorm, self).__init__()if LayerNorm_type =='BiasFree':self.body = BiasFree_LayerNorm(dim)else:self.body = WithBias_LayerNorm(dim)def forward(self, x):h, w = x.shape[-2:]return to_4d(self.body(to_3d(x)), h, w)
##########################################################################
## Dual-scale Gated Feed-Forward Network (DGFF)
class FeedForward(nn.Module):def __init__(self, dim, ffn_expansion_factor, bias):super(FeedForward, self).__init__()hidden_features = int(dim * ffn_expansion_factor)self.project_in = Conv2d(dim, hidden_features * 2, kernel_size=1, bias=bias)self.dwconv_5 = Conv2d(hidden_features // 4, hidden_features // 4, kernel_size=5, stride=1, padding=2,groups=hidden_features // 4, bias=bias)self.dwconv_dilated2_1 = Conv2d(hidden_features // 4, hidden_features // 4, kernel_size=3, stride=1, padding=2,groups=hidden_features // 4, bias=bias, dilation=2)self.p_unshuffle = nn.PixelUnshuffle(2)self.p_shuffle = nn.PixelShuffle(2)self.project_out = Conv2d(hidden_features, dim, kernel_size=1, bias=bias)def forward(self, x):x = self.project_in(x)x = self.p_shuffle(x)x1, x2 = x.chunk(2, dim=1)x1 = self.dwconv_5(x1)x2 = self.dwconv_dilated2_1(x2)x = F.mish(x2) * x1x = self.p_unshuffle(x)x = self.project_out(x)return x##########################################################################
##Dynamic-range Histogram Self-Attention (DHSA)
class Attention_histogram(nn.Module):def __init__(self, dim, num_heads=4, bias=False, ifBox=True):super(Attention_histogram, self).__init__()self.factor = num_headsself.ifBox = ifBoxself.num_heads = num_headsself.temperature = nn.Parameter(torch.ones(num_heads, 1, 1))self.qkv = Conv2d(dim, dim * 5, kernel_size=1, bias=bias)self.qkv_dwconv = Conv2d(dim * 5, dim * 5, kernel_size=3, stride=1, padding=1, groups=dim * 5, bias=bias)self.project_out = Conv2d(dim, dim, kernel_size=1, bias=bias)def pad(self, x, factor):hw = x.shape[-1]t_pad = [0, 0] if hw % factor == 0 else [0, (hw // factor + 1) * factor - hw]x = F.pad(x, t_pad, 'constant', 0)return x, t_paddef unpad(self, x, t_pad):_, _, hw = x.shapereturn x[:, :, t_pad[0]:hw - t_pad[1]]def softmax_1(self, x, dim=-1):logit = x.exp()logit = logit / (logit.sum(dim, keepdim=True) + 1)return logitdef normalize(self, x):mu = x.mean(-2, keepdim=True)sigma = x.var(-2, keepdim=True, unbiased=False)return (x - mu) / torch.sqrt(sigma + 1e-5)  # * self.weight + self.biasdef reshape_attn(self, q, k, v, ifBox):b, c = q.shape[:2]q, t_pad = self.pad(q, self.factor)k, t_pad = self.pad(k, self.factor)v, t_pad = self.pad(v, self.factor)hw = q.shape[-1] // self.factorshape_ori = "b (head c) (factor hw)" if ifBox else "b (head c) (hw factor)"shape_tar = "b head (c factor) hw"q = rearrange(q, '{} -> {}'.format(shape_ori, shape_tar), factor=self.factor, hw=hw, head=self.num_heads)k = rearrange(k, '{} -> {}'.format(shape_ori, shape_tar), factor=self.factor, hw=hw, head=self.num_heads)v = rearrange(v, '{} -> {}'.format(shape_ori, shape_tar), factor=self.factor, hw=hw, head=self.num_heads)q = torch.nn.functional.normalize(q, dim=-1)k = torch.nn.functional.normalize(k, dim=-1)attn = (q @ k.transpose(-2, -1)) * self.temperatureattn = self.softmax_1(attn, dim=-1)out = (attn @ v)out = rearrange(out, '{} -> {}'.format(shape_tar, shape_ori), factor=self.factor, hw=hw, b=b,head=self.num_heads)out = self.unpad(out, t_pad)return outdef forward(self, x):b, c, h, w = x.shapex_sort, idx_h = x[:, :c // 2].sort(-2)x_sort, idx_w = x_sort.sort(-1)x = x.clone()x[:, :c // 2] = x_sortqkv = self.qkv_dwconv(self.qkv(x))q1, k1, q2, k2, v = qkv.chunk(5, dim=1)  # b,c,x,xv, idx = v.view(b, c, -1).sort(dim=-1)q1 = torch.gather(q1.view(b, c, -1), dim=2, index=idx)k1 = torch.gather(k1.view(b, c, -1), dim=2, index=idx)q2 = torch.gather(q2.view(b, c, -1), dim=2, index=idx)k2 = torch.gather(k2.view(b, c, -1), dim=2, index=idx)out1 = self.reshape_attn(q1, k1, v, True)out2 = self.reshape_attn(q2, k2, v, False)out1 = torch.scatter(out1, 2, idx, out1).view(b, c, h, w)out2 = torch.scatter(out2, 2, idx, out2).view(b, c, h, w)out = out1 * out2out = self.project_out(out)out_replace = out[:, :c // 2]out_replace = torch.scatter(out_replace, -1, idx_w, out_replace)out_replace = torch.scatter(out_replace, -2, idx_h, out_replace)out[:, :c // 2] = out_replacereturn out##Histogram Transformer Block (HTB)
class TransformerBlock(nn.Module):def __init__(self, dim, num_heads=4, ffn_expansion_factor=2.5, bias=False, LayerNorm_type='WithBias'):## Other option 'BiasFree'super(TransformerBlock, self).__init__()self.attn_g = Attention_histogram(dim, num_heads, bias, True)self.norm_g = LayerNorm(dim, LayerNorm_type)self.ffn = FeedForward(dim, ffn_expansion_factor, bias)self.norm_ff1 = LayerNorm(dim, LayerNorm_type)def forward(self, x):x = x + self.attn_g(self.norm_g(x))x_out = x + self.ffn(self.norm_ff1(x))return x_out#使用THB中的Dynamic-range HistogramSelf-Attentiion替换 OSABlock中的attention
class PSABlock_DHSA(PSABlock):def __init__(self, c, qk_dim =16 , pdim=32, shortcut=True) -> None:"""Initializes the PSABlock with attention and feed-forward layers for enhanced feature extraction."""super().__init__( c)self.attn = Attention_histogram(c)class C2PSA_DHSA(C2PSA):def __init__(self, c1, c2, n=1, e=0.5):"""Initializes the C2PSA module with specified input/output channels, number of layers, and expansion ratio."""super().__init__(c1, c2)assert c1 == c2self.c = int(c1 * e)self.m = nn.Sequential(*(PSABlock_DHSA(self.c, qk_dim =16 , pdim=32) for _ in range(n)))#使用THB替换 OSABlock
class C2PSA_THB(C2PSA):def __init__(self, c1, c2, n=1, e=0.5):"""Initializes the C2PSA module with specified input/output channels, number of layers, and expansion ratio."""super().__init__(c1, c2)assert c1 == c2self.c = int(c1 * e)self.m = nn.Sequential(*(TransformerBlock(self.c) for _ in range(n)))if __name__ == '__main__':TB = TransformerBlock(256)#创建一个输入张量batch_size = 8input_tensor=torch.randn(batch_size, 256, 64, 64 )#运行模型并打印输入和输出的形状output_tensor =TB(input_tensor)print("Input shape:",input_tensor.shape)print("0utput shape:",output_tensor.shape)

 4. 将HTB引入到YOLOv11中

第一: 将下面的核心代码复制到D:\bilibili\model\YOLO11\ultralytics-main\ultralytics\nn路径下,如下图所示。

第二:在task.py中导入HTB包

第三:在task.py中的模型配置部分下面代码

第一第二改进修改代码的部分

第三改进修改代码的部分

elif m is TransformerBlock :args = [ch[f]]

第四:将模型配置文件复制到YOLOV11.YAMY文件中

# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'# [depth, width, max_channels]n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPss: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPsm: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPsl: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPsx: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs# YOLO11n backbone
backbone:# [from, repeats, module, args]- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2- [-1, 1, Conv, [128, 3, 2]] # 1-P2/4- [-1, 2, C3k2, [256, False, 0.25]]- [-1, 1, Conv, [256, 3, 2]] # 3-P3/8- [-1, 2, C3k2, [512, False, 0.25]]- [-1, 1, Conv, [512, 3, 2]] # 5-P4/16- [-1, 2, C3k2, [512, True]]- [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32- [-1, 2, C3k2, [1024, True]]- [-1, 1, SPPF, [1024, 5]] # 9- [-1, 2, C2PSA_DHSA, [1024]] # 10# YOLO11n head
head:- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 6], 1, Concat, [1]] # cat backbone P4- [-1, 2, C3k2, [512, False]] # 13- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 4], 1, Concat, [1]] # cat backbone P3- [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)- [-1, 1, Conv, [256, 3, 2]]- [[-1, 13], 1, Concat, [1]] # cat head P4- [-1, 2, C3k2, [512, False]] # 19 (P4/16-medium)- [-1, 1, Conv, [512, 3, 2]]- [[-1, 10], 1, Concat, [1]] # cat head P5- [-1, 2, C3k2, [1024, True]] # 22 (P5/32-large)- [[16, 19, 22], 1, Detect, [nc]] # Detect(P3, P4, P5)# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'# [depth, width, max_channels]n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPss: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPsm: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPsl: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPsx: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs# YOLO11n backbone
backbone:# [from, repeats, module, args]- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2- [-1, 1, Conv, [128, 3, 2]] # 1-P2/4- [-1, 2, C3k2, [256, False, 0.25]]- [-1, 1, Conv, [256, 3, 2]] # 3-P3/8- [-1, 2, C3k2, [512, False, 0.25]]- [-1, 1, Conv, [512, 3, 2]] # 5-P4/16- [-1, 2, C3k2, [512, True]]- [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32- [-1, 2, C3k2, [1024, True]]- [-1, 1, SPPF, [1024, 5]] # 9- [-1, 2, C2PSA_HTB, [1024]] # 10# YOLO11n head
head:- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 6], 1, Concat, [1]] # cat backbone P4- [-1, 2, C3k2, [512, False]] # 13- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 4], 1, Concat, [1]] # cat backbone P3- [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)- [-1, 1, Conv, [256, 3, 2]]- [[-1, 13], 1, Concat, [1]] # cat head P4- [-1, 2, C3k2, [512, False]] # 19 (P4/16-medium)- [-1, 1, Conv, [512, 3, 2]]- [[-1, 10], 1, Concat, [1]] # cat head P5- [-1, 2, C3k2, [1024, True]] # 22 (P5/32-large)- [[16, 19, 22], 1, Detect, [nc]] # Detect(P3, P4, P5)# Ultralytics YOLO 🚀, AGPL-3.0 license
# YOLO11 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect# Parameters
nc: 80 # number of classes
scales: # model compound scaling constants, i.e. 'model=yolo11n.yaml' will call yolo11.yaml with scale 'n'# [depth, width, max_channels]n: [0.50, 0.25, 1024] # summary: 319 layers, 2624080 parameters, 2624064 gradients, 6.6 GFLOPss: [0.50, 0.50, 1024] # summary: 319 layers, 9458752 parameters, 9458736 gradients, 21.7 GFLOPsm: [0.50, 1.00, 512] # summary: 409 layers, 20114688 parameters, 20114672 gradients, 68.5 GFLOPsl: [1.00, 1.00, 512] # summary: 631 layers, 25372160 parameters, 25372144 gradients, 87.6 GFLOPsx: [1.00, 1.50, 512] # summary: 631 layers, 56966176 parameters, 56966160 gradients, 196.0 GFLOPs# YOLO11n backbone
backbone:# [from, repeats, module, args]- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2- [-1, 1, Conv, [128, 3, 2]] # 1-P2/4- [-1, 2, C3k2, [256, False, 0.25]]- [-1, 1, Conv, [256, 3, 2]] # 3-P3/8- [-1, 2, C3k2, [512, False, 0.25]]- [-1, 1, Conv, [512, 3, 2]] # 5-P4/16- [-1, 2, C3k2, [512, True]]- [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32- [-1, 2, C3k2, [1024, True]]- [-1, 1, SPPF, [1024, 5]] # 9- [-1, 2, C2PSA, [1024]] # 10# YOLO11n head
head:- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 6], 1, Concat, [1]] # cat backbone P4- [-1, 2, C3k2, [512, False]] # 13- [-1, 1, nn.Upsample, [None, 2, "nearest"]]- [[-1, 4], 1, Concat, [1]] # cat backbone P3- [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)- [-1, 1, TransformerBlock, []]- [-1, 1, Conv, [256, 3, 2]]- [[-1, 13], 1, Concat, [1]] # cat head P4- [-1, 2, C3k2, [512, False]] # 19 (P4/16-medium)- [-1, 1, TransformerBlock, []]- [-1, 1, Conv, [512, 3, 2]]- [[-1, 10], 1, Concat, [1]] # cat head P5- [-1, 2, C3k2, [1024, True]] # 22 (P5/32-large)- [-1, 1, TransformerBlock, []]- [[17, 21, 25], 1, Detect, [nc]] # Detect(P3, P4, P5)

第五:运行成功


from ultralytics.models import NAS, RTDETR, SAM, YOLO, FastSAM, YOLOWorldif __name__=="__main__":# 使用自己的YOLOv11.yamy文件搭建模型并加载预训练权重训练模型model = YOLO(r"D:\bilibili\model\YOLO11\ultralytics-main\ultralytics\cfg\models\11\yolo11_HTB.yaml")\.load(r'D:\bilibili\model\YOLO11\ultralytics-main\yolo11n.pt')  # build from YAML and transfer weightsresults = model.train(data=r'D:\bilibili\model\ultralytics-main\ultralytics\cfg\datasets\VOC_my.yaml',epochs=100, imgsz=640, batch=8)

 

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

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

相关文章

CTF(二)

导言: 本文主要讲述在CTF竞赛中,web类反序列化题目unseping。。 靶场链接:攻防世界 (xctf.org.cn) 反序列化漏洞:反序列化漏洞(二)_fst反序列化 rocksdb 字段值错误-CSDN博客 打开后可以看到&#xff1…

涂鸦智能落地 Koupleless 合并部署,实现云服务降本增效

文|八幡、朵拉 杭州涂鸦智能技术专家 主要研究微服务与可观测、消息引擎、任务调度、数据层中间件等领域。 本文 5389 字 阅读 15 分钟 当前涂鸦通过 Koupleless 的静态合并部署能力,很好地解决了资源浪费问题。 为了进一步提升研发效率,涂鸦…

MYSQL 拼接函数

目录 1、CONCAT 2、CONCAT_WS 1、CONCAT 解释:用于拼接两个或多个字符串成一个字符串。如果任何一个参数为 NULL,则 CONCAT 函数的结果也会是 NULL。 语法格式:SELECT concat(column_name1,column_name2,...) FROM table_name 中文注释&…

关于Docker

文章目录 DockerWSLWMWare虚拟机CentOS7安装dockerdocker基础命令docker数据卷挂载本地目录或文件 Docker Docker是一个快速构建、运行、管理应用的工具。 能够快速部署项目、项目依赖的组件、项目运行的环境。 项目传统的部署方式缺点: 各类环境、组件命令太多&…

具体应用案例:树莓集团助力传统制造业数字化转型

以一家传统制造业企业为例,在树莓集团的支持下,该企业逐步完成了数字化转型: 1. 生产智能化: 通过树莓集团提供的物联网和智能制造解决方案,企业的生产线实现了全面数字化,实时监控设备状态,进行…

CasADi库C++用法整理学习---以NMPC代码为例

参考几个使用方法博客 1 官方文档写的很清楚 对SM,DM,XM数据类型疑惑。什么时候使用什么样的类型,还是都可以? x MX.sym(“x”) 这将创建一个 11 矩阵,即一个包含名为 x 的符号基元的标量。这只是显示名称&#xff…

关键词提取技术:TF-IDF 详解

1. 什么是TF-IDF? TF-IDF(Term Frequency-Inverse Document Frequency) 是一种统计方法,用于评估单词在文档集或语料库中的重要性。它是自然语言处理和信息检索中的核心技术之一。 TF-IDF主要基于以下两个概念: TF&a…

书籍推荐:《从零构建大型语言模型》附免费PDF下载

通过从头开始构建一个大型语言模型,了解如何创建、训练和调整大型语言模型 (LLMs)! 一、构建大型语言模型(从头开始) 在《构建大型语言模型(从头开始)》中,你将了解如何…

C++ —— 关于继承(inheritance)

目录 1. 继承的概念及定义 1.1 继承的概念 1.2 继承的定义格式 1.3 继承基类成员访问方式的变化 1.4 类模板的继承 2.基类与派生类的转换 3. 继承中的作用域 3.1 隐藏规则 4. 派⽣类的默认成员函数 4.1 4个常见默认成员函数 4.2 实现⼀个不能被继承的类 5. 继承与友元…

webpack 学习入门

webpack 1. 简介1.1 webpack 是什么1.2 webpack 五个核心概念1.2.1 入口 - Entry1.2.2 出口 - Output1.2.3 Loader1.2.4 插件 - Plugins1.2.6 模式 - Mode 2. webpack 初体验2.1 初始化配置2.1.1. 准备2.1.2. 写代码2.1.3 编译打包应用 3. webpack 开发环境的基本配置3.1 打包样…

HTML(七)表格

https://chatgai.lovepor.cn/ 在HTML中&#xff0c;表格的标准形式如下&#xff1a; <table></table> 使用上面的语言&#xff0c;就已经生成了一个表格&#xff0c;只不过这个表格什么都没有 那么&#xff0c;该如何让表格存在东西呢&#xff1f; 首先&#xf…

springboot 整合spring ai实现 基于知识库的客服问答

rag 需求产生的背景介绍&#xff1a; 在使用大模型时&#xff0c;常遇到的问题之一是模型可能产生幻觉&#xff0c;即生成的内容缺乏准确性。此外&#xff0c;由于大模型不直接访问企业的专有数据&#xff0c;其响应可能会显得泛泛而谈&#xff0c;不够精准或具体&#xff0c;…

基于YOLOv10的农场实时目标检测系统(python+pyside6界面+系统源码+可训练的数据集+也完成的训练模型)

摘要&#xff1a; 基于YOLOv10的农场实时目标检测系统&#xff0c;利用4393张图片&#xff08;3905张训练集&#xff0c;488张验证集&#xff09;进行模型训练&#xff0c;最终开发出一个高效的农场目标检测模型。为了方便用户操作和实时检测&#xff0c;本系统还开发了基于Pyt…

VSCode运行QT界面

VSCode用久了,感觉Qt Creator的写起代码来还是不如VSCode得心应手,虽然目前还是存在一些问题,先把目前实现的状况做个记录,后续有机会再进一步优化。 当前方式 通过QtCreator创建一个CMake项目,然后使用CMake的方式在VSCode中进行编译。 claude给出的建议 左上角的名字会…

SiLM27212 270V 4A/4A 支持高频信号输入 集成自举二极管的高低边门极驱动器

SiLM27212系列选型&#xff1a; SiLM27212LEK-DG SiLM27212EK-DG SiLM27212LCA-DG SiLM27212CA-DG SiLM27212LCB-DG SiLM27212CB-DG SiLM27212系列是一款支持高频信号输入的高低边N沟道MOSFET驱动器&#xff0c;有着优异的性能&#xff0c;广泛应用于各类模…

Linux查看下nginx及使用的配置文件

1、查到nginx进程 ps -aef | grep nginx2、通过进行pid查到nginx路径 pwdx <pid>3、根据路径得到配置文件 path***/nginx -t如下&#xff1a;

MacOS虚拟机安装Windows停滞在“让我们为你连接到网络”,如何解决?

1. 问题描述 MacOS在虚拟机安装win11过程中&#xff0c;停止在“让我们为你连接到网络”步骤&#xff0c;页面没有任何可以点击的按钮&#xff0c;进行下一步操作。 2. 解决方案&#xff08;亲测有效&#xff09; 到达该界面&#xff0c;按下ShiftF10&#xff08;Windows&…

【机器学习】深入浅出讲解贝叶斯分类算法

0. 前言 1.贝叶斯分类器介绍 贝叶斯分类是一类分类算法的总称&#xff0c;这类算法均以贝叶斯定理为基础&#xff0c;故统称为贝叶斯分类。而朴素贝叶斯&#xff08;Naive Bayes&#xff09;分类是贝叶斯分类中最简单&#xff0c;也是常见的一种分类方法。 一些很常见的分类…

整理—计算机网络

目录 网络OSI模型和TCP/IP模型 应用层有哪些协议 HTTP报文有哪些部分 HTTP常用的状态码 Http 502和 504 的区别 HTTP层请求的类型有哪些&#xff1f; GET和POST的使用场景&#xff0c;有哪些区别&#xff1f; HTTP的长连接 HTTP默认的端口是什么&#xff1f; HTTP1.1怎…

哪科竞赛含金量更高?五大学科竞赛含金量排名

2024年五大学科竞赛赛事已经渐渐拉开帷幕&#xff0c;本月底国内不少地区即将举行生物竞赛预赛的赛事。今天我们一起来看看五大学科竞赛哪科竞赛含金量更高。 高中五大学科竞赛&#xff08;数物化生信&#xff09;是升学路上的硬通货&#xff0c;比如说在强基破格中需要五大竞赛…