-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Creating an image LMDB for Caffe2 training, testing, etc. #1755
Comments
Hi. If you want to train the model with multi-gpu you can use the make_image_db command to create the lmdb from image. |
"If you want to train the model with multi-gpu you can use the make_image_db command to create the lmdb from image." |
Hi, @sreelu1995 . Then prepare your images for train. Create a text file specifying the categories that the pictures belong to. This text file(eg. train.labels) is formatted like so,
Excute the make_image_db command then the lmdb will be created. |
@xinqinglxl Thanks for your answer. Just to be clear, does the make_image_db executable create LMDBs that exclusively work as data containers when training on a multi-gpu system? Likewise, is the lmdb_create_example.py script only suitable for cpu usage? Sorry if I am making you repeat yourself, I am just struggling to understand why the LMDB creation method is system specific. |
Sorry, but I 've never used the LMDB created by make_image_db on cpu-training,
I don't think the LMDB creation method is system specific, |
I am running into a problem using the LMDB created by make_image_db executable. For testing purposes, I use the same code to create, train, and test the net found in the MNIST tutorial (https://github.com/caffe2/caffe2/blob/master/caffe2/python/tutorials/MNIST.ipynb), however, instead of downloading the pre-created LMDBs like the tutorial does, I downloaded the MNIST dataset as JPEG files from https://www.kaggle.com/scolianni/mnistasjpg. I am using a sample of this data for my purposes for simplicity (10,000 training | 2,000 validation | 2,000 testing). Steps:
Error: The important line seems to be: Code:
Note that this code is unchanged from the tutorial. Line 71 that the error output was referring to is the line starting with Fix Attempts:
|
I guess maybe the reason is the dimension incompatibility of the input blob. Then, you can switch the input blobs to NCHW or maybe you can change the arg_scope to {"order": "NHWC"} . |
@xinqinglxl Thank you so much. But I still have a doubt. When I check the sample command you have given, you have not specified anywhere the path to the image data set. Or are you specifying the path in the train.labels itself? |
Hi @sreelu1995 The image data set is specified by input_folder parameter, |
In the original Caffe framework, there was an executable under caffe/build/tools called convert_imageset, which took a directory of JPEG images and a text file with labels for each image, and output an LMDB that could be fed to a Caffe model to train, test, etc.
What is the best way to convert raw JPEG images and labels to an LMDB that Caffe2 can ingest using the AddInput() function from this MNIST tutorial on the Caffe2 website (https://github.com/caffe2/caffe2/blob/master/caffe2/python/tutorials/MNIST.ipynb)?
According to my research, you cannot simply create an LMDB file using this tool and feed a Caffe2 model.
The tutorial script just downloads two LMDBs (mnist-train-nchw-lmdb and mnist-test-nchw-lmdb) and passes them to AddInput(), but gives no insight as to how the LMDBs were created.
The text was updated successfully, but these errors were encountered: