Caffe中对MNIST执行train操作执行流程解析

2023-11-10

之前在 http://blog.csdn.net/fengbingchun/article/details/49849225 中简单介绍过使用Caffe train MNIST的文章,当时只是仿照caffe中的example实现了下,下面说一下执行流程,并精简代码到仅有10余行:

1.        先注册所有层,执行layer_factory.hpp中类LayerRegisterer的构造函数,类LayerRegistry的AddCreator和Registry静态函数;关于Caffe中Layer的注册可以参考 http://blog.csdn.net/fengbingchun/article/details/54310956

2.        指定执行mode是采用CPU还是GPU;

3.        构造SolverParameter类对象,存放Solver 参数信息;

4.        调用ReadProtoFromTextFile函数解析Solver文本文件(lenet_solver.prototxt),其文件内的各字段名需要在caffe.proto的message SolverParameter中存在,否则会解析不成功,其文件内容如下:

# The train/test net protocol buffer definition
# Proto filename for the train net, possibly combined with one or more test nets.
# train net 和 test net在同一个文件中
net: "E:/GitCode/Caffe_Test/test_data/model/mnist/lenet_train_test.prototxt"
# Solver type,采用哪种Solver优化方法
solver_type: SGD
# test_iter specifies how many forward passes the test should carry out.
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
# The number of iterations for each test net.
# batch size * test iter = test images,即 100 * 100 = 10000
test_iter: 100
# Carry out testing every 500 training iterations.
# The number of iterations between two testing phases.
#  指定执行多少次训练网络执行一次测试网络
test_interval: 500
# The base learning rate, momentum and the weight decay of the network.
# The base learning rate, 基础学习率
base_lr: 0.01
# The momentum value, 动量
momentum: 0.9
# The weight decay, 权值衰减
weight_decay: 0.0005
# The learning rate policy, 学习策略
lr_policy: "inv"
# The parameter to compute the learning rate,学习率计算参数
gamma: 0.0001
# The parameter to compute the learning rate,学习率计算参数
power: 0.75
# Display every 100 iterations
# the number of iterations between displaying info.
# If display = 0, no info will be displayed.
# 指定训练多少次显示一次结果信息,如loss值等
display: 100
# The maximum number of iterations,最多执行训练次数
max_iter: 10000
# snapshot intermediate results,执行多少次训练保存一次中间结果
snapshot: 5000
# The prefix for the snapshot, file save position,中间结果保存位置
snapshot_prefix: "E:/GitCode/Caffe_Test/test_data/model/mnist/lenet"

5.        将MNIST原始数据转换成LMDB数据库格式,在train和test时会使用;

6.        根据Solver type,New一个SGDSolver类对象并进行初始化操作:

(1)、调用GetSolver函数,new一个SGDSolver了对象;

(2)、调用Solver类的Init函数;

(3)、调用SolverParameter的DebugString函数打印解析后的lenet_solver.prototxt信息,输出结果如下:

test_iter: 100
test_interval: 500
base_lr: 0.01
display: 100
max_iter: 10000
lr_policy: "inv"
gamma: 0.0001
power: 0.75
momentum: 0.9
weight_decay: 0.0005
snapshot: 5000
snapshot_prefix: "E:/GitCode/Caffe_Test/test_data/model/mnist/lenet"
net: "E:/GitCode/Caffe_Test/test_data/model/mnist/lenet_train_test.prototxt"
solver_type: SGD

(4)、调用ReadNetParamsFromTextFileOrDie函数,解析lenet_train_test.prototxt文件(此文件中的各个layer段的位置不是固定的,每个layer内的各个段位置也不是固定的,它们的位置无关紧要,只是一般按照流程顺序从上到下排列),各个字段的说明如下:

name: "LeNet" # net名
layer { # memory required: (50175+64)*4=200960
  name: "mnist" # layer名字
  type: "Data" # layer类型,数据层,Data enters Caffe through data layers,read data from LEVELDB or LMDB
  top: "data" # top名字, shape: 64 1 28 28 (50175)
  top: "label" # top名字, shape: 64 (64)
  include { # 指定何时将此layer mnist包含到网络中
    phase: TRAIN # 训练阶段会将此layer mnist包含到网络中
  }
  transform_param { # 图像预处理
    scale: 0.00390625 # 对图像像素值进行scale操作,范围[0, 1)
  }
  data_param { # data parameter
    source: "E:/GitCode/Caffe_Test/test_data/MNIST/train" # 数据存放路径
    batch_size: 64 # 指定一次处理图像的数量
    backend: LMDB # 数据存储方式
  }
}
layer { # memory required: (78400+100)*4=314000
  name: "mnist" # layer名字
  type: "Data" # layer类型,数据层,Data enters Caffe through data layers,read data from LEVELDB or LMDB
  top: "data" # top名字, shape: 100 1 28 28 (78400)
  top: "label" # top名字, shape: 100 (100)
  include { # 指定何时将此layer mnist包含到网络中
    phase: TEST # 测试阶段会将此layer mnist包含到此网络中
  }
  transform_param { # 图像预处理
    scale: 0.00390625 # 对图像像素值进行scale操作,范围[0, 1)
  }
  data_param { # data parameter
    source: "E:/GitCode/Caffe_Test/test_data/MNIST/test" # 数据存放路径
    batch_size: 100 # 指定一次处理图像的数量
    backend: LMDB # 数据存储方式
  }
}
# test 阶段会创建一个layer: label_mnist_1_split,如下:
# layer_factory.hpp:75] Creating layer label_mnist_1_split
# net.cpp:110] Creating Layer label_mnist_1_split
# net.cpp:476] label_mnist_1_split <- label
# net.cpp:432] label_mnist_1_split -> label_mnist_1_split_0
# net.cpp:432] label_mnist_1_split -> label_mnist_1_split_1
# net.cpp:155] Setting up label_mnist_1_split
# net.cpp:163] Top shape: 100 (100)
# net.cpp:163] Top shape: 100 (100)
layer { # memory required: 737280*4=2949120/1152000*4=4608000
  name: "conv1" # layer名字
  type: "Convolution" # layer类型,卷积层
  bottom: "data" # bottom名字
  top: "conv1" # top名字, shape: 64 20 24 24 (737280)/100 20 24 24 (1152000)
  param { # 训练时用到的参数
    lr_mult: 1 # The multiplier on the global learning rate
  }
  param { # 训练时用到的参数
    lr_mult: 2 # The multiplier on the global learning rate
  }
  convolution_param { # convolution parameter
    num_output: 20 # 输出特征图(feature map)数量
    kernel_size: 5 # 卷积核大小(卷积核其实就是权值)
    stride: 1 # 滑动步长
    weight_filler { # The filler for the weight
      type: "xavier" # 权值使用xavier滤波
    }
    bias_filler { # The filler for the bias
      type: "constant" # 偏置使用常量滤波
    }
  }
}
layer { # memory required: 184320*4=737280/288000*4=1152000
  name: "pool1" # layer名字
  type: "Pooling" # layer类型,Pooling层
  bottom: "conv1" # bottom名字
  top: "pool1" # top名字, shape: 64 20 12 12 (184320)/ 100 20 12 12 (288000)
  pooling_param { # pooling parameter,pooling层参数
    pool: MAX # pooling方法:最大值采样
    kernel_size: 2 # 滤波器大小
    stride: 2 # 滑动步长
  }
}
layer { # memory required: 204800*4=819200/320000*4=1280000
  name: "conv2" # layer名字
  type: "Convolution" # layer类型,卷积层
  bottom: "pool1" # bottom名字
  top: "conv2" # top名字, shape: 64 50 8 8 (204800)/ 100 50 8 8 (320000)
  param { # 训练时用到的参数
    lr_mult: 1 # The multiplier on the global learning rate
  }
  param { # 训练时用到的参数
    lr_mult: 2 # The multiplier on the global learning rate
  }
  convolution_param { # convolution parameter,卷基层参数
    num_output: 50 # 输出特征图(feature map)数量
    kernel_size: 5 # 卷积核大小(卷积核其实就是权值)
    stride: 1 # 滑动步长
    weight_filler { # The filler for the weight
      type: "xavier" # 权值使用xavier滤波
    }
    bias_filler { # The filler for the bias
      type: "constant" # 偏置使用常量滤波
    }
  }
}
layer { # memory required: 51200*4=204800/80000*4=320000
  name: "pool2" # layer名字
  type: "Pooling" # layer类型,Pooling层
  bottom: "conv2" # bottom名字
  top: "pool2" # top名字, shape: 64 50 4 4 (51200)/ 100 50 4 4 (80000)
  pooling_param { # pooling parameter,卷积层参数
    pool: MAX # pooling方法:最大值采样
    kernel_size: 2 # 滤波器大小
    stride: 2 # 滑动步长
  }
}
layer { # memory required: 32000*4=128000/50000*4=200000
  name: "ip1" # layer名字
  type: "InnerProduct" # layer类型,全连接层
  bottom: "pool2" # bottom名字
  top: "ip1" # top名字, shape: 64 500 (32000)/ 100 500 (50000)
  param { # 训练时用到的参数
    lr_mult: 1 # The multiplier on the global learning rate
  }
  param { # 训练时用到的参数
    lr_mult: 2 # The multiplier on the global learning rate
  }
  inner_product_param { # 全连接层参数
    num_output: 500 # 输出特征图(feature map)数量
    weight_filler { # The filler for the weight
      type: "xavier" # 权值使用xavier滤波
    }
    bias_filler { # The filler for the bias
      type: "constant" # 偏置使用常量滤波
    }
  }
}
# ReLU: Given an input value x, The ReLU layer computes the output as x if x > 0 and 
# negative_slope * x if x <= 0. When the negative slope parameter is not set,
# it is equivalent to the standard ReLU function of taking max(x, 0).
# It also supports in-place computation, meaning that the bottom and
# the top blob could be the same to preserve memory consumption
layer { # memory required: 32000*4=128000/50000*4=200000
  name: "relu1" # layer名字
  type: "ReLU" # layer类型
  bottom: "ip1" # bottom名字
  top: "ip1" # top名字 (in-place), shape: 64 500 (32000)/ 100 500 (50000)
}
layer { # memory required: 640*4=2560/1000*4=4000
  name: "ip2" # layer名字
  type: "InnerProduct" # layer类型,全连接层
  bottom: "ip1" # bottom名字
  top: "ip2" # top名字, shape: 64 10 (640)/ 100 10 (1000)
  param { # 训练时用到的参数
    lr_mult: 1 # The multiplier on the global learning rate
  }
  param { # 训练时用到的参数
    lr_mult: 2 # The multiplier on the global learning rate
  }
  inner_product_param { # 全连接层参数
    num_output: 10 # 输出特征图(feature map)数量
    weight_filler { # The filler for the weight
      type: "xavier" # 权值使用xavier滤波
    }
    bias_filler { # The filler for the bias
      type: "constant" # 偏置使用常量滤波
    }
  }
}
# test阶段会创建一个layer: ip2_ip2_0_split,如下:
# layer_factory.hpp:75] Creating layer ip2_ip2_0_split
# net.cpp:110] Creating Layer ip2_ip2_0_split
# net.cpp:476] ip2_ip2_0_split <- ip2
# net.cpp:432] ip2_ip2_0_split -> ip2_ip2_0_split_0
# net.cpp:432] ip2_ip2_0_split -> ip2_ip2_0_split_1
# net.cpp:155] Setting up ip2_ip2_0_split
# net.cpp:163] Top shape: 100 10 (1000)
# net.cpp:163] Top shape: 100 10 (1000)
layer { # memory required: 1*4=4
  name: "accuracy" # layer名字
  type: "Accuracy" # layer类型,计算输出准确率
  bottom: "ip2" # bottom名字
  bottom: "label" # bottom名字
  top: "accuracy" # top名字, shape: (1)
  include { # 指定何时将此layer accuracy包含到网络中
    phase: TEST # 测试阶段会将此layer accuracy包含到此网络中
  }
}
# SoftmaxWithLoss: Computes the multinomial logistic loss for a one-of-many
# classification task, passing real-valued predictions through a
# softmax to get a probability distribution over classes.
layer { # memory required: 1*4=4/1*4=4
  name: "loss" # layer名字
  type: "SoftmaxWithLoss" # layer类型
  bottom: "ip2" # bottom名字
  bottom: "label" # bottom名字
  top: "loss" # top名字, shape: (1)/ (1)
}

# 在训练网络中,占用总内存大小为:200960+2949120+737280+819200+204800+128000+128000+2560+4=5169924
# 在测试网络中,占用总内存大小为:314000+(100+100)*4+4608000+1152000+1280000+320000+200000+200000+4000+(1000+1000)*4+4+4=8086808
lenet_train_test.prototxt可视化结果如下图( http://ethereon.github.io/netscope/quickstart.html):此视图给出的是train阶段时的流程图,不包括测试阶段:


(5)、创建训练网络Net对象,并调用Net类的InitTrainNet函数构建训练网络,训练网络输出结果如下:

name: "LeNet"
state {
  phase: TRAIN
}
layer {
  name: "mnist"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    scale: 0.00390625
  }
  data_param {
    source: "E:/GitCode/Caffe_Test/test_data/MNIST/train"
    batch_size: 64
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 20
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 50
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "ip1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "ip1"
  top: "ip1"
}
layer {
  name: "ip2"
  type: "InnerProduct"
  bottom: "ip1"
  top: "ip2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 10
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "ip2"
  bottom: "label"
  top: "loss"
}
(6)、创建测试网络Net对象,并调用Net类的InitTestNets函数构建测试网络,测试网络输出结果如下:

name: "LeNet"
state {
  phase: TEST
}
layer {
  name: "mnist"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  transform_param {
    scale: 0.00390625
  }
  data_param {
    source: "E:/GitCode/Caffe_Test/test_data/MNIST/test"
    batch_size: 100
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 20
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 50
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "ip1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "ip1"
  top: "ip1"
}
layer {
  name: "ip2"
  type: "InnerProduct"
  bottom: "ip1"
  top: "ip2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 10
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "ip2"
  bottom: "label"
  top: "accuracy"
  include {
    phase: TEST
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "ip2"
  bottom: "label"
  top: "loss"
}
(7)、调用SGDSolver类的PreSolve函数。

7.        调用Solver类的Solve函数开始进行训练和测试:

(1)、当训练次数是500的倍数时(在lenet_solver.prototxt中设置test_interval为500),执行一次测试网络的Forward计算,循环100次(在lenet_solver.prototxt中设置test_iter为100,在lenet_train_test.prototxt文件中,测试阶段batch size为100,这样100*100=10000正好覆盖到所有的测试图像),测试网络最终会有两个结果输出,一个是accuracy,一个是loss;

(2)、执行一次训练网络的ForwardBackward计算,训练网络最终会有一个结果输出即loss;

(3)、更新训练网络的权值和偏置;

(4)、每训练5000次(在lenet_solver.prototxt中设置snapshot为5000)保存一次结果,包括.caffemodel和.caffestate;

(5)、按照以上(1)、(2)、(3)、(4)中的步骤,循环执行10000次(在lenet_solver.prototxt中设置max_iter为10000)。

精简后的mnist train代码如下:

#include "funset.hpp"
#include "common.hpp"

int mnist_train()
{
	caffe::Caffe::set_mode(caffe::Caffe::CPU);

	const std::string filename{ "E:/GitCode/Caffe_Test/test_data/model/mnist/lenet_solver.prototxt" };
	caffe::SolverParameter solver_param;
	if (!caffe::ReadProtoFromTextFile(filename.c_str(), &solver_param)) {
		fprintf(stderr, "parse solver.prototxt fail\n");
		return -1;
	}

	mnist_convert(); // convert MNIST to LMDB

	boost::shared_ptr<caffe::Solver<float> > solver(caffe::GetSolver<float>(solver_param));
	solver->Solve();

	fprintf(stderr, "train finish\n");
	return 0;
}
train最终结果如下:



GitHubhttps://github.com/fengbingchun/Caffe_Test

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Caffe中对MNIST执行train操作执行流程解析 的相关文章

  • caffe im2col 详解

    caffe im2col详解 本文讲解的是caffe中卷积过程 众所周知caffe中卷积采用的是im2col和sgemm的方式 网上已经有很多的im2col的讲解 原本不打算写这篇文章 在此不得不吐槽下 网上有不少的讲解caffe im2c
  • 如何验证 CuDNN 安装?

    我搜索了很多地方 但我得到的只是如何安装它 而不是如何验证它是否已安装 我可以验证我的 NVIDIA 驱动程序是否已安装 并且 CUDA 是否已安装 但我不知道如何验证 CuDNN 是否已安装 非常感谢您的帮助 谢谢 PS 这是用于咖啡实现
  • Windows 版 Caffe 中的未知图层类型(裁剪)

    我想使用以下卷积神经网络 http lmb informatik uni freiburg de people ronneber u net 与咖啡构建https github com BVLC caffe tree windows 适用于
  • 大图像的语义分割

    我正在处理数量有限的大尺寸图像 每个图像都可以有3072 3072像素 为了使用 FCN 或 U net 训练语义分割模型 我构建了一个大样本的训练集 每个训练图像是128 128 在预测阶段 我所做的是将大图像切成小块 与训练集相同128
  • 如何修改批量归一化层(DeconvNet)以便能够与 caffe 一起运行?

    我想运行反卷积网络在我的数据上 但是它似乎是为另一个版本编写的caffe 有谁知道如何改变batch params Deconvnet 中的那个 layers bottom conv1 1 top conv1 1 name bn1 1 ty
  • Caffe sigmoid交叉熵损失

    我正在使用 sigmoid 交叉熵损失函数来解决多标签分类问题 如下所示本教程 然而 在他们的教程结果和我的结果中 输出预测都在范围内 Inf Inf 而 sigmoid 的范围是 0 1 sigmoid 仅在反向传播中处理吗 也就是说 前
  • 如何将 cv::MAT 转换为 NHCW 格式?

    在User Guide html中 tensorRT的输入 输出需要使用NCHW格式 什么是 NCHW 格式 如何将 cv MAT 转换为 NCHW 格式 我使用 TensorRT 运行推理 如下代码所示 没有任何错误 但是 这不是正确的输
  • 三元组损失的softmax版本的梯度计算

    我一直在尝试在Caffe中实现softmax版本的三元组损失 描述于 霍弗和艾隆 使用三元组网络进行深度度量学习 ICLR 2015 我已经尝试过这个 但我发现很难计算梯度 因为指数中的 L2 不是平方的 有人可以帮我吗 使用现有的 caf
  • 如何在caffe中将多个N维数组输入到网络中?

    我想在 caffe 中创建一个用于语义分割的自定义损失层 需要多个输入 我希望这个损失函数有一个额外的输入因子 以惩罚小物体的漏检 为此 我创建了一个图像 GT 其中每个像素都包含一个权重 如果像素属于小物体 则权重较高 我是 caffe
  • 使用 Caffe 没有提高 RMSprop、Adam、AdaDelta 测试精度

    I am finetuning using Caffe在图像数据集上Tesla K40 用一个batch size 47 solver type SGD base lr 0 001 lr policy step momentum 0 9 g
  • Caffe 到 Tensorflow(Kaffe by Ethereon):TypeError:不应直接创建描述符,而只能从其父级检索

    我想使用 ethereon 的精彩包 caffe tensorflow 但遇到了中描述的相同问题这个已关闭的问题 https github com ethereon caffe tensorflow issues 10 当我运行该示例或尝试
  • Caffe 求解器中的average_loss 字段有什么用?

    有什么用average loss 有人可以举个例子或者用通俗易懂的语言解释一下吗 您可以在caffe proto https github com BVLC caffe blob master src caffe proto caffe p
  • Caffe 快照:.solverstate 与 .caffemodel

    训练网络时 每 N 次迭代拍摄的快照有两种形式 一个是 solverstate 文件 我想它就像它听起来的那样 存储损失函数和梯度的状态等 另一个是 caffemodel 文件 我知道它存储训练后的参数 如果您想要预训练的模型 caffem
  • 如何更改CUDA版本

    我在编译修改后的caffe版本时遇到了这个错误 OpenCV static library was compiled with CUDA 7 5 support Please use the same version or rebuild
  • caffe: **group** 参数是什么意思?

    我已阅读有关的文档group param group g 默认 1 如果 g gt 1 我们将每个过滤器的连接限制为输入的子集 具体地 将输入和输出通道分为g组 第i个输出组通道将仅与第i个输入组通道连接 但首先我不明白它们的确切含义 其次
  • 如何在prototxt文件中写注释?

    我找不到如何写评论prototxt files 有没有办法在 prototxt 文件中添加注释 如何 Thanks 您可以通过添加评论 char 之后的行中的所有内容都是注释 layer name aLayerWithComments I
  • Caffe 的 LSTM 模块

    有谁知道 Caffe 是否有一个不错的 LSTM 模块 我从 russel91 的 github 帐户中找到了一个 但显然包含示例和解释的网页消失了 以前是http apollo deepmatter io http apollo deep
  • 如何在 Caffe 中从头开始训练 ResNet101 模型?

    我正在使用深度实验室 v2 https bitbucket org aquariusjay deeplab public ver2Caffe 版本 以便进行语义分割 我可以使用 imagenet 模型微调 ResNet101 但无法使用自定
  • 如何在 Caffe 中沿着通道分割 Blob

    我想在Caffe中分割Blob通道 这样我就可以分割一个Blob N c w h 分成两个大小相同的输出 Blob N c 2 w h 我上面描述的是非常笼统的 我实际上想做的是将一个两通道输入图像分离成两个不同的图像 一个进入卷积层 另一
  • 如何在Python中导入caffe模块?

    我在 Windows 发布版 x64 上构建了 caffe cpp 的 dll 我将扩展名 dll 更改为 pyd 并尝试将其导入到 python 中 import caffe File caffe master python caffe

随机推荐

  • 【python】20行代码实现有道翻译api接口调用

    文章目录 1 目标站点 2 完整代码 3 测试样例 3 1 测试样例 汉译英 3 2 测试样例 英译汉 4 调用文档 4 1 接口地址 4 2 请求方法 4 3 请求参数 4 4 请求示例 4 5 成功响应 5 接口分析 6 相关推荐 1
  • GDB下查看内存命令(x命令)

    GDB下查看内存命令 x命令 你可以使用examine命令 简写是x 来查看内存地址中的值 x命令的语法如下所示 x
  • 计算机软件摊销会计分录,财务软件摊销会计分录怎么写?

    摘要 这是一篇关于财务软件摊销会计分录怎么写 的文章 在财务软件摊销会计分录怎么写 文章中给各位财务人员讲解的是有关财务软件摊销会计分录怎么写 的会计实务处理 财务软件摊销会计分录怎么写 外帐按规定财务软件应该按无形资产处理10年摊销 或跟
  • vcruntime140.dll无法继续执行代码?vcruntime140.dll如何修复?只需要3步即可

    vcruntime140 dll是用于Microsoft Visual C Redistributable 可再发行组件 的一部分 它是一个动态链接库文件 包含了该软件包提供的运行库 在许多应用程序和游戏中 vcruntime140 dll
  • 深入理解Java中的BigInteger和 BigDecimal,再也不怕面试了

    Integer类作为int的包装类 能存储的最大整型值为2 31 1 Long类最大为2 63 1 虽然比Integer类大了很多 但是也是有限的 如果想要表示更大的整数 不管是基本数据类型还是它们对应的包装类都无法实现 Java中提供了两
  • 20221102模型调用 报错invalid load key, ‘\x00‘.invalid load key, ‘\x10‘.

    一 模型保存和调用 保存方法不一样 调用方法也不一样 joblib import joblib 保存 joblib dump model model1 pkl 加载 model joblib load open model1 pkl rb
  • 深拷贝构造函数和浅拷贝构造函数

    深拷贝构造函数和浅拷贝构造函数 拷贝构造函数有深拷贝构造函数和浅拷贝构造函数 分类 拷贝构造函数分为深拷贝构造函数和浅拷贝构造函数 区别 浅拷贝 即只复制对象空间 不复制对象资源 深拷贝 既复制对象空间又复制资源 由C 语言提供的默认拷贝构
  • leetcode 3. 无重复字符的最长子串

    题目描述 初始化 ans for 初始化慢指针 0 快指针 0 in 可迭代集合 更新窗口内信息 while 窗口内不符合维护的条件 扩展或者收缩窗口 慢指针移动 if 是合法的答案 更新答案 返回 ans 给定一个字符串 s 请你找出其中
  • Spring Boot2配置Swagger2生成API接口文档

    一 Swagger2介绍 前后端分离开发模式中 api文档是最好的沟通方式 Swagger 是一个规范和完整的框架 用于生成 描述 调用和可视化 RESTful 风格的 Web 服务 及时性 接口变更后 能够及时准确地通知相关前后端开发人员
  • 数据库备份工具有哪些

    本文主要介绍下数据库备份工具 数据库备份工具有很多种 以下是一些常见的数据库备份工具 mysqldump MySQL官方提供的命令行备份工具 适用于MySQL和MariaDB数据库 它可以将数据库导出为SQL文件 方便进行备份和恢复 属于逻
  • 测试用例(进阶篇)(测试的分类)

    目录 一 测试金字塔 二 按照开发阶段划分 1 单元测试 2 集成测试 3 系统测试 4 验收测试 三 按照测试的实施组织划分 1 测试 2 测试 3 第三方 四 按照是否运行划分 1 静态测试 2 动态测试 五 按照是否手工划分 1 手工
  • Jetson Orin NX install Pytorch

    steJInstalling PyTorch for Jetson Platform NVIDIA Docshttps docs nvidia com deeplearning frameworks install pytorch jets
  • JS 常用插件——下拉刷新、上拉加载,左右滑动,移动端调试,图片预览、放大缩小、旋转

    常用插件大全 非常好用 可以达到事半功倍的效果 下拉刷新 上拉加载 mescroll 上下 左右滑动 better scroll 移动端调试 Vconsole 图片预览 放大缩小 旋转 viewerjs 对象转字符串 并以 拼接成URL q
  • Python 将数据写入csv、xlsx、xls文件中(工厂方法、封装、优雅)

    记录 将数据写入csv xlsx xls文件中 工厂方法 封装 优雅 前言 文件目录存放结构 my file save py wrapper verify param py 封装csv my csv py 工厂方法 savedata fac
  • vite、vue3本地页面正常显示不刷新,外网穿透后页面不停刷新

    明明本地不会刷新 但映射到外网就会不停刷新页面 百度了一篇CSDN文章 vite项目 通过外网域名访问 无限刷新 的解决办法 没有解决我的问题 我使用的是natapp进行外网穿透 报错信息是 WebSocket connection to
  • C++ 生成随机数

    C 库有一个名为 rand 的函数 每次调用该函数都将返回一个非负整数 要使用 rand 函数 必须在程序中包含
  • 软件工程第一次阅读作业

    项目 内容 本作业属于北航软件工程课程 博客园班级链接 作业要求请点击链接查看 作业要求 我在这门课程的目标是 成为一个具有一定经验的软件开发人员 这个作业在哪个具体方面帮助我实现目标 让我对自己目前的状况有一个更加清醒的认识 1 快速阅读
  • 【华为OD统一考试A卷

    华为OD统一考试A卷 B卷 新题库说明 2023年5月份 华为官方已经将的 2022 0223Q 1 2 3 4 统一修改为OD统一考试 A卷 和OD统一考试 B卷 你收到的链接上面会标注A卷还是B卷 请注意 根据反馈 目前大部分收到的都是
  • jQuery如何判断input元素是否获得焦点(点击编辑时)

    问题提出 如果你要判断input元素是否获得焦点 或者是否处在活动编辑状态 使用jQuery的 hasFocus 方法或 is focus 方法貌似都无效 搜索网上给出的办法 几乎净是采用上述处理方法 然并卵 都是扯淡 我的解决办法 监听点
  • Caffe中对MNIST执行train操作执行流程解析

    之前在 http blog csdn net fengbingchun article details 49849225 中简单介绍过使用Caffe train MNIST的文章 当时只是仿照caffe中的example实现了下 下面说一下