PaddleVideo:Squeeze Time算法移植

 参考
PaddleVideo/docs/zh-CN/contribute/add_new_algorithm.md at develop · PaddlePaddle/PaddleVideo · GitHubAwesome video understanding toolkits based on PaddlePaddle. It supports video data annotation tools, lightweight RGB and skeleton based action recognition model, practical applications for video tagging and sport action detection. - PaddleVideo/docs/zh-CN/contribute/add_new_algorithm.md at develop · PaddlePaddle/PaddleVideoicon-default.png?t=N7T8https://github.com/PaddlePaddle/PaddleVideo/blob/develop/docs/zh-CN/contribute/add_new_algorithm.md

1:添加backbone:(网络我自己砍了几刀,目的是想和ppTSM-v2做对比)

paddlevideo/modeling/backbones/squeezetime.py

from __future__ import absolute_import, division, print_functionimport paddle
import paddle.nn as nn
from paddle import ParamAttr
from paddle.nn import AdaptiveAvgPool2D, BatchNorm, Conv2D, Dropout, Linear, BatchNorm2D
from paddle.regularizer import L2Decay
from paddle.nn.initializer import KaimingNormal,Constant
import paddle.nn.functional as Ffrom ..registry import BACKBONESdef get_inplanes():return [64, 128, 256, 512]class SpatialConv(nn.Layer):"""Inter-temporal Object Interaction Module (IOI)"""def __init__(self, dim_in, dim_out, pos_dim=7):super(SpatialConv, self).__init__()self.short_conv = nn.Conv2D(dim_in, dim_out, kernel_size=3, stride=1, padding=1, groups=1)self.glo_conv = nn.Sequential(nn.Conv2D(dim_in, 16, kernel_size=3, stride=1, padding=1, groups=1),nn.BatchNorm2D(16), nn.ReLU(),nn.Conv2D(16, 16, kernel_size=7, stride=1, padding=3),nn.BatchNorm2D(16), nn.ReLU(),nn.Conv2D(16, dim_out, kernel_size=3, stride=1, padding=1, groups=1), nn.Sigmoid())self.pos_embed = self.create_parameter(shape=[1, 16, pos_dim, pos_dim], default_initializer=nn.initializer.KaimingNormal())def forward(self, x, param):x_short = self.short_conv(x)x = x * paramfor i in range(len(self.glo_conv)):if i == 3:_, _, H, W = x.shapeif self.pos_embed.shape[2] != H or self.pos_embed.shape[3] != W:pos_embed = F.interpolate(self.pos_embed, size=(H, W), mode='bilinear', align_corners=True)else:pos_embed = self.pos_embedx = x + pos_embedx = self.glo_conv[i](x)return x_short * xclass Conv2d(nn.Layer):"""Channel-Time Learning Module (CTL)"""def __init__(self,in_channels: int,out_channels: int,kernel_size: int,stride: int = 1,padding: int = 0,dilation: int = 1,groups: int = 1,bias: bool = True,padding_mode: str = 'zeros', pos_dim = 7):super(Conv2d, self).__init__()self.stride = strideself.param_conv = nn.Sequential(nn.AdaptiveAvgPool2D((1, 1)),nn.Conv2D(in_channels, in_channels, 1, stride=1, padding=1 // 2, bias_attr=False),nn.BatchNorm2D(in_channels),nn.ReLU(),nn.Conv2D(in_channels, in_channels, 1, bias_attr=False),nn.Sigmoid())self.temporal_conv = nn.Conv2D(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=1, padding=padding, dilation=dilation, groups=groups, bias_attr=bias, padding_mode=padding_mode)self.spatial_conv = SpatialConv(dim_in=in_channels, dim_out=out_channels, pos_dim=pos_dim)def forward(self, x):param = self.param_conv(x)x = self.temporal_conv(param * x) + self.spatial_conv(x, param)return xdef conv3x3x3(in_planes, out_planes, stride=1, pos_dim=7):return Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, padding=0, bias=False, pos_dim=pos_dim)def conv1x1x1(in_planes, out_planes, stride=1):return nn.Conv2D(in_planes, out_planes, kernel_size=1, stride=stride, bias_attr=False)class BasicBlock(nn.Layer):"""Channel-Time Learning (CTL) Block"""expansion = 1def __init__(self, in_planes, planes, stride=1, shortcut_conv=None, pos_dim=7):super().__init__()self.conv1 = conv3x3x3(in_planes, planes, stride)self.bn1 = nn.BatchNorm2D(planes)self.relu = nn.ReLU()self.conv2 = conv3x3x3(planes, planes, pos_dim=pos_dim)self.bn2 = nn.BatchNorm2D(planes)self.shortcut_conv = shortcut_convself.stride = strideif stride != 1:self.downsample = nn.Sequential(nn.Conv2D(in_planes, in_planes, kernel_size=2, stride=2, groups=in_planes),nn.BatchNorm2D(in_planes))def forward(self, x):if self.stride != 1:x = self.downsample(x)residual = xout = self.conv1(x)out = self.bn1(out)out = self.relu(out)out = self.conv2(out)out = self.bn2(out)if self.shortcut_conv is not None:residual = self.shortcut_conv(x)out += residualout = self.relu(out)return outclass Bottleneck(nn.Layer):"""Channel-Time Learning (CTL) Block"""expansion = 4def __init__(self, in_planes, planes, stride=1, shortcut_conv=None, pos_dim=7):super().__init__()self.conv1 = conv1x1x1(in_planes, planes)self.bn1 = nn.BatchNorm2D(planes)self.conv2 = conv3x3x3(planes, planes, pos_dim=pos_dim)self.bn2 = nn.BatchNorm2D(planes)self.conv3 = conv1x1x1(planes, planes * self.expansion)self.bn3 = nn.BatchNorm2D(planes * self.expansion)self.relu = nn.ReLU()self.shortcut_conv = shortcut_convself.stride = strideif stride != 1:self.downsample = nn.Sequential(nn.Conv2D(in_planes, in_planes, kernel_size=2, stride=2, groups=in_planes),nn.BatchNorm2D(in_planes))def forward(self, x):if self.stride != 1:x = self.downsample(x)residual = xout = self.conv1(x)out = self.bn1(out)out = self.relu(out)out = self.conv2(out)out = self.bn2(out)out = self.relu(out)out = self.conv3(out)out = self.bn3(out)if self.shortcut_conv is not None:residual = self.shortcut_conv(x)out += residualout = self.relu(out)return outclass ResNet(nn.Layer):def __init__(self,block,layers,block_inplanes,n_input_channels=3,no_max_pool=False,shortcut_type='B',widen_factor=1.0,dropout=0.2, freeze_bn=False, spatial_stride=[1,2,2,2], pos_dim=[64,32,16,8]):super().__init__()self.freeze_bn = freeze_bnblock_inplanes = [int(x * widen_factor) for x in block_inplanes]self.in_planes = block_inplanes[0]self.no_max_pool = no_max_poolself.dropout = dropoutself.conv1 = nn.Conv2D(n_input_channels,self.in_planes,kernel_size=5,stride=2,padding=2,groups=1,bias_attr=False)self.bn1 = nn.BatchNorm2D(self.in_planes)self.relu = nn.ReLU()self.maxpool = nn.MaxPool2D(kernel_size=3, stride=2, padding=1)self.layer1 = self._make_layer(block, block_inplanes[0], layers[0],shortcut_type, stride=spatial_stride[0], pos_dim=pos_dim[0])self.layer2 = self._make_layer(block,block_inplanes[1],layers[1],shortcut_type,stride=spatial_stride[1], pos_dim=pos_dim[1])self.layer3 = self._make_layer(block,block_inplanes[2],layers[2],shortcut_type,stride=spatial_stride[2], pos_dim=pos_dim[2])self.layer4 = self._make_layer(block,block_inplanes[3],layers[3],shortcut_type,stride=spatial_stride[3], pos_dim=pos_dim[3])def _downsample_basic_block(self, x, planes, stride):out = F.avg_pool2d(x, kernel_size=1, stride=stride)zero_pads = paddle.zeros([out.shape[0], planes - out.shape[1], out.shape[2], out.shape[3]])if isinstance(out, paddle.CUDAPlace):zero_pads = zero_pads.cuda()out = paddle.concat([out, zero_pads], axis=1)return outdef _make_layer(self, block, planes, blocks, shortcut_type, stride=1, pos_dim=7):shortcut = Noneif self.in_planes != planes * block.expansion:shortcut = nn.Sequential(conv1x1x1(self.in_planes, planes * block.expansion, stride=1),nn.BatchNorm2D(planes * block.expansion))layers = []layers.append(block(in_planes=self.in_planes,planes=planes,stride=stride, shortcut_conv=shortcut, pos_dim=pos_dim))self.in_planes = planes * block.expansionfor i in range(1, blocks):layers.append(block(self.in_planes, planes, pos_dim=pos_dim))return nn.Sequential(*layers)def forward(self, x):print('##################', x.shape)if len(x.shape) == 3:x = paddle.unsqueeze(x, axis=0)N, C, H, W = x.shapex = x.reshape([int(N/16), -1, H, W])x = self.conv1(x)x = self.bn1(x)x = self.relu(x)if not self.no_max_pool:x = self.maxpool(x)x = self.layer1(x)x = self.layer2(x)x = self.layer3(x)x = self.layer4(x)return xdef train(self, mode=True):freeze_bn = self.freeze_bnfreeze_bn_affine = self.freeze_bnsuper(ResNet, self).train(mode)if freeze_bn:print("Freezing Mean/Var of BatchNorm2D.")for m in self.sublayers():if isinstance(m, nn.BatchNorm2D):m.eval()if freeze_bn_affine:print("Freezing Weight/Bias of BatchNorm2D.")for m in self.sublayers():if isinstance(m, nn.BatchNorm2D):m.weight.stop_gradient = Truem.bias.stop_gradient = Truedef SqueezeTime_model(**kwargs):model = ResNet(Bottleneck, [2, 2, 2, 2], get_inplanes(), **kwargs)return model@BACKBONES.register()
def SqueezeTime(pretrained=None, use_ssld=False, **kwargs):"""Build SqueezeTime Model"""model = SqueezeTime_model(widen_factor=0.5, dropout=0.5, n_input_channels=48, freeze_bn=False, spatial_stride=[1, 2, 2, 2], pos_dim=[64, 32, 16, 8])return  model

2:导入backbone:

paddlevideo/modeling/backbones/__init__.py

# Copyright (c) 2020  PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.from .actbert import BertForMultiModalPreTraining
from .adds import ADDS_DepthNet
from .agcn import AGCN
from .asrf import ASRF
from .bmn import BMN
from .cfbi import CFBI
from .movinet import MoViNet
from .ms_tcn import MSTCN
from .resnet import ResNet
from .resnet_slowfast import ResNetSlowFast
from .resnet_slowfast_MRI import ResNetSlowFast_MRI
from .resnet_tsm import ResNetTSM
from .resnet_tsm_MRI import ResNetTSM_MRI
from .resnet_tsn_MRI import ResNetTSN_MRI
from .resnet_tweaks_tsm import ResNetTweaksTSM
from .resnet_tweaks_tsn import ResNetTweaksTSN
from .stgcn import STGCN
from .swin_transformer import SwinTransformer3D
from .transnetv2 import TransNetV2
from .vit import VisionTransformer
from .vit_tweaks import VisionTransformer_tweaks
from .ms_tcn import MSTCN
from .asrf import ASRF
from .resnet_tsn_MRI import ResNetTSN_MRI
from .resnet_tsm_MRI import ResNetTSM_MRI
from .resnet_slowfast_MRI import ResNetSlowFast_MRI
from .cfbi import CFBI
from .ctrgcn import CTRGCN
from .agcn2s import AGCN2s
from .movinet import MoViNet
from .resnet3d_slowonly import ResNet3dSlowOnly
from .toshift_vit import TokenShiftVisionTransformer
from .pptsm_mv2 import PPTSM_MobileNetV2
from .pptsm_mv3 import PPTSM_MobileNetV3
from .pptsm_v2 import PPTSM_v2
from .yowo import YOWO
from .squeezetime import SqueezeTime__all__ = ['ResNet', 'ResNetTSM', 'ResNetTweaksTSM', 'ResNetSlowFast', 'BMN','ResNetTweaksTSN', 'VisionTransformer', 'STGCN', 'AGCN', 'TransNetV2','ADDS_DepthNet', 'VisionTransformer_tweaks', 'BertForMultiModalPreTraining','ResNetTSN_MRI', 'ResNetTSM_MRI', 'ResNetSlowFast_MRI', 'CFBI', 'MSTCN','ASRF', 'MoViNet', 'SwinTransformer3D', 'CTRGCN','TokenShiftVisionTransformer', 'AGCN2s', 'PPTSM_MobileNetV2','PPTSM_MobileNetV3', 'PPTSM_v2', 'ResNet3dSlowOnly', 'YOWO', 'SqueezeTime'
]

3:添加head:

paddlevideo/modeling/heads/i2d_head.py

# Copyright (c) 2020  PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.import paddle
import paddle.nn as nn
from paddle import ParamAttrfrom ..registry import HEADS
from ..weight_init import weight_init_
from .base import BaseHead@HEADS.register()
class I2DHead(BaseHead):"""Classification head for I2D.Args:num_classes (int): Number of classes to be classified.in_channels (int): Number of channels in input feature.loss_cls (dict): Config for building loss.Default: dict(name='CrossEntropyLoss')spatial_type (str): Pooling type in spatial dimension. Default: 'avg'.drop_ratio (float): Probability of dropout layer. Default: 0.5.std (float): Std value for Initiation. Default: 0.01.kwargs (dict, optional): Any keyword argument to be used to initializethe head."""def __init__(self,num_classes,in_channels,loss_cfg=dict(name='CrossEntropyLoss'),spatial_type='avg',drop_ratio=0.5,std=0.01,**kwargs):super().__init__(num_classes, in_channels, loss_cfg, **kwargs)self.spatial_type = spatial_typeself.dropout_ratio = drop_ratioself.init_std = stdif self.dropout_ratio != 0:self.dropout = nn.Dropout(p=self.dropout_ratio)else:self.dropout = Noneself.fc_cls = nn.Linear(self.in_channels, self.num_classes)if self.spatial_type == 'avg':self.avg_pool = nn.AdaptiveAvgPool2D((1, 1))else:self.avg_pool = nn.AdaptiveMaxPool2D((1,1))def forward(self, x, num_segs = None):"""Defines the computation performed at every call.Args:x (Tensor): The input data.Returns:Tensor: The classification scores for input samples."""   # [N, in_channels, 4, 7, 7]if self.avg_pool is not None:x = self.avg_pool(x)# [N, in_channels, 1, 1, 1]if self.dropout is not None:x = self.dropout(x)# [N, in_channels, 1, 1, 1]x = paddle.reshape(x, [x.shape[0], -1])# [N, in_channels]cls_score = self.fc_cls(x)# [N, num_classes]return cls_score# def forward_new(self, x, num_segs = None):#     """Defines the computation performed at every call.#     Args:#         x (Tensor): The input data.#     Returns:#         Tensor: The classification scores for input samples.#     """      #     # [N, in_channels, 4, 7, 7]#     if self.avg_pool is not None:#         x = self.avg_pool(x)#     # [N, in_channels, 1, 1, 1]#     if self.dropout is not None:#         x = self.dropout(x)#     # [N, in_channels, 1, 1, 1]#     x = paddle.reshape(x, [x.shape[0], -1])#     # [N, in_channels]#     cls_score = self.fc_cls(x)#     # [N, num_classes]#     return cls_score

4:导入head:

paddlevideo/modeling/heads/__init__.py

# Copyright (c) 2020  PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.from .adds_head import AddsHead
from .asrf_head import ASRFHead
from .attention_lstm_head import AttentionLstmHead, ActionAttentionLstmHead
from .base import BaseHead
from .bbox_head import BBoxHeadAVA
from .cfbi_head import CollaborativeEnsemblerMS
from .i3d_head import I3DHead
from .movinet_head import MoViNetHead
from .ms_tcn_head import MSTCNHead
from .pptimesformer_head import ppTimeSformerHead
from .pptsm_head import ppTSMHead
from .pptsn_head import ppTSNHead
from .roi_head import AVARoIHead
from .single_straight3d import SingleRoIExtractor3D
from .slowfast_head import SlowFastHead
from .stgcn_head import STGCNHead
from .timesformer_head import TimeSformerHead
from .transnetv2_head import TransNetV2Head
from .tsm_head import TSMHead
from .tsn_head import TSNHead
from .ms_tcn_head import MSTCNHead
from .asrf_head import ASRFHead
from .ctrgcn_head import CTRGCNHead
from .movinet_head import MoViNetHead
from .agcn2s_head import AGCN2sHead
from .token_shift_head import TokenShiftHead
from .i2d_head import I2DHead__all__ = ['BaseHead', 'TSNHead', 'TSMHead', 'ppTSMHead', 'ppTSNHead', 'SlowFastHead','AttentionLstmHead', 'TimeSformerHead', 'STGCNHead', 'TransNetV2Head','I3DHead', 'SingleRoIExtractor3D', 'AVARoIHead', 'BBoxHeadAVA', 'AddsHead','ppTimeSformerHead', 'CollaborativeEnsemblerMS', 'MSTCNHead', 'ASRFHead','MoViNetHead', 'CTRGCNHead', 'TokenShiftHead', 'ActionAttentionLstmHead','AGCN2sHead', 'I2DHead'
]

5:训练配置文件:

configs/recognition/pptsm/v2/md_ppsqt_16frames_uniform.yaml

MODEL: #MODEL fieldframework: "Recognizer2D" #Mandatory, indicate the type of network, associate to the 'paddlevideo/modeling/framework/' .backbone: #Mandatory, indicate the type of backbone, associate to the 'paddlevideo/modeling/backbones/' .name: "SqueezeTime" #Mandatory, The name of backbone.head:name: "I2DHead" #Mandatory, indicate the type of head, associate to the 'paddlevideo/modeling/heads'#pretrained: "" #Optional, pretrained model path.num_classes: 2in_channels: 1024DATASET: #DATASET fieldbatch_size: 16  #Mandatory, bacth sizenum_workers: 4 #Mandatory, the number of subprocess on each GPU.train:format: "FrameDataset" #Mandatory, indicate the type of dataset, associate to the 'paddlevidel/loader/dateset'data_prefix: "/home/mnt/sdd/Data/data_fights/rawframes" #Mandatory, train data root pathfile_path: "/home/mnt/sdd/Data/data_fights/train_list.txt" #Mandatory, train data index file pathsuffix: 'img_{:06}.jpg'valid:format: "FrameDataset" #Mandatory, indicate the type of dataset, associate to the 'paddlevidel/loader/dateset'data_prefix: "/home/mnt/sdd/Data/data_fights/rawframes" #Mandatory, valid data root pathfile_path: "/home/mnt/sdd/Data/data_fights/test_list.txt" #Mandatory, valid data index file pathsuffix: 'img_{:06}.jpg'test:format: "FrameDataset" #Mandatory, indicate the type of dataset, associate to the 'paddlevidel/loader/dateset'data_prefix: "/home/mnt/sdd/Data/data_fights/rawframes" #Mandatory, valid data root pathfile_path: "/home/mnt/sdd/Data/data_fights/test_list.txt" #Mandatory, valid data index file pathsuffix: 'img_{:06}.jpg'PIPELINE: #PIPELINE fieldtrain: #Mandotary, indicate the pipeline to deal with the training data, associate to the 'paddlevideo/loader/pipelines/'decode:name: "FrameDecoder"sample:name: "Sampler"num_seg: 16seg_len: 1valid_mode: Falsetransform: #Mandotary, image transfrom operator- Scale:short_size: 256- MultiScaleCrop:target_size: 256- RandomCrop:target_size: 224- RandomFlip:- Image2Array:- Normalization:mean: [0.485, 0.456, 0.406]std: [0.229, 0.224, 0.225]valid: #Mandatory, indicate the pipeline to deal with the validing data. associate to the 'paddlevideo/loader/pipelines/'decode:name: "FrameDecoder"sample:name: "Sampler"num_seg: 16seg_len: 1valid_mode: Truetransform:- Scale:short_size: 256- CenterCrop:target_size: 224- Image2Array:- Normalization:mean: [0.485, 0.456, 0.406]std: [0.229, 0.224, 0.225]test:  #Mandatory, indicate the pipeline to deal with the validing data. associate to the 'paddlevideo/loader/pipelines/'decode:name: "FrameDecoder"sample:name: "Sampler"num_seg: 16seg_len: 1valid_mode: Truetransform:- Scale:short_size: 256- CenterCrop:target_size: 224- Image2Array:- Normalization:mean: [0.485, 0.456, 0.406]std: [0.229, 0.224, 0.225]OPTIMIZER: #OPTIMIZER fieldname: 'Momentum'momentum: 0.9learning_rate:iter_step: Truename: 'CustomWarmupCosineDecay'max_epoch: 120warmup_epochs: 10warmup_start_lr: 0.005cosine_base_lr: 0.01weight_decay:name: 'L2'value: 1e-4use_nesterov: TrueMIX:name: "Mixup"alpha: 0.2METRIC:name: 'CenterCropMetric'INFERENCE:name: 'ppSQT_Inference_helper'num_seg: 16target_size: 224model_name: "ppSQT"
log_interval: 10 #Optional, the interal of logger, default:10
epochs: 120  #Mandatory, total epoch
log_level: "INFO" #Optional, the logger level. default: "INFO"

6:训练:

# multi-gpu-st
export CUDA_VISIBLE_DEVICES=0,1
python -B -m paddle.distributed.launch --gpus="0,1"  --log_dir=./log/log_sqt_frame_16  main.py  --validate -c configs/recognition/pptsm/v2/ppsqt_lcnet_md_16frames_uniform.yaml

7:结果:精度比ppTSM-v2低8个点左右。有可能是没有预训练权重的问题。 

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

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

相关文章

17集 如何用ESP-IDF编译ESP-DL深度学习工程-《MCU嵌入式AI开发笔记》

17集 如何用ESP-IDF编译ESP-DL深度学习工程-《MCU嵌入式AI开发笔记》 参考文档:ESP-DL 用户指南: https://docs.espressif.com/projects/esp-dl/zh_CN/latest/esp32/index.html 和https://docs.espressif.com/projects/esp-dl/zh_CN/latest/esp32/get-s…

机器学习深度学习用得到的数据集

以下是一些常见的机器学习数据集下载渠道: Google 数据集搜索引擎:可以通过文本搜索数据集,并能按日期、数据格式和使用权限等进行过滤。地址:https://datasetsearch.research.google.com/Kaggle:这是世界领先的数据科…

PHP禁止IP访问和IP段访问(代码实例)

PHP禁止IP和IP段访问 实现IP限制是Web开发中常见的需求之一&#xff0c;它可以用于限制特定IP地址的访问权限。在PHP中&#xff0c;我们可以通过一些方法来实现IP限制。 <?//禁止某个IP$banned_ip array ("127.0.0.1",//"119.6.20.66","192.168.…

C#中简单Socket编程

C#中简单Socket编程 Socket分为面向连接的套接字(TCP套接字)和面向消息的套接字(UDP 套接字)。我们平时的网络编程是对Socket进行操作。 接下来&#xff0c;我用C#语言来进行简单的TCP通信和UDP通信。 一、TCP通信 新建项目SocketTest&#xff0c;首先添加TCP通信的客户端代…

71.WEB渗透测试-信息收集- WAF、框架组件识别(11)

免责声明&#xff1a;内容仅供学习参考&#xff0c;请合法利用知识&#xff0c;禁止进行违法犯罪活动&#xff01; 内容参考于&#xff1a; 易锦网校会员专享课 上一个内容&#xff1a;70.WEB渗透测试-信息收集- WAF、框架组件识别&#xff08;10&#xff09;-CSDN博客 如果有…

[数仓]十、离线数仓(安全集群实战)

第1章 概述 Hadoop启用Kerberos安全认证之后,之前的非安全环境下的全流程调度脚本和即席查询引擎均会遇到认证问题,故需要对其进行改进。 第2章 数仓全流程 2.1 改动说明 此处统一将数仓的全部数据资源的所有者设为hive用户,全流程的每步操作均认证为hive用户。 2.2 改…

RT2-使用NLP的方式去训练机器人控制器

目标 研究在网络数据上训练的视觉语言模型也可以直接结合到端到端的机器人控制中&#xff0c;提升泛化性以及获得突出的语义推理&#xff1b;使得单个的端到端训练模型可以同时学习从机器人观测到动作的映射&#xff0c;这个过程可以受益于基于网络上的语言和视觉语言数据的预训…

【工具分享】FOFA——网络空间测绘搜索引擎

文章目录 FOFA介绍FOFA语法其他引擎 FOFA介绍 FOFA官网&#xff1a;https://fofa.info/ FOFA&#xff08;Fingerprinting Organizations with Advanced Tools&#xff09;是一款网络空间测绘的搜索引擎&#xff0c;它专注于帮助用户收集和分析互联网上的设备和服务信息。FOFA…

提高LabVIEW软件的健壮性

提高LabVIEW软件的健壮性&#xff0c;即增强其在各种操作条件下的可靠性和稳定性&#xff0c;是开发过程中非常重要的一环。健壮的软件能够在面对意外输入、极端环境和系统故障时依然表现出色&#xff0c;确保系统的连续性和可靠性。以下是详细的方法和策略&#xff0c;从多个角…

如何在 CentOS 上配置本地 YUM 源

引言 CentOS 作为一个流行的企业级 Linux 发行版&#xff0c;依赖 YUM&#xff08;Yellowdog Updater, Modified&#xff09;来管理软件包。YUM 源&#xff08;Repository&#xff09;是软件包存储和分发的中心&#xff0c;它们通常位于互联网上。然而&#xff0c;在某些情况下…

Linux驱动开发-03字符设备驱动框架搭建

一、字符设备驱动开发步骤 驱动模块的加载和卸载&#xff08;将驱动编译模块&#xff0c;insmod加载驱动运行&#xff09;字符设备注册与注销&#xff08;我们的驱动实际上是去操作底层的硬件&#xff0c;所以需要向系统注册一个设备&#xff0c;告诉Linux系统&#xff0c;我有…

快速入门,springboot知识点汇总

学习 springboot 应该像学习一门编程语言一样&#xff0c;首先要熟练掌握常用的知识&#xff0c;而对于不常用的内容可以简单了解一下。先对整个框架和语言有一个大致的轮廓&#xff0c;然后再逐步补充细节。 前序: Spring Boot 通过简化配置和提供开箱即用的特性&#xff0c…

SQL 字段类型-上

定义方式 use xxxx; 使用xxxx数据库后 create table table_name {username char(20)/*数据类型*/ null/*属性*/,password varchar(10) not null; 字段名... } 整型数据 和高级语言一样可以用 int unsigned 修饰无符号放在后面 数据类型关键字描述迷你整型tinyint使用1…

Java:解锁Lambda表达式的魔法——从零开始的函数式编程之旅

解密Java Lambda&#xff1a;从初识到精通&#xff0c;解锁编程新境界 引言&#xff1a;迎接函数式编程的曙光 自Java 8发布以来&#xff0c;函数式编程的概念如同一股清风&#xff0c;吹进了Java程序员的世界。其中&#xff0c;最引人瞩目的便是Lambda表达式。Lambda表达式的…

dify/api/models/tools.py文件中的数据表

源码位置&#xff1a;dify/api/models/tools.py ToolBuiltinProvider 表结构 字段英文名数据类型字段中文名字备注idStringUUIDIDUUID生成tenant_idStringUUID租户ID可为空user_idStringUUID用户ID非空providerString提供者非空encrypted_credentialsText加密凭证可为空creat…

在 Qt6 中,QList 和 QVector 统一 成qlist了吗?

是的&#xff0c;在 Qt6 中&#xff0c;QList 和 QVector 已经被统一了。具体来说&#xff0c;QList 现在基本上就是 QVector 的一个别名。这一改变意味着 QList 和 QVector 具有相同的性能和行为特性。 在 Qt5 中&#xff0c;QList 有自己的内部实现&#xff0c;对小型对象&a…

第三期书生大模型实战营 第1关 Linux 基础知识

第三期书生大模型实战营 第1关 Linux 基础知识 第三期书生大模型实战营 第1关 Linux 基础知识InternStudio开发机创建SSH密钥配置通过本地客户端连接远程服务器通过本地VSCode连接远程服务器运行一个Python程序总结 第三期书生大模型实战营 第1关 Linux 基础知识 Hello大家好&a…

cesium 雷达扫描

cesium 雷达扫描 (下面附有源码) 实现思路 1、通过改变圆型材质来实现效果, 2、用了模运算和步进函数(step)来创建一个重复的圆形图案 3、当纹理坐标st落在垂直或水平的中心线上时,该代码将改变透明度和颜色,以突出显示这些线 示例代码 <!DOCTYPE html> <ht…

成为编程大佬!!——数据结构与算法(1)——算法复杂度!!

前言&#xff1a;解决同一个程序问题可以通过多个算法解决&#xff0c;那么要怎样判断一个算法的优劣呢&#xff1f;&#x1f914; 算法复杂度 算法复杂度是对某个程序运行时的时空效率的粗略估算&#xff0c;常用来判断一个算法的好坏。 我们通过两个维度来看算法复杂度——…

Maven在Windows中的配置方法

本文介绍在Windows电脑中&#xff0c;下载、配置Maven工具的详细方法。 Maven是一个广泛使用的项目管理工具&#xff0c;主要针对Java项目&#xff0c;但也可以用于其他类型的项目&#xff1b;其由Apache软件基金会维护&#xff0c;旨在简化和标准化项目构建过程&#xff0c;依…