本文介绍了Caffe MemoryData层和求解器接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试训练网络,但不是使用lmdb或leveldb,而是将数据动态传输到我的网络。因此,我正在按照以下概述的步骤进行操作

I am trying to train a network but rather using lmdb or leveldb, I am feeding data to my network on the fly. So I am following procedure as outlined below


  1. 我的数据已加载到内存数据层中。

  2. 我使用python脚本创建了一个迷你批处理。

  3. 将数据和标签设置为 solver.net.set_input_arrays(batch,labels)

  4. 之后,我调用 solver.step(1)

  1. My data is loaded in Memory Data Layer.
  2. I create a mini batch using a python script.
  3. Set data and label as solver.net.set_input_arrays(batch,labels)
  4. After that I call solver.step(1)

输入SGDSolver。现在我的问题是 solver.solve() solver.step()有什么区别?

Here solver is of type SGDSolver. Now my question is what is the difference between solver.solve() and solver.step()?

第二,这种方法不能让我拥有用于​​测试网络的内存数据层。

2ndly this approach doesn't let me have a memory data layer for test network. Is there any work around for that?

我的solver.prototxt看起来像

My solver.prototxt looks like

net: "/path/to/train_val.prototxt"
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 100000
display: 20
max_iter: 450000
momentum: 0.9
weight_decay: 0.0005
snapshot: 10000
snapshot_prefix: "/path/to/temporal_net_train"
solver_mode: GPU

使用我的方法,每20个迭代网络都会显示出一些输出损耗等。在某些情况下,损耗保持恒定迭代次数,这可能是什么原因。

With my approach every 20th iteration network displays some output loss etc. And somehow loss stays constant over some numbert of iterations, what could be the reason for that.

推荐答案


  1. 求解器之间有什么区别.solve和solver.step?

解决会进行整个培训,无论您有多大限制设置-通常是迭代限制。 步骤仅执行指定的迭代次数。

solve does the entire training run, to whatever limits you've set -- usually the iteration limit. step does only the specified number of iterations.


  1. 如何获取内存数据

如果您不是从受支持的数据通道/格式中读取数据,我会认为您必须编写客户输入例程(您的数据包)。

If you're not reading from a supported data channel / format, I think you have to write a customer input routine (your data package).


  1. 损失在多次迭代中保持不变,这可能是什么原因?

根据周围的影响,有几种可能性。如果损失仅显示了一个值,那么您的反向传播很可能是罪魁祸首。也许您没有正确连接到数据集,也没有得到预期的分类。

There are several possibilities, depending on the surrounding effects. If the loss shows only one value ever, then your back propagation is a likely culprit. Perhaps you're not properly connected to the data set, and you're not getting the expected classifications fed in.

如果损失具有暂时稳定性,但会收敛,不用担心;

If the loss has a temporary stability but then converges decently, don't worry about it; this is likely an effect of training ordering.

如果损失下降得很厉害,然后稳定在固定值上,那么您也做得很好:训练在收敛之前就收敛了用完了迭代。

If the loss declines decently and then settles at a fixed value, then you're also doing well: the training converged before it ran out of iterations.

这篇关于Caffe MemoryData层和求解器接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 11:55