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

caffe搭建squeezenet网络的整套工程

之前用pytorch构建了squeezenet,个人觉得pytorch是最好用的,但是有的工程就是需要caffe结构的,所以本篇也用caffe构建一个squeezenet网络。

数据处理

首先要对数据进行处理,跟pytorch不同,pytorch读取数据只需要给数据集所在目录即可直接从中读取数据,而caffe需要一个包含每张图片的绝对路径以及所在类别的txt文件,从中读取数据。写一个生成次txt文件的脚本:

import os
import randomfolder = 'cotta'  # 数据集目录相对路径
names = os.listdir(folder)f1 = open('/train_txt/train_cotta.txt', 'a')  # 生成的txt地址
f2 = open('/train_txt/test_water_workcloth.txt', 'a')for name in names:imgnames = os.listdir(folder + '/' + name)random.shuffle(imgnames)numimg = len(imgnames)for i in range(numimg):f1.write('%s %s\n' % (folder + '/' + name + '/' + imgnames[i], name[0]))# if i < int(0.9*numimg):#     f1.write('%s %s\n'%(folder + '/' + name + '/' + imgnames[i], name[0]))# else:#     f2.write('%s %s\n'%(folder + '/' + name + '/' + imgnames[i], name[0]))
# f2.close()
f1.close()

数据集的目录也要跟pytorch的一致,一个类的数据放在一个目录中,目录名为类名。且脚本与该目录同级。
运行脚本后生成的txt内容如下:

/cotta/0_other/0_1_391_572_68_68.jpg 0
/cotta/1_longSleeves/9605_1_5_565_357_82_70.jpg 1
/cotta/2_cotta/713_0.99796_1_316_162_96_87.jpg 2
......
图片相对路径 图片所属类别

网络结构配置文件

trainval.prototxt

layer {name: "data"type: "ImageData"top: "data"top: "label"transform_param {mirror: truecrop_size: 96}image_data_param {source: "/train_txt/train_cotta.txt"   # 生成的txt的相对路径root_folder: "/data/"   # 存放数据集目录的路径batch_size: 64shuffle: truenew_height: 96new_width: 96}}
layer {name: "conv1"type: "Convolution"bottom: "data"top: "conv1"convolution_param {num_output: 96kernel_size: 3stride: 1pad: 1weight_filler {type: "xavier"}}
}layer {  name: "BatchNorm1"  type: "BatchNorm" bottom: "conv1"  top: "BatchNorm1"   
}layer {name: "relu_conv1"type: "ReLU"bottom: "BatchNorm1"top: "BatchNorm1"
}
layer {name: "pool1"type: "Pooling"bottom: "BatchNorm1"top: "pool1"pooling_param {pool: MAXkernel_size: 2stride: 2}
}
layer {name: "fire2/squeeze1x1"type: "Convolution"bottom: "pool1"top: "fire2/squeeze1x1"convolution_param {num_output: 16kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire2/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire2/squeeze1x1"  top: "fire2/bn_squeeze1x1"   
}layer {name: "fire2/relu_squeeze1x1"type: "ReLU"bottom: "fire2/bn_squeeze1x1"top: "fire2/bn_squeeze1x1"
}
layer {name: "fire2/expand1x1"type: "Convolution"bottom: "fire2/bn_squeeze1x1"top: "fire2/expand1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire2/bn_expand1x1"  type: "BatchNorm" bottom: "fire2/expand1x1"  top: "fire2/bn_expand1x1"   
}layer {name: "fire2/relu_expand1x1"type: "ReLU"bottom: "fire2/bn_expand1x1"top: "fire2/bn_expand1x1"
}
layer {name: "fire2/expand3x3"type: "Convolution"bottom: "fire2/bn_expand1x1"top: "fire2/expand3x3"convolution_param {num_output: 64pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire2/bn_expand3x3"  type: "BatchNorm" bottom: "fire2/expand3x3"  top: "fire2/bn_expand3x3"   
}layer {name: "fire2/relu_expand3x3"type: "ReLU"bottom: "fire2/bn_expand3x3"top: "fire2/bn_expand3x3"
}
layer {name: "fire2/concat"type: "Concat"bottom: "fire2/bn_expand1x1"bottom: "fire2/bn_expand3x3"top: "fire2/concat"
}#fire2 ends: 128 channels
layer {name: "fire3/squeeze1x1"type: "Convolution"bottom: "fire2/concat"top: "fire3/squeeze1x1"convolution_param {num_output: 16kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire3/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire3/squeeze1x1"  top: "fire3/bn_squeeze1x1"   
}layer {name: "fire3/relu_squeeze1x1"type: "ReLU"bottom: "fire3/bn_squeeze1x1"top: "fire3/bn_squeeze1x1"
}
layer {name: "fire3/expand1x1"type: "Convolution"bottom: "fire3/bn_squeeze1x1"top: "fire3/expand1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire3/bn_expand1x1"  type: "BatchNorm" bottom: "fire3/expand1x1"  top: "fire3/bn_expand1x1"   
}layer {name: "fire3/relu_expand1x1"type: "ReLU"bottom: "fire3/bn_expand1x1"top: "fire3/bn_expand1x1"
}
layer {name: "fire3/expand3x3"type: "Convolution"bottom: "fire3/bn_expand1x1"top: "fire3/expand3x3"convolution_param {num_output: 64pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire3/bn_expand3x3"  type: "BatchNorm" bottom: "fire3/expand3x3"  top: "fire3/bn_expand3x3"   
}layer {name: "fire3/relu_expand3x3"type: "ReLU"bottom: "fire3/bn_expand3x3"top: "fire3/bn_expand3x3"
}
layer {name: "fire3/concat"type: "Concat"bottom: "fire3/bn_expand1x1"bottom: "fire3/bn_expand3x3"top: "fire3/concat"
}#fire3 ends: 128 channelslayer {name: "bypass_23"type: "Eltwise"bottom: "fire2/concat"bottom: "fire3/concat"top: "fire3_EltAdd"
}layer {name: "fire4/squeeze1x1"type: "Convolution"bottom: "fire3_EltAdd"top: "fire4/squeeze1x1"convolution_param {num_output: 32kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire4/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire4/squeeze1x1"  top: "fire4/bn_squeeze1x1"   
}layer {name: "fire4/relu_squeeze1x1"type: "ReLU"bottom: "fire4/bn_squeeze1x1"top: "fire4/bn_squeeze1x1"
}
layer {name: "fire4/expand1x1"type: "Convolution"bottom: "fire4/bn_squeeze1x1"top: "fire4/expand1x1"convolution_param {num_output: 128kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire4/bn_expand1x1"  type: "BatchNorm" bottom: "fire4/expand1x1"  top: "fire4/bn_expand1x1"   
}layer {name: "fire4/relu_expand1x1"type: "ReLU"bottom: "fire4/bn_expand1x1"top: "fire4/bn_expand1x1"
}
layer {name: "fire4/expand3x3"type: "Convolution"bottom: "fire4/bn_expand1x1"top: "fire4/expand3x3"convolution_param {num_output: 128pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire4/bn_expand3x3"  type: "BatchNorm" bottom: "fire4/expand3x3"  top: "fire4/bn_expand3x3"   
}layer {name: "fire4/relu_expand3x3"type: "ReLU"bottom: "fire4/bn_expand3x3"top: "fire4/bn_expand3x3"
}
layer {name: "fire4/concat"type: "Concat"bottom: "fire4/bn_expand1x1"bottom: "fire4/bn_expand3x3"top: "fire4/concat"
}
#fire4 ends: 256 channelslayer {name: "pool4"type: "Pooling"bottom: "fire4/concat"top: "pool4"pooling_param {pool: MAXkernel_size: 2stride: 2}
}
#fire4 ends: 256 channels / pooled
layer {name: "fire5/squeeze1x1"type: "Convolution"bottom: "pool4"top: "fire5/squeeze1x1"convolution_param {num_output: 32kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire5/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire5/squeeze1x1"  top: "fire5/bn_squeeze1x1"   
}layer {name: "fire5/relu_squeeze1x1"type: "ReLU"bottom: "fire5/bn_squeeze1x1"top: "fire5/bn_squeeze1x1"
}
layer {name: "fire5/expand1x1"type: "Convolution"bottom: "fire5/bn_squeeze1x1"top: "fire5/expand1x1"convolution_param {num_output: 128kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire5/bn_expand1x1"  type: "BatchNorm" bottom: "fire5/expand1x1"  top: "fire5/bn_expand1x1"   
}layer {name: "fire5/relu_expand1x1"type: "ReLU"bottom: "fire5/bn_expand1x1"top: "fire5/bn_expand1x1"
}
layer {name: "fire5/expand3x3"type: "Convolution"bottom: "fire5/bn_expand1x1"top: "fire5/expand3x3"convolution_param {num_output: 128pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire5/bn_expand3x3"  type: "BatchNorm" bottom: "fire5/expand3x3"  top: "fire5/bn_expand3x3"   
}layer {name: "fire5/relu_expand3x3"type: "ReLU"bottom: "fire5/bn_expand3x3"top: "fire5/bn_expand3x3"
}
layer {name: "fire5/concat"type: "Concat"bottom: "fire5/bn_expand1x1"bottom: "fire5/bn_expand3x3"top: "fire5/concat"
}#fire5 ends: 256 channels
layer {name: "bypass_45"type: "Eltwise"bottom: "pool4"bottom: "fire5/concat"top: "fire5_EltAdd"
}layer {name: "fire6/squeeze1x1"type: "Convolution"bottom: "fire5_EltAdd"top: "fire6/squeeze1x1"convolution_param {num_output: 48kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire6/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire6/squeeze1x1"  top: "fire6/bn_squeeze1x1"   
}layer {name: "fire6/relu_squeeze1x1"type: "ReLU"bottom: "fire6/bn_squeeze1x1"top: "fire6/bn_squeeze1x1"
}
layer {name: "fire6/expand1x1"type: "Convolution"bottom: "fire6/bn_squeeze1x1"top: "fire6/expand1x1"convolution_param {num_output: 192kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire6/bn_expand1x1"  type: "BatchNorm" bottom: "fire6/expand1x1"  top: "fire6/bn_expand1x1"   
}layer {name: "fire6/relu_expand1x1"type: "ReLU"bottom: "fire6/bn_expand1x1"top: "fire6/bn_expand1x1"
}
layer {name: "fire6/expand3x3"type: "Convolution"bottom: "fire6/bn_expand1x1"top: "fire6/expand3x3"convolution_param {num_output: 192pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire6/bn_expand3x3"  type: "BatchNorm" bottom: "fire6/expand3x3"  top: "fire6/bn_expand3x3"   
}layer {name: "fire6/relu_expand3x3"type: "ReLU"bottom: "fire6/bn_expand3x3"top: "fire6/bn_expand3x3"
}
layer {name: "fire6/concat"type: "Concat"bottom: "fire6/bn_expand1x1"bottom: "fire6/bn_expand3x3"top: "fire6/concat"
}
#fire6 ends: 384 channelslayer {name: "fire7/squeeze1x1"type: "Convolution"bottom: "fire6/concat"top: "fire7/squeeze1x1"convolution_param {num_output: 48kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire7/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire7/squeeze1x1"  top: "fire7/bn_squeeze1x1"   
}layer {name: "fire7/relu_squeeze1x1"type: "ReLU"bottom: "fire7/bn_squeeze1x1"top: "fire7/bn_squeeze1x1"
}
layer {name: "fire7/expand1x1"type: "Convolution"bottom: "fire7/bn_squeeze1x1"top: "fire7/expand1x1"convolution_param {num_output: 192kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire7/bn_expand1x1"  type: "BatchNorm" bottom: "fire7/expand1x1"  top: "fire7/bn_expand1x1"   
}layer {name: "fire7/relu_expand1x1"type: "ReLU"bottom: "fire7/bn_expand1x1"top: "fire7/bn_expand1x1"
}
layer {name: "fire7/expand3x3"type: "Convolution"bottom: "fire7/bn_expand1x1"top: "fire7/expand3x3"convolution_param {num_output: 192pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire7/bn_expand3x3"  type: "BatchNorm" bottom: "fire7/expand3x3"  top: "fire7/bn_expand3x3"   
}layer {name: "fire7/relu_expand3x3"type: "ReLU"bottom: "fire7/bn_expand3x3"top: "fire7/bn_expand3x3"
}
layer {name: "fire7/concat"type: "Concat"bottom: "fire7/bn_expand1x1"bottom: "fire7/bn_expand3x3"top: "fire7/concat"
}
#fire7 ends: 384 channels
layer {name: "bypass_67"type: "Eltwise"bottom: "fire6/concat"bottom: "fire7/concat"top: "fire7_EltAdd"
}layer {name: "fire8/squeeze1x1"type: "Convolution"bottom: "fire7_EltAdd"top: "fire8/squeeze1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire8/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire8/squeeze1x1"  top: "fire8/bn_squeeze1x1"   
}layer {name: "fire8/relu_squeeze1x1"type: "ReLU"bottom: "fire8/bn_squeeze1x1"top: "fire8/bn_squeeze1x1"
}
layer {name: "fire8/expand1x1"type: "Convolution"bottom: "fire8/bn_squeeze1x1"top: "fire8/expand1x1"convolution_param {num_output: 256kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire8/bn_expand1x1"  type: "BatchNorm" bottom: "fire8/expand1x1"  top: "fire8/bn_expand1x1"   
}layer {name: "fire8/relu_expand1x1"type: "ReLU"bottom: "fire8/bn_expand1x1"top: "fire8/bn_expand1x1"
}
layer {name: "fire8/expand3x3"type: "Convolution"bottom: "fire8/bn_expand1x1"top: "fire8/expand3x3"convolution_param {num_output: 256pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire8/bn_expand3x3"  type: "BatchNorm" bottom: "fire8/expand3x3"  top: "fire8/bn_expand3x3"   
}layer {name: "fire8/relu_expand3x3"type: "ReLU"bottom: "fire8/bn_expand3x3"top: "fire8/bn_expand3x3"
}
layer {name: "fire8/concat"type: "Concat"bottom: "fire8/bn_expand1x1"bottom: "fire8/bn_expand3x3"top: "fire8/concat"
}
#fire8 ends: 512 channelslayer {name: "pool8"type: "Pooling"bottom: "fire8/concat"top: "pool8"pooling_param {pool: MAXkernel_size: 2stride: 2}
}
#fire8 ends: 512 channels
layer {name: "fire9/squeeze1x1"type: "Convolution"bottom: "pool8"top: "fire9/squeeze1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire9/bn_squeeze1x1"  type: "BatchNorm" bottom: "fire9/squeeze1x1"  top: "fire9/bn_squeeze1x1"   
}layer {name: "fire9/relu_squeeze1x1"type: "ReLU"bottom: "fire9/bn_squeeze1x1"top: "fire9/bn_squeeze1x1"
}
layer {name: "fire9/expand1x1"type: "Convolution"bottom: "fire9/bn_squeeze1x1"top: "fire9/expand1x1"convolution_param {num_output: 256kernel_size: 1weight_filler {type: "xavier"}}
}layer {  name: "fire9/bn_expand1x1"  type: "BatchNorm" bottom: "fire9/expand1x1"  top: "fire9/bn_expand1x1"   
}layer {name: "fire9/relu_expand1x1"type: "ReLU"bottom: "fire9/bn_expand1x1"top: "fire9/bn_expand1x1"
}
layer {name: "fire9/expand3x3"type: "Convolution"bottom: "fire9/bn_expand1x1"top: "fire9/expand3x3"convolution_param {num_output: 256pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}layer {  name: "fire9/bn_expand3x3"  type: "BatchNorm" bottom: "fire9/expand3x3"  top: "fire9/bn_expand3x3"   
}layer {name: "fire9/relu_expand3x3"type: "ReLU"bottom: "fire9/bn_expand3x3"top: "fire9/bn_expand3x3"
}
layer {name: "fire9/concat"type: "Concat"bottom: "fire9/bn_expand1x1"bottom: "fire9/bn_expand3x3"top: "fire9/concat"
}
#fire9 ends: 512 channelslayer {name: "conv10_new"type: "Convolution"bottom: "fire9/concat"top: "conv10"convolution_param {num_output: 3kernel_size: 1weight_filler {type: "gaussian"mean: 0.0std: 0.01}}
}layer {name: "pool10"type: "Pooling"bottom: "conv10"top: "pool10"pooling_param {pool: AVEglobal_pooling: true}
}# loss, top1, top5
layer {name: "loss"type: "SoftmaxWithLoss"bottom: "pool10"bottom: "label"top: "loss"include {
#    phase: TRAIN}
}
layer {name: "accuracy"type: "Accuracy"bottom: "pool10"bottom: "label"top: "accuracy"#include {#  phase: TEST#}
}

在最后一层卷积层conv10中的num_output修改类别数量。

模型超参配置文件

solver.prototxt

test_iter: 2000 #not subject to iter_size
test_interval: 1000000
# base_lr: 0.0001
base_lr: 0.005       # 学习率
display: 40
# max_iter: 600000
max_iter: 200000    # 迭代数
iter_size: 2 #global batch size = batch_size * iter_size
lr_policy: "poly"
power: 1.0 #linearly decrease LR
momentum: 0.9
weight_decay: 0.0002
snapshot: 10000     # 每多少次迭代保存一个模型
snapshot_prefix: "/data/zxc/classfication/model/model_cotta/cotta_"   # 模型保存路径
solver_mode: GPU
random_seed: 42
net: "./trainNets_drive/trainval.prototxt"   # 网络结构配置文件的路径 
test_initialization: false
average_loss: 40
  • max_iter:caffe用的是迭代数而不是pytorch的轮数。pytorch中训练完全部的训练集为一轮,而caffe中训练完一个batch_size的数据为一个迭代。如果想要等价与轮数的话,一轮就等于:len(train_data) / batch_size。如果有余数就要看pytorch里的dataloader里面设置舍去还是为一个batch,如果舍去就是向下取整,如果不舍去就是向上取整;
  • snapshot_prefix:最后一部分为每个保存模型的前缀,如图:
    在这里插入图片描述

运行命令

将运行命令写入bash文件中:
train.sh

/home/seg/anaconda3/envs/zxc/bin/caffe train -gpu 1 -solver ./solvers/solver_3.prototxt -weights=/data/classfication/model/model_cotta/cotta__iter_200000.caffemodel 2>&1 | tee log_3_4_class.txt 
  • -gpu:选择哪块卡,如果就一块就是0;
  • -solver:后面跟网络超参配置文件路径;
  • -weights:后面跟预训练模型,可以用官方给的squeezenet的caffe版本的预训练模型,我这里是训练中断从断点继续训练

编写完成后source activate 环境名称进入source环境,然后source train.sh运行bash文件就能开始训练。

相关文章:

caffe搭建squeezenet网络的整套工程

之前用pytorch构建了squeezenet&#xff0c;个人觉得pytorch是最好用的&#xff0c;但是有的工程就是需要caffe结构的&#xff0c;所以本篇也用caffe构建一个squeezenet网络。 数据处理 首先要对数据进行处理&#xff0c;跟pytorch不同&#xff0c;pytorch读取数据只需要给数据…...

【OWT】梳理构建的webrtc和owt mfc工程

梳理构建的webrtc和owt mfc工程M98 + owtp2p : 发现最终基于m98的owt也可以直接跑通 【owt】p2p client mfc 工程梳理 服务端使用github版本。 本地运行调试即可。 M98 VS2017 构建 :只构建了m98的webrtc.lib 【webrtc】vs2017 重新构建m98 G:\webrtc_m98_yjf\src webrtc本身…...

02 powershell服务器远程执行命令

一、获取服务器登录凭证 $Username myft\xngrq $PWD 123!# #将密码加密成特殊的字符串对象 $pass ConvertTo-SecureString -AsPlainText $PWD -Force #创建一个登录凭证对象 $Cred New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass …...

LeetCode257. Binary Tree Paths

文章目录 一、题目二、题解 一、题目 Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Example 1: Input: root [1,2,3,null,5] Output: [“1->2->5”,“1->3”] Example 2: Input: root […...

Linux下MSSQL (SQL Server)数据库无法启动故障处理

有同事反馈一套CentOS7下的mssql server2017无法启动需要我帮忙看看&#xff0c;启动报错情况如下 检查日志并没有更新日志信息 乍一看mssql-server服务有问题&#xff0c;检查mssql也确实没有进程 既然服务有问题&#xff0c;那么我们用一种方式直接手工后台启动mssql引擎来…...

2311极语言高亮说明书

入门 安装目录下Sec.exe为ide.Sc为编译器. .sec为单文件二进制源码结构,.SEC和.极为多文件文本结构,命令行:cmd Sc.exe 源码路径. 基础 整数变量也可以是万能指针,传送参数,参数只有整数和小数两种. 可在名称前面加或&符号取变量或函数名指针地址,文本变量只取地址不用加…...

金蝶云星空与金蝶云星空对接集成盘亏单查询打通盘亏单新增

金蝶云星空与金蝶云星空对接集成盘亏单查询打通盘亏单新增 接通系统&#xff1a;金蝶云星空 金蝶K/3Cloud&#xff08;金蝶云星空&#xff09;是移动互联网时代的新型ERP&#xff0c;是基于WEB2.0与云技术的新时代企业管理服务平台。金蝶K/3Cloud围绕着“生态、人人、体验”&am…...

深入理解 Django 信号机制

Django 信号&#xff08;signals&#xff09;是一种实现解耦的有力工具&#xff0c;它允许某些发生的事件通知其他部分的代码。信号主要用于在 Django 应用中的不同部分之间传递信息&#xff0c;尤其是在模型操作发生时。本文将深入探讨 Django 信号的工作原理、如何定义和接收…...

uniapp开发app应用从创建到上架

目录 前言 一、项目初始化 1.初始化方式 2.账号注册 3.插件安装 二、项目结构及重点文件介绍 1.项目基本结构 2.项目文件介绍 三、应用打包 1. 安卓打包 2.苹果打包 四、应用发布 1. 安卓市场发布 用户权限和隐私政策 注销 软著和App备案证书 2. 苹果市场发布 …...

为什么使用Golang而非Rust开发桌面应用?

MoonGuard 团队选择 Golang 而不是 Rust 作为他们的 Krater 桌面应用程序&#xff0c;因为 Golang 中更容易进行内存管理、类型安全和 ORM 支持。 使用 Rust 和 Tauri 时面临的一些挑战包括&#xff1a; 难以理解 Rust 的所有权和借用规则、其严格的类型安全有时会限制开发速…...

问题复盘|MySQL 数据记录中明明有值,使用 concat() 后得到的却一直是 null

背景 MySQL 的数据数据记录中明明有值&#xff0c;在使用 concat() 查询时却一直得到 null SELECT CONCAT(first_name, , last_name) FROM users;排查后发现 MySQL 的 concat 函数拼接规则是 当多个拼接的字段的字段值中存在 null 时&#xff0c;返回的一定是 null 解决方…...

正点原子嵌入式linux驱动开发——Linux IIO驱动

工业场合里面也有大量的模拟量和数字量之间的转换&#xff0c;也就是常说的ADC和DAC。而且随着手机、物联网、工业物联网和可穿戴设备的爆发&#xff0c;传感器的需求只持续增强。比如手机或者手环里面的加速度计、光传感器、陀螺仪、气压计、磁力计等&#xff0c;这些传感器本…...

利用角色roles上线wordpress项目

角色订制&#xff1a;roles ① 简介 对于以上所有的方式有个弊端就是无法实现复用假设在同时部署Web、db、ha 时或不同服务器组合不同的应用就需要写多个yml文件。很难实现灵活的调用。   roles 用于层次性、结构化地组织playbook。roles 能够根据层次型结构自动装载变量文…...

4.0 Linux进程前导知识

个人主页&#xff1a;Lei宝啊 愿所有美好如期而遇 冯.诺依曼体系 CPU&#xff1a;运算器&#xff0c;控制器 输入设备&#xff1a;键盘&#xff0c;麦克风&#xff0c;摄像头&#xff0c;鼠标&#xff0c;网卡&#xff0c;磁盘等。 输出设备&#xff1a;显示器&#xff0…...

推荐一份适合所有人做的副业,尤其是程序员。

我建议每个人都去尝试一下网上接单&#xff0c;这是一个门槛低、类型多样的方式&#xff0c;尤其适合程序员&#xff01; 在接单平台上&#xff0c;你可以看到各种类型的兼职。以freelancer为例&#xff0c;你可以在这里找到技术、设计、写作等类型的兼职&#xff0c;只要发挥…...

Linux中字符设备的打开、写入

一个内核模块应该由以下几部分组成。 第一部分&#xff0c;头文件部分。一般的内核模块&#xff0c;都需要 include 下面两个头文件&#xff1a; #include <linux/module.h> #include <linux/init.h> 第二部分&#xff0c;定义一些函数&#xff0c;用于处理内核…...

3d max软件中的缓存垃圾该如何清理?

使用3d max建模到渲染操作&#xff0c;来回对效果图调整的次数过多时&#xff0c;就会出现一下看不到的垃圾缓存&#xff0c;影响保存的速度&#xff0c;影响效率&#xff01; 对于这类的3d垃圾清理的有什么高效方法呢&#xff1f; 3dmax垃圾清理的常规操作如下&#xff1a; 1、…...

11.13 牛客刷题8/10

11.13 信号完整性 指针地址 的加减&#xff0c;注意 最后转为16进制...

CI/CD简介

CI/CD简介 1、CI/CD流水线2、什么是CI/CD3、CI/CD的优点4、CI/CD的工作原理5、CI/CD流水线工具6、CI/CD的应用7、CI/CD的未来趋势 1、CI/CD流水线 从最初的瀑布模型&#xff0c;到后来的敏捷开发&#xff0c;再到今天的DevOps&#xff0c;这是现代开发人员构建出色产品的技术路…...

python opencv 读取文件夹下所有MP4文件并解析成jpg图像

你可以使用Python的OpenCV库来读取文件夹中的所有MP4文件&#xff0c;并将其解析为JPG图像。以下是一个示例代码&#xff0c;演示了如何实现这个功能&#xff0c;并设置解析间隔为3帧&#xff1a; import os import cv2def extract_frames(input_folder, output_folder, inter…...

Leetcode 3576. Transform Array to All Equal Elements

Leetcode 3576. Transform Array to All Equal Elements 1. 解题思路2. 代码实现 题目链接&#xff1a;3576. Transform Array to All Equal Elements 1. 解题思路 这一题思路上就是分别考察一下是否能将其转化为全1或者全-1数组即可。 至于每一种情况是否可以达到&#xf…...

《Qt C++ 与 OpenCV:解锁视频播放程序设计的奥秘》

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

centos 7 部署awstats 网站访问检测

一、基础环境准备&#xff08;两种安装方式都要做&#xff09; bash # 安装必要依赖 yum install -y httpd perl mod_perl perl-Time-HiRes perl-DateTime systemctl enable httpd # 设置 Apache 开机自启 systemctl start httpd # 启动 Apache二、安装 AWStats&#xff0…...

在鸿蒙HarmonyOS 5中使用DevEco Studio实现录音机应用

1. 项目配置与权限设置 1.1 配置module.json5 {"module": {"requestPermissions": [{"name": "ohos.permission.MICROPHONE","reason": "录音需要麦克风权限"},{"name": "ohos.permission.WRITE…...

基于matlab策略迭代和值迭代法的动态规划

经典的基于策略迭代和值迭代法的动态规划matlab代码&#xff0c;实现机器人的最优运输 Dynamic-Programming-master/Environment.pdf , 104724 Dynamic-Programming-master/README.md , 506 Dynamic-Programming-master/generalizedPolicyIteration.m , 1970 Dynamic-Programm…...

关键领域软件测试的突围之路:如何破解安全与效率的平衡难题

在数字化浪潮席卷全球的今天&#xff0c;软件系统已成为国家关键领域的核心战斗力。不同于普通商业软件&#xff0c;这些承载着国家安全使命的软件系统面临着前所未有的质量挑战——如何在确保绝对安全的前提下&#xff0c;实现高效测试与快速迭代&#xff1f;这一命题正考验着…...

HarmonyOS运动开发:如何用mpchart绘制运动配速图表

##鸿蒙核心技术##运动开发##Sensor Service Kit&#xff08;传感器服务&#xff09;# 前言 在运动类应用中&#xff0c;运动数据的可视化是提升用户体验的重要环节。通过直观的图表展示运动过程中的关键数据&#xff0c;如配速、距离、卡路里消耗等&#xff0c;用户可以更清晰…...

云原生安全实战:API网关Kong的鉴权与限流详解

&#x1f525;「炎码工坊」技术弹药已装填&#xff01; 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 一、基础概念 1. API网关&#xff08;API Gateway&#xff09; API网关是微服务架构中的核心组件&#xff0c;负责统一管理所有API的流量入口。它像一座…...

【C++】纯虚函数类外可以写实现吗?

1. 答案 先说答案&#xff0c;可以。 2.代码测试 .h头文件 #include <iostream> #include <string>// 抽象基类 class AbstractBase { public:AbstractBase() default;virtual ~AbstractBase() default; // 默认析构函数public:virtual int PureVirtualFunct…...

【Veristand】Veristand环境安装教程-Linux RT / Windows

首先声明&#xff0c;此教程是针对Simulink编译模型并导入Veristand中编写的&#xff0c;同时需要注意的是老用户编译可能用的是Veristand Model Framework&#xff0c;那个是历史版本&#xff0c;且NI不会再维护&#xff0c;新版本编译支持为VeriStand Model Generation Suppo…...