caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Any simple caffe example on my own training/testing dataset?

Open WanzhengZhu opened this issue 11 years ago • 7 comments

Hi,

I am a very new user of caffe. I just installed caffe and run the mnist example well. However, I don't quite understand how I can use caffe to implement my own dataset? Is there a step by step tutorial can teach me? What should the data format be? Where should I specify the layer specification? How do I see the testing results? Many thanks!!!! Any advice would be appreciated!

WanzhengZhu avatar Mar 05 '15 11:03 WanzhengZhu

Hi, I was having the same issue back then. I've found a Google Groups post that is very useful. I am quoting it;

Note: The Google Groups post happens to be originating from Patrick Wieschollek (PatWie) so he earns the credit here.

"Caffe can read 3 formats (as far as I know):

  • leveldb
  • hdf5
  • lmdb

The easiest way is to store the image somewhere as a JPG (maybe another image format) and then creating two text files (trainingset.txt, testset.txt) in the following format: PATH_TO_IMAGE LABEL PATH_TO_IMAGE LABEL PATH_TO_IMAGE LABEL ...

where LABEL is a number. For me only a relative path from the solver-file to the image file works in PATH_TO_IMAGE. and use the tool (in the tool directory) convert_imageset to create a leveldb (what I prefer) or a lmdb. These db files are those that you have to write into your net-layout-file."

mmclkk avatar Mar 10 '15 02:03 mmclkk

Thanks @mmclkk, I also have similar situation. I still have a question, should the testing and training files have the same format??

waelHamdan avatar Mar 11 '15 03:03 waelHamdan

Thanks @mmclkk
For now, I still couldn't run any example on my own data. The learning speed is very slow, like 2mins per iteration (but I only got 400 pictures) and the testing results is not satisfied.... I might configure something wrong (layer configuration, data type or anything). Can you refer the group post to me so that I can learn also? Thank you!

WanzhengZhu avatar Mar 11 '15 05:03 WanzhengZhu

@WanzhengZhu Hi, groups post is on this link "https://groups.google.com/forum/#!topic/caffe-users/qCjMnTXr4Ro"

@waelHamdan Just from the source code of convert_imageset, I think images should be in the same format since encoding is going to be different on different file formats.

mmclkk avatar Mar 11 '15 09:03 mmclkk

@mmclkk Thank you for your help

I created lmdb, and now I need to configure the solver. I only have two classes, with different number of images, I am still confused about how to choose the iterations

thanks in advance

waelHamdan avatar Mar 11 '15 09:03 waelHamdan

@mmclkk Thank you for your help. Can you share with me how to deal with two classes classification? What is the layer configuration you would recommend? How should i adjust the test_iter? (I don't understand what does test_iter mean? Do you know that?) Thank you in advance!!!!!!! Many appreciation!

WanzhengZhu avatar Mar 11 '15 15:03 WanzhengZhu

test_iter means that how many iterations you want to run for test. Let's say your batch size is 256, then test_iter=10 meaning that you want to run test on 2560 examples.

We welcome you to look at the extensive documentation, tutorials, and examples at http://caffe.berkeleyvision.org/ However, please ask usage questions on caffe-users -- this issues tracker is primarily for Caffe development discussion. Thanks!

n-zhang avatar Mar 13 '15 04:03 n-zhang