caffe搭建squeezenet网络的整套工程

news2024/11/28 0:57:08

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

数据处理

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

import os
import random

folder = '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: true
       crop_size: 96
     }
    image_data_param {
       source: "/train_txt/train_cotta.txt"   # 生成的txt的相对路径
       root_folder: "/data/"   # 存放数据集目录的路径
       batch_size: 64
       shuffle: true
	   new_height: 96
	   new_width: 96
     }
   }
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  convolution_param {
    num_output: 96
    kernel_size: 3
    stride: 1
    pad: 1
    weight_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: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "fire2/squeeze1x1"
  type: "Convolution"
  bottom: "pool1"
  top: "fire2/squeeze1x1"
  convolution_param {
    num_output: 16
    kernel_size: 1
    weight_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: 64
    kernel_size: 1
    weight_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: 64
    pad: 1
    kernel_size: 3
    weight_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: 16
    kernel_size: 1
    weight_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: 64
    kernel_size: 1
    weight_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: 64
    pad: 1
    kernel_size: 3
    weight_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 channels

layer {
  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: 32
    kernel_size: 1
    weight_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: 128
    kernel_size: 1
    weight_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: 128
    pad: 1
    kernel_size: 3
    weight_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 channels

layer {
  name: "pool4"
  type: "Pooling"
  bottom: "fire4/concat"
  top: "pool4"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
#fire4 ends: 256 channels / pooled
layer {
  name: "fire5/squeeze1x1"
  type: "Convolution"
  bottom: "pool4"
  top: "fire5/squeeze1x1"
  convolution_param {
    num_output: 32
    kernel_size: 1
    weight_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: 128
    kernel_size: 1
    weight_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: 128
    pad: 1
    kernel_size: 3
    weight_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: 48
    kernel_size: 1
    weight_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: 192
    kernel_size: 1
    weight_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: 192
    pad: 1
    kernel_size: 3
    weight_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 channels

layer {
  name: "fire7/squeeze1x1"
  type: "Convolution"
  bottom: "fire6/concat"
  top: "fire7/squeeze1x1"
  convolution_param {
    num_output: 48
    kernel_size: 1
    weight_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: 192
    kernel_size: 1
    weight_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: 192
    pad: 1
    kernel_size: 3
    weight_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: 64
    kernel_size: 1
    weight_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: 256
    kernel_size: 1
    weight_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: 256
    pad: 1
    kernel_size: 3
    weight_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 channels

layer {
  name: "pool8"
  type: "Pooling"
  bottom: "fire8/concat"
  top: "pool8"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
#fire8 ends: 512 channels
layer {
  name: "fire9/squeeze1x1"
  type: "Convolution"
  bottom: "pool8"
  top: "fire9/squeeze1x1"
  convolution_param {
    num_output: 64
    kernel_size: 1
    weight_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: 256
    kernel_size: 1
    weight_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: 256
    pad: 1
    kernel_size: 3
    weight_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 channels


layer {
  name: "conv10_new"
  type: "Convolution"
  bottom: "fire9/concat"
  top: "conv10"
  convolution_param {
    num_output: 3
    kernel_size: 1
    weight_filler {
      type: "gaussian"
      mean: 0.0
      std: 0.01
    }
  }
}

layer {
  name: "pool10"
  type: "Pooling"
  bottom: "conv10"
  top: "pool10"
  pooling_param {
    pool: AVE
    global_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文件就能开始训练。

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

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

相关文章

第六章《凸优化核心过程:真正搞懂梯度下降过程》

优化问题可以分为凸优化问题和非凸优化问题&#xff0c;凸优化问题是指定义在凸集中的凸函数最优化的问题&#xff0c;典型应用场景就是 目标函数极值问题的求解。凸优化问题的局部最优解就是全局最优解&#xff0c;因此 机器学习中很多非凸优化问题都需要被转化为等价凸优化问…

【链接装载与库】动态链接(下)

动态链接 》上篇《 延迟绑定 (PLT) 动态链接的确有很多优势&#xff0c;比静态链接要灵活得多&#xff0c;但它是以牺牲一部分性能为代价的。主要原因是动态链接下对于全局和静态的数据访问都要进行复杂的GOT定位&#xff0c;然后间接寻址&#xff1b;对于模块间的调用也要先…

Go RabbitMQ简介 使用

RabbitMQ简介 RabbitMQ 是一个广泛使用的开源消息队列系统&#xff0c;它实现了高级消息队列协议&#xff08;AMQP&#xff09;标准&#xff0c;为分布式应用程序提供了强大的消息传递功能。RabbitMQ 是 Erlang 语言编写的&#xff0c;具有高度的可扩展性和可靠性&#xff0c;…

普洱茶上市?澜沧古茶通过港股聆讯

近日&#xff0c;澜沧古茶成功通过港交所聆讯&#xff0c;随后在11月7日披露了相关资料集。该公司即将在港交所主板上市&#xff0c;此次上市由中信建投国际和招商证券国际担任联席保荐人。据了解&#xff0c;澜沧古茶或将成为内地茶企第一股&#xff0c;也将成为“普洱茶第一股…

el-form-item的label的长度单独改掉,用vue3样式穿透的写法,加上css选择器查找特定的id拿到元素

为了让这个会员卡号这几个字和下面的表格对齐&#xff0c;需要改el-form-item的label的长度 如果直接改el-form的label-width,那么所有的el-form-item的label都会改&#xff0c;我不希望这样 我希望只改第1个会员卡号的label长度 给这个el-form-item添加一个id :deep(.el-for…

漏洞复现--泛微E-Office信息泄露(CVE-2023-2766)

免责声明&#xff1a; 文章中涉及的漏洞均已修复&#xff0c;敏感信息均已做打码处理&#xff0c;文章仅做经验分享用途&#xff0c;切勿当真&#xff0c;未授权的攻击属于非法行为&#xff01;文章中敏感信息均已做多层打马处理。传播、利用本文章所提供的信息而造成的任何直…

xshell隧道设置

现在有远程外网地址 120.120.120.120和另一台内网地址192.168.1.110两台cvm 但是192.168.1.110 无法直接通过外网地址访问, 需要通过120.120.120.120建立隧道来连接 需要访问192.168.1.110 机器的3306端口, 可以这么做 将192.168.1.110 的3306映射到本地13306端口 1.连接外网…

YOLOv8-Seg改进:多尺度空洞注意力(MSDA),增强局部、稀疏提取特征能力

🚀🚀🚀本文改进: 新的注意力机制——多尺度空洞注意力(MSDA)。MSDA 能够模拟小范围内的局部和稀疏的图像块交互; 如何在OLOv8-seg下使用:1)作为注意力机制放在各个网络位置;2)与C2f结合替代原始的C2f 🚀🚀🚀YOLOv8-seg创新专栏:http://t.csdnimg.cn/KLS…

人工智能辅助职业教育发展——开启教育新时代

人工智能辅助职业教育发展——开启教育新时代 随着科技的飞速发展&#xff0c;人工智能&#xff08;AI&#xff09;逐渐渗透到各行各业&#xff0c;并在许多领域发挥着重要作用。如今&#xff0c;AI的应用已经延伸到职业教育领域&#xff0c;为培养高素质人才提供了新的可能和动…

用户交互引导大模型生成内容特征,LLM-Rec框架助力个性化推荐!

欢迎来到魔法宝库&#xff0c;传递AIGC的前沿知识&#xff0c;做有格调的分享❗ 喜欢的话记得点个关注吧&#xff01; 今天主要和大家分享一篇使用大语言模型做数据增强来提升推荐系统性能的研究 标题&#xff1a; LLM-Rec: Personalized Recommendation via Prompting Large …

2023软件测试必问的100个面试题【含答案】

一、测试理论 1.什么是软件测试&#xff1f; 答&#xff1a;软件测试是通过执行预定的步骤和使用指定的数据&#xff0c;以确定软件系统在特定条件下是否满足预期的行为。 2.测试驱动开发&#xff08;TDD&#xff09;是什么&#xff1f; 答&#xff1a;测试驱动开发是一种开…

基于情感分析+聚类分析+LDA主题分析对服装产品类的消费者评论分析(文末送书)

&#x1f935;‍♂️ 个人主页&#xff1a;艾派森的个人主页 ✍&#x1f3fb;作者简介&#xff1a;Python学习者 &#x1f40b; 希望大家多多支持&#xff0c;我们一起进步&#xff01;&#x1f604; 如果文章对你有帮助的话&#xff0c; 欢迎评论 &#x1f4ac;点赞&#x1f4…

MKL.NET:为.NET开发者提供高性能数学计算支持的开源库

目录 01 项目简介02 主要功能03 项目结构04 项目地址 MKL是英特尔推出的一套功能强大、性能优化的数学库&#xff0c;主要是采用C/C编写的。今天给大家推荐一个MKL的.Net版本&#xff0c;让我们无需与C/C打交道&#xff0c;方便我们集成到应用开发中去。 01 项目简介 MKL.NET…

智能机器人云控平台

智能机器人云控平台主要是通过打造一个低速固定场景下的机器人自主完成既定作业的模式。整体平台融合的自动化驾驶感知终端&#xff0c;物联网通信&#xff0c;数据接入中心&#xff0c;数据管理中心&#xff0c;模型中心及开放中心等&#xff0c;以一个云平台来掌控多个多种不…

ElementUI的Dialog弹窗实现拖拽移动功能

实现ElementUI的Dialog弹窗可以拖拽移动 实现步骤&#xff1a; 1.创建自定义指令 在utils文件夹下新建文件夹 utils/directive/el-dragDialog/index.js import drag from ./dragconst install function(Vue) {Vue.directive(el-drag-dialog, drag) }if (window.Vue) {windo…

电机应用-步进电机

步进电机&#xff08;脉冲电机&#xff09; 基于最基本的电磁铁原理&#xff0c;是一种可以自由回转的电磁铁&#xff0c;其工作原理是依靠气隙磁导的变化来产生电磁转矩。 由于步进电机是一个可以把电磁脉冲转换成机械运动的装置&#xff0c;具有很好的数据控制特性&#xff0…

解决问题:IDEA启动微服务项目,显示Loaded classes are up to date. Nothing to reload.

先说结论&#xff0c;再讲相声&#xff1a; 开启Shorten Command Line 选择JARmanifest 今天启动微服务&#xff0c;就有这么寸&#xff0c;其他的服务启动的好好的&#xff0c;唯独我需要Debug的项目无法启动&#xff0c;只能Run运行 满世界找答案无非就是几种&#xff1a;…

第二证券:今日投资前瞻:PPP迎来新机制,消费电池需求有望迎来复苏

11月8日&#xff0c;两市股指盘中轰动回落&#xff0c;尾盘逐渐止跌。到收盘&#xff0c;沪指跌0.16%报3052.37点&#xff0c;深成指微跌0.04%报10052.09点&#xff0c;创业板指涨0.02%报2023.13点&#xff0c;科创50指数涨0.92%&#xff1b;两市估计成交10366亿元&#xff0c;…

图文详解 VCF 生信格式 (变异信息)

文章目录 一、vcf 格式介绍二、vcf 资源文件三、vcf 文件详解3.1 主要字段3.2 INFO 中的常见信息3.3 FORMAT 和 SAMPLEs 中的信息 四、vcf 的记录模式4.1 只记录变异本身的信息4.2 记录个体或个体组织的变异信息4.3 记录群体或家系的变异信息 五、记录标准5.1 记录多核苷酸多样…

第二证券:长期停牌一般是多久?

股票停牌不仅仅是个股的问题&#xff0c;它或许会影响到商场的整体运作和投资者的利益。那么&#xff0c;长期停牌一般是多久呢&#xff1f;从不同的视点分析&#xff0c;可以得到不同的答案。 1. 官方规则 首要&#xff0c;咱们需求查看相关规则。依据证监会规则&#xff0c…