如何把caffe train val test好的模型拿来测试数据

Caffe学习系列(23):如何将别人训练好的model用到自己的数据上
Caffe学习系列(23):如何将别人训练好的model用到自己的数据上
caffe团队用imagenet图片进行训练,迭代30多万次,训练出来一个model。这个model将图片分为1000类,应该是目前为止最好的图片分类model了。
假设我现在有一些自己的图片想进行分类,但样本量太小,可能只有几百张,而一般深度学习都要求样本量在1万以上,因此训练出来的model精度太低,根本用不上,那怎么办呢?
那就用caffe团队提供给我们的model吧。
因为训练好的model里面存放的就是一些参数,因此我们实际上就是把别人预先训练好的参数,拿来作为我们的初始化参数,而不需要再去随机初始化了。图片的整个训练过程,说白了就是将初始化参数不断更新到最优的参数的一个过程,既然这个过程别人已经帮我们做了,而且比我们做得更好,那为什么不用他们的成果呢?
使用别人训练好的参数,必须有一个前提,那就是必须和别人用同一个network,因为参数是根据network而来的。当然,最后一层,我们是可以修改的,因为我们的数据可能并没有1000类,而只有几类。我们把最后一层的输出类别改一下,然后把层的名称改一下就可以了。最后用别人的参数、修改后的network和我们自己的数据,再进行训练,使得参数适应我们的数据,这样一个过程,通常称之为微调(fine tuning).
既然前两篇文章我们已经讲过使用digits来进行训练和可视化,这样一个神器怎么能不使用呢?因此本文以此工具为例,讲解整个微调训练过程。
一、下载model参数
可以直接在浏览器里输入地址下载,也可以运行脚本文件下载。下载地址为:
文件名称为:bvlc_reference_caffenet.caffemodel,文件大小为230M左右,为了代码的统一,将这个caffemodel文件下载到caffe根目录下的&models/bvlc_reference_caffenet/ 文件夹下面。也可以运行脚本文件进行下载:
# sudo ./scripts/download_model_binary.py models/bvlc_reference_caffenet
&二、准备数据
如果有自己的数据最好,如果没有,可以下载我的练习数据:
这些数据共有500张图片,分为大巴车、恐龙、大象、鲜花和马五个类,每个类100张。编号分别以3,4,5,6,7开头,各为一类。我从其中每类选出20张作为测试,其余80张作为训练。因此最终训练图片400张(放在train文件夹内,每个类一个子文件夹),测试图片100张(放在test文件夹内,每个类一个子文件夹)。
将图片下载下来后解压,放在一个文件夹内。比如我在当前用户根目录下创建了一个data文件夹,专门用来存放数据,因此我的训练图片路径为:/home/xxx/data/re/train
打开浏览器,运行digits,如果没有这个工具的,推荐安装,真的是学习caffe的神器。安装及使用可参见我的前两篇文章:
新建一个classification dataset,设置如下图:
下面图片格式选为jpg, 为dataset取一个名字,就开始转换吧。结果如图:
三、设置model
回到digits根目录,新建一个classification model, 选中你的dataset, 开始设置最重要的network.
caffenet的网络配置文件,放在 caffe/models/bvlc_reference_caffenet/ 这个文件夹里面,名字叫train_val.prototxt。打开这个文件,将里面的内容复制到上图的Custom Network文本框里,然后进行修改,主要修改这几个地方:
1、修改train阶段的data层为:
name: &data&
type: &Data&
top: &data&
top: &label&
phase: TRAIN
transform_param {
mirror: true
crop_size: 227
即把均值文件(mean_file)、数据源文件(source)、批次大小(batch_size)和数据源格式(backend)这四项都删除了。因为这四项系统会根据dataset和页面左边“solver options&的设置自动生成。
2、修改test阶段的data层:
name: &data&
type: &Data&
top: &data&
top: &label&
phase: TEST
transform_param {
mirror: false
crop_size: 227
和上面一样,也是删除那些项。
3、修改最后一个全连接层(fc8):
name: &fc8-re&
#原来为&fc8&
type: &InnerProduct&
bottom: &fc7&
top: &fc8&
lr_mult: 1.0
decay_mult: 1.0
lr_mult: 2.0
decay_mult: 0.0
inner_product_param {
num_output: 5
#原来为&1000&
weight_filler {
type: &gaussian&
bias_filler {
type: &constant&
value: 0.0
看注释的地方,就只有两个地方修改,其它不变。
设置好后,就可以开始微调了(fine tuning).
训练结果就是一个新的model,可以用来单张图片和多张图片测试。具体测试方法前一篇文章已讲过,在此就不重复了。
在此,将别人训练好的model用到我们自己的图片分类上,整个微调过程就是这样了。如果你不用digits,而直接用命令操作,那就更简单,只需要修改一个train_val.prototxt的配置文件就可以了,其它都是一样的操作。
我的热门文章
即使是一小步也想与你分享caffe如何进行数据集测试??
caffe中.prototxt文件里设置了每迭代多少次测试一次,实际上这个最终模型测试的结果是验证集的结果,如何对数据集进行测试呢???用自带的caffe
-test吗?还是用matlab接口去一张张的测???
谢邀。直接使用caffe test就可以,脚本的写法是这样的:#!/usr/bin/env shGLOG_logtostderr=1 ./build/tools/caffe.bin test --model=/path/to/your/prototxt --weights=/path/to/your/caffemodel
我使用的是caffe-windows,使用这个命令即可:caffe test -model=test_prototxt -weights=model.caffemodel -iterations=n -gpu 0其中model是配置文件,可以指定测试集路径,weights就是训练出的模型,iterations是迭代次数,默认为50次.举个栗子:mnist数据集训练完毕后,得到了lenet_iter_10000.caffemodel,如果想要在测试集上测试,只需要将lenet_train_test.prototxt中验证集路径改成你的测试集路径即可:ok,接下来进行测试:ok,接下来进行测试:caffe test -model=lenet_train_test.prototxt weights=lenet_iter_10000.caffemodel -iterations=100 -gpu 0
由于测试batch_size为100,所以迭代次数设置为100,这样就可以测试完所有的10000张图片,结果如下:以上以上
已有帐号?
无法登录?
社交帐号登录Caffe应该是目前深度学习领域应用最广泛的几大框架之一了,尤其是视觉领域。绝大多数用Caffe的人,应该用的都是基于分类的网络,但有的时候也许会有基于回归的视觉应用的需要,查了一下Caffe官网,还真没有很现成的例子。这篇举个简单的小例子说明一下如何用Caffe和卷积神经网络(CNN: Convolutional Neural Networks)做基于回归的应用。
最经典的CNN结构一般都是几个卷积层,后面接全连接(FC: Fully Connected)层,最后接一个Softmax层输出预测的分类概率。如果把图像的矩阵也看成是一个向量的话,CNN中无论是卷积还是FC,就是不断地把一个向量变换成另一个向量(事实上对于单个的filter/feature channel,Caffe里最基础的卷积实现就是向量和矩阵的乘法:),最后输出就是一个把制定分类的类目数作为维度的概率向量。因为神经网络的风格算是黑盒子学习,所以很直接的想法就是把最后输出的向量的值直接拿来做回归,最后优化的目标函数不再是cross entropy等,而是直接基于实数值的误差。
EuclideanLossLayer
Caffe内置的就是用来解决上面提到的实值回归的一个办法。EuclideanLossLayer计算如下的误差:
\begin{align}\notag
\frac 1 {2N} \sum_{i=1}^N \| x^1_i - x^2_i \|_2^2
\end{align}
所以很简单,把标注的值和网络计算出来的值放到EuclideanLossLayer比较差异就可以了。
给图像混乱程度打分的简单例子
用一个给图像混乱程度打分的简单例子来说明如何使用Caffe和EuclideanLossLayer进行回归。
生成基于Ising模型的数据
这里采用统计物理里非常经典的Ising模型的模拟来生成图片,Ising模型可能是统计物理里被人研究最多的模型之一,不过这篇不是讲物理,就略过细节,总之基于这个模型的模拟可以生成如下的图片:
图片中第一个字段是编号,第二个字段对应的分数可以大致认为是图片的有序程度,范围0~1,而这个例子要做的事情就是用一个CNN学习图片的有序程度并预测。
生成图片的Python脚本源于,基于Metropolis算法对Ising模型的模拟,做了一些并行和随机生成图片的修改,在每次模拟的时候随机取一个时间(1e3到1e7之间)点输出到图片,代码如下:
import sys
import datetime
from multiprocessing import Process
import numpy as np
from matplotlib import pyplot
LATTICE_SIZE = 100
SAMPLE_SIZE = 12000
STEP_ORDER_RANGE = [3, 7]
SAMPLE_FOLDER = 'samples'
#----------------------------------------------------------------------#
Check periodic boundary conditions
#----------------------------------------------------------------------#
def bc(i):
if i+1 & LATTICE_SIZE-1:
if i-1 & 0:
return LATTICE_SIZE - 1
#----------------------------------------------------------------------#
Calculate internal energy
#----------------------------------------------------------------------#
def energy(system, N, M):
return -1 * system[N,M] * (system[bc(N-1), M] \
+ system[bc(N+1), M] \
+ system[N, bc(M-1)] \
+ system[N, bc(M+1)])
#----------------------------------------------------------------------#
Build the system
#----------------------------------------------------------------------#
def build_system():
system = np.random.random_integers(0, 1, (LATTICE_SIZE, LATTICE_SIZE))
system[system==0] = - 1
return system
#----------------------------------------------------------------------#
The Main monte carlo loop
#----------------------------------------------------------------------#
def main(T, index):
score = np.random.random()
order = score*(STEP_ORDER_RANGE[1]-STEP_ORDER_RANGE[0]) + STEP_ORDER_RANGE[0]
stop = np.int(np.round(np.power(10.0, order)))
print('Running sample: {}, stop @ {}'.format(index, stop))
sys.stdout.flush()
system = build_system()
for step in range(stop):
M = np.random.randint(0, LATTICE_SIZE)
N = np.random.randint(0, LATTICE_SIZE)
E = -2. * energy(system, N, M)
if E &= 0.:
system[N,M] *= -1
elif np.exp(-1./T*E) & np.random.rand():
system[N,M] *= -1
#if step % 100000 == 0:
print('.'),
sys.stdout.flush()
filename = '{}/'.format(SAMPLE_FOLDER) + '{:0&5d}'.format(index) + '_{}.jpg'.format(score)
pyplot.imsave(filename, system, cmap='gray')
print('Saved to {}!\n'.format(filename))
sys.stdout.flush()
#----------------------------------------------------------------------#
Run the menu for the monte carlo simulation
#----------------------------------------------------------------------#
def run_main(index, length):
np.random.seed(datetime.datetime.now().microsecond)
for i in xrange(index, index+length):
main(0.1, i)
def run():
cmd = 'mkdir -p {}'.format(SAMPLE_FOLDER)
os.system(cmd)
n_processes = 8
length = int(SAMPLE_SIZE/n_processes)
processes = [Process(target=run_main, args=(x, length)) for x in np.arange(n_processes)*length]
for p in processes:
for p in processes:
if __name__ == '__main__':
在这个例子中一共随机生成了10的灰度图片,命名的规则是[编号]_[有序程度].jpg。至于有序程度为什么用0~1之间的随机数而不是模拟的时间步数,是因为虽说理论上三层神经网络就能逼近任意函数,不过具体到实际训练中还是应该对数据进行预处理,尤其是当目标函数是L2 norm的形式时,如果能保持数据分布均匀,模型的收敛性和可靠性都会提高,范围0到1之间是为了方便最后一层Sigmoid输出对比,同时也方便估算模型误差。还有一点需要注意是,因为图片本身就是模特卡罗模拟产生的,所以即使是同样的有序度的图片,其实看上去不管是主观还是客观的有序程度都是有差别的。
还要提一句的是。。我用Ising的模拟作为例子只是因为很喜欢这个模型,其实用随机相位的反傅里叶变换然后二值化就能得到几乎没什么差别的图像,有序程度就是截止频率,并且更快更简单。
生成训练/验证/测试集
把Ising模拟生成的12000张图片划分为三部分:1w作为训练数据;1k作为验证集;剩下1k作为测试集。下面的Python代码用来生成这样的训练集和验证集的列表:
import numpy
filename2score = lambda x: x[:x.rfind('.')].split('_')[-1]
img_files = sorted(os.listdir('samples'))
with open('train.txt', 'w') as train_txt:
for f in img_files[:10000]:
score = filename2score(f)
line = 'samples/{} {}\n'.format(f, score)
train_txt.write(line)
with open('val.txt', 'w') as val_txt:
for f in img_files[]:
score = filename2score(f)
line = 'samples/{} {}\n'.format(f, score)
val_txt.write(line)
with open('test.txt', 'w') as test_txt:
for f in img_files[11000:]:
line = 'samples/{}\n'.format(f)
test_txt.write(line)
生成HDF5文件
lmdb虽然又快又省空间,可是Caffe默认的生成lmdb的工具(convert_imageset)不支持浮点类型的数据,虽然caffe.proto里Datum的定义似乎是支持的,不过相应的代码改动还是比较麻烦。相比起来HDF又慢又占空间,但简单好用,如果不是海量数据,还是个不错的选择,这里用HDF来存储用于回归训练和验证的数据,下面是一个生成HDF文件和供Caffe读取文件列表的脚本:
import sys
import numpy
from matplotlib import pyplot
import h5py
IMAGE_SIZE = (100, 100)
MEAN_VALUE = 128
filename = sys.argv[1]
setname, ext = filename.split('.')
with open(filename, 'r') as f:
lines = f.readlines()
numpy.random.shuffle(lines)
sample_size = len(lines)
imgs = numpy.zeros((sample_size, 1,) + IMAGE_SIZE, dtype=numpy.float32)
scores = numpy.zeros(sample_size, dtype=numpy.float32)
h5_filename = '{}.h5'.format(setname)
with h5py.File(h5_filename, 'w') as h:
for i, line in enumerate(lines):
image_name, score = line[:-1].split()
img = pyplot.imread(image_name)[:, :, 0].astype(numpy.float32)
img = img.reshape((1, )+img.shape)
img -= MEAN_VALUE
imgs[i] = img
scores[i] = float(score)
if (i+1) % 1000 == 0:
print('processed {} images!'.format(i+1))
h.create_dataset('data', data=imgs)
h.create_dataset('score', data=scores)
with open('{}_h5.txt'.format(setname), 'w') as f:
f.write(h5_filename)
需要注意的是Caffe中HDF的DataLayer不支持transform,所以数据存储前就提前进行了减去均值的步骤。保存为gen_hdf.py,依次运行命令生成训练集和验证集:
python gen_hdf.py train.txt
python gen_hdf.py val.txt
用一个简单的小网络训练这个基于回归的模型:
网络结构的train_val.prototxt如下:
name: &RegressionExample&
name: &data&
type: &HDF5Data&
top: &data&
top: &score&
phase: TRAIN
hdf5_data_param {
source: &train_h5.txt&
batch_size: 64
name: &data&
type: &HDF5Data&
top: &data&
top: &score&
phase: TEST
hdf5_data_param {
source: &val_h5.txt&
batch_size: 64
name: &conv1&
type: &Convolution&
bottom: &data&
top: &conv1&
lr_mult: 1
decay_mult: 1
lr_mult: 1
decay_mult: 0
convolution_param {
num_output: 96
kernel_size: 5
weight_filler {
type: &gaussian&
bias_filler {
type: &constant&
name: &relu1&
type: &ReLU&
bottom: &conv1&
top: &conv1&
name: &pool1&
type: &Pooling&
bottom: &conv1&
top: &pool1&
pooling_param {
kernel_size: 3
name: &conv2&
type: &Convolution&
bottom: &pool1&
top: &conv2&
lr_mult: 1
decay_mult: 1
lr_mult: 1
decay_mult: 0
convolution_param {
num_output: 96
kernel_size: 3
weight_filler {
type: &gaussian&
bias_filler {
type: &constant&
name: &relu2&
type: &ReLU&
bottom: &conv2&
top: &conv2&
name: &pool2&
type: &Pooling&
bottom: &conv2&
top: &pool2&
pooling_param {
kernel_size: 3
name: &conv3&
type: &Convolution&
bottom: &pool2&
top: &conv3&
lr_mult: 1
decay_mult: 1
lr_mult: 1
decay_mult: 0
convolution_param {
num_output: 128
kernel_size: 3
weight_filler {
type: &gaussian&
bias_filler {
type: &constant&
name: &relu3&
type: &ReLU&
bottom: &conv3&
top: &conv3&
name: &pool3&
type: &Pooling&
bottom: &conv3&
top: &pool3&
pooling_param {
kernel_size: 3
name: &fc4&
type: &InnerProduct&
bottom: &pool3&
top: &fc4&
lr_mult: 1
decay_mult: 1
lr_mult: 1
decay_mult: 0
inner_product_param {
num_output: 192
weight_filler {
type: &gaussian&
std: 0.005
bias_filler {
type: &constant&
name: &relu4&
type: &ReLU&
bottom: &fc4&
top: &fc4&
name: &drop4&
type: &Dropout&
bottom: &fc4&
top: &fc4&
dropout_param {
dropout_ratio: 0.35
name: &fc5&
type: &InnerProduct&
bottom: &fc4&
top: &fc5&
lr_mult: 1
decay_mult: 1
lr_mult: 1
decay_mult: 0
inner_product_param {
num_output: 1
weight_filler {
type: &gaussian&
std: 0.005
bias_filler {
type: &constant&
name: &sigmoid5&
type: &Sigmoid&
bottom: &fc5&
top: &pred&
name: &loss&
type: &EuclideanLoss&
bottom: &pred&
bottom: &score&
top: &loss&
其中回归部分由EuclideanLossLayer中比较最后一层的输出和train.txt/val.txt中的分数差并作为目标函数实现。需要提一句的是基于实数值的回归问题,对于方差这种目标函数,SGD的性能和稳定性一般来说都不是很好,Caffe文档里也有提到过这点。不过具体到Caffe中,能用就行。。solver.prototxt如下:
net: &./train_val.prototxt&
test_iter: 2000
test_interval: 500
base_lr: 0.01
lr_policy: &step&
gamma: 0.1
stepsize: 50000
display: 50
max_iter: 10000
momentum: 0.85
weight_decay: 0.0005
snapshot: 1000
snapshot_prefix: &./example_ising&
solver_mode: GPU
type: &Nesterov&
然后训练:
/path/to/caffe/build/tools/caffe train -solver solver.prototxt
随便训了10000个iteration,反正是收敛了
把train_val.prototxt的两个data layer替换成input_shape,然后去掉最后一层EuclideanLoss就可以了,input_shape定义如下:
input: &data&
input_shape {
改好后另存为deploy.prototxt,然后把训好的模型拿来在测试集上做测试,pycaffe提供了非常方便的接口,用下面脚本输出一个文件列表里所有文件的预测结果:
import sys
import numpy
sys.path.append('/opt/caffe/python')
import caffe
WEIGHTS_FILE = 'example_ising_iter_10000.caffemodel'
DEPLOY_FILE = 'deploy.prototxt'
IMAGE_SIZE = (100, 100)
MEAN_VALUE = 128
caffe.set_mode_cpu()
net = caffe.Net(DEPLOY_FILE, WEIGHTS_FILE, caffe.TEST)
net.blobs['data'].reshape(1, 1, *IMAGE_SIZE)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))
transformer.set_mean('data', numpy.array([MEAN_VALUE]))
transformer.set_raw_scale('data', 255)
image_list = sys.argv[1]
with open(image_list, 'r') as f:
for line in f.readlines():
filename = line[:-1]
image = caffe.io.load_image(filename, False)
transformed_image = transformer.preprocess('data', image)
net.blobs['data'].data[...] = transformed_image
output = net.forward()
score = output['pred'][0][0]
print('The predicted score for {} is {}'.format(filename, score))
对test.txt执行后,前20个文件的结果:
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.8
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.9
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.9
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
The predicted score for samples/.jpg is 0.
看上去还不错,挑几张看看:
再输出第一层的卷积核看看:
可以看到第一层的卷积核成功学到了高频和低频的成分,这也是这个例子中判断有序程度的关键,其实就是高频的图像就混乱,低频的就相对有序一些。Ising的自旋图虽然都是二值的,不过学出来的模型也可以随便拿一些别的图片试试:
嗯。。定性看还是差不多的。
阅读(...) 评论()如何使用caffe for windows训练自己的数据??_百度知道用自己的数据训练和测试“Imagenet”
核心提示:数据准备在 data 中新建文件夹 myself,本人在网上下载了训练猫的图片 50 张,测试猫 10 张,训练鸟的图片 50 张,测试鸟 10 张。如图所示:如果坚持用 Imagenet 的话,我们还需要...1 数据准备在 data 中新建文件夹 myself,本人在网上下载了训练猫的图片 50 张,测试猫 10 张,训练鸟的图片 50 张,测试鸟 10 张。如图所示:如果坚持用 Imagenet 的话,我们还需要一些标签数据进行训练,用以下指令可以下载,如果不用,就可以不执行下面指令。cd $CAFFE_ROOT/data/ilsvrc12/./get_ilsvrc_aux.sh培训和测试的输入是用 train.txt 和 val.txt描述的,这些文档列出所有文件和他们的标签。注意,我们分类的名字是 ASCII 码的顺序,即 0-999,对应的分类名和数字的映射在synset_words.txt(自己写)中。运行以下指令:find -name *.jpeg |cut -d
-f2-3 & train.txt注意路径然后,因为样本数比较少,可以自行手动做分类标签。在 train.txt 的每个照片后用 0-999分类。当样本过多,就自己编写指令批量处理。同理,获得 val.txttest.txt 和 val.txt 一样,不过后面不能标签,全部设置成 0。然后在 caffe-master/examples 创建 myself 文件夹,然后将 imagenet 的create_imagenet.sh. 复制到该文件夹下进行修改,进行训练和测试路径的设置,运行该 sh.将RELIZE=false改成true2 计算图像均值模型需要我们从每张图片减去均值,所以我们必须获得训练的均值,用tools/compute_image_mean.cpp 实现,这个 cpp 是一个很好的例子去熟悉如何操作多个组建,例如协议的缓冲区,leveldbs,登录等。我们可以直接复制 imagenet 的./make_imagenet_mean.加以修改应用就行,注意路径。3 网络的定义从 imagenet 中复制修改 imagenet_train.prototxt,注意修改数据层的路径。source:
ilvsrc12_train_leveldb mean_file:
../../data/ilsvrc12/imagenet_mean.binaryproto 改成自己的LMDB 同理,复制修改 imagenet_val.prototxt.改成自己的LMDB如果你细心观察 imagenet_train.prototxt andimagenet_val.prototxt,你会发现他们除了数据来源不同和最后一层不同,其他基本相同。在训练中,我们用一个 softmax——loss 层计算损失函数和初始化反向传播,而在验证,我们使用精度层检测我们的精度。我们还有一个运行的协议 imagenet_train.prototxt,复制过来,从里面可以观察到,我们将运行 256 批次,迭代
次(90 期),每 1000 次迭代,我们测试学习网络验证数据,我们设置初始的学习率为 0.01,每
期)次迭代减少学习率,显示一次信息,训练的 weight_decay 为 0.0005,每
次迭代,我们显示一下当前状态。以上是教程的,实际上,以上需要耗费很长时间,因此,我们稍微改一下test_iter: 1000 是指测试的批次,我们就 10 张照片,设置 10 就可以了。test_interval: 1000 是指每 1000 次迭代测试一次,我们改成 500 次测试一次。base_lr: 0.01 是基础学习率,因为数据量小,0.01 就会下降太快了,因此改成 0.001lr_policy:
step 学习率变化gamma: 0.1 学习率变化的比率stepsize:
次迭代减少学习率display: 20 每 20 层显示一次max_iter:
最大迭代次数,momentum: 0.9 学习的参数,不用变weight_decay: 0.0005 学习的参数,不用变snapshot:
次显示状态,这里改为 2000 次solver_mode: CPU 末尾加一行,代表用 CPU 进行4 训练把./train_imagenet.sh 复制过来运行5 恢复数据我们用指令./resume_training.sh 即可。}

我要回帖

更多关于 caffe train val test 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信