Search code examples
neural-networkdeep-learningcaffeconv-neural-network

How to use convert_imageset in caffe for images which are not put in one folder?


I'm trying to train a CNN on my own dataset using Caffe framework, and it is highly recommended that the dataset be converted to the lmdb or leveldb formats due to speed efficiency. To do so, all images must be put into a single folder and the 'list.txt' must be prepared accordingly. My own dataset is so huge and in so many folders and subfolders so that it would be so laborious copy all of them into a single folder. Thereforeو I'm wondering to know whether there exist any alternative way to generate the lmdb file without need to copy all images into a single folder.


Solution

  • There are (at least) two solutions to your problem.

    1. Don't copy the files to a single folder, just create symbolic links.

    2. All the images do not have to be in the same folder. You can have full paths in 'list.txt' file. For example:

    /path/to/image.jpg 0
    /another/path/class01.jpg 1
    /yet/another/path/class0.jpg 0

    And so on...