Caffe需要数据洗牌吗? [英] Does Caffe need data to be shuffled?
问题描述
我使用C ++将我的图像数据转换为caffe db格式(leveldb,lmdb)作为示例我使用此代码 imagenet 。
I convert my image data to caffe db format (leveldb, lmdb) using C++ as example I use this code for imagenet.
数据需要改写,我可以写db所有的正数,像00000000111111111,或者数据需要改组,标签应该看起来像010101010110101011010?
Is data need to be shuffled, can I write to db all my positives and then all my negatives like 00000000111111111, or data need to be shuffled and labels should look like 010101010110101011010?
如何caffe从DB数据,它是真的,它使用所有数据的随机子集size = batch_size
?
How caffe sample data from DB, is it true that it use random subset of all data with size = batch_size
?
推荐答案
?如果你不洗牌,想想学习过程; caffe只看到 0
samples - 你期望算法推导什么?简单地预测 0
所有的时间,一切都很酷。如果你在第一个 1
之前有足够的 0
caffe将非常有信心预测总是 0
。
另一方面,如果它经常看到 0
和<$ c的混合$ c> 1 它从头开始学习了有意义的功能,用于分隔示例。
底线:非常有利于洗牌训练样本,特别是当使用基于SGD的方法时。
Should you shuffle the samples? Think about the learning process if you don't shuffle; caffe sees only 0
samples - what do you expect the algorithm to deduce? simply predict 0
all the time and everything is cool. If you have plenty of 0
before you hit the first 1
caffe will be very confident in predicting always 0
. It will be very difficult to move the model from this point.
On the other hand, if it constantly sees a mix of 0
and 1
it learns from the beginning meaningful features for separating the examples.
Bottom line: it is very advantageous to shuffle the training samples, especially when using SGD-based approaches.
AFAIK,caffe不会随机抽样 batch_size
样本,而是在输入数据库<$ c $
AFAIK, caffe does not randomly sample batch_size
samples, but rather goes sequentially over the input DB batch_size
after batch_size
samples.
TL; DR strong>
shuffle。
TL;DR
shuffle.
这篇关于Caffe需要数据洗牌吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!