caffe icon indicating copy to clipboard operation
caffe copied to clipboard

How to Input data and labels from different lmdb files?

Open kalyanvasudev opened this issue 11 years ago • 4 comments

Hi,

I have separate lmdb files generated for images and labels respectively. Where, the order of images and labels being written to lmdb files is the same.

Now my question is how do I pass these two seprate imdb files in prototxt file? Do I need to create two different data layers? If so, will I face indexing issues (mix up between images and corresponding labels)?

Please help me out here. Thanks a lot!

-Kalyan

kalyanvasudev avatar Jul 12 '15 15:07 kalyanvasudev

Yes, you need to create two data layers, one for each lmdb database. Since the data layer by default assumes that there is both an image and a label, you may need to create two tops (outputs) for each data layer, and then pass one of them to a silence layer to discard it. As long as you have shuffling turned off (which is the default), you won't have indexing problems and everything will be aligned.

You may find it easier to work with the ImageDataLayer, which has a simpler interface and doesn't require creating a special lmdb database. It runs at about the same speed.

Also, please ask questions like this on the caffe-users group (https://groups.google.com/forum/#!forum/caffe-users), as it is unrelated to the codebase.

seanbell avatar Jul 12 '15 16:07 seanbell

Thanks you very much. I have one last question... Wont indexing be a problem if I pass images in batches using two separate lmdb files for data and labels? or will caffe take care of it? If so, I am assuming that batch size for both data layers should be same?

kalyanvasudev avatar Jul 12 '15 21:07 kalyanvasudev

Yes, the batch size of the two layers needs to be the same.

On Sunday, July 12, 2015, kalyanvasudev [email protected] wrote:

Thanks you very much. I have one last question... Wont indexing be a problem if I pass images in batches using two separate lmdb files for data and labels? or will caffe take care of it? If so, I am assuming that batch size for both data layers should be same?

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/2751#issuecomment-120763661.

Cheers, Sean

(Sent from my phone)

seanbell avatar Jul 13 '15 00:07 seanbell

Closing as this is not an issue or bug; you're welcome to continue discussion on caffe-users. Thanks!

longjon avatar Jul 13 '15 06:07 longjon