Does Caffe need data to be shuffled?

后端 未结 1 1947
时光说笑
时光说笑 2020-12-03 22:52

I convert my image data to caffe db format (leveldb, lmdb) using C++ as example I use this code for imagenet.

Is data need to be shuffled, can I write to db all my p

相关标签:
1条回答
  • 2020-12-03 23:37

    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 does not randomly sample batch_size samples, but rather goes sequentially over the input DB batch_size after batch_size samples.

    TL;DR
    shuffle.

    0 讨论(0)
提交回复
热议问题