How to convert the image data to LMDB data?

6,670 views
Skip to first unread message

china...@gmail.com

unread,
Dec 29, 2014, 9:04:05 AM12/29/14
to caffe...@googlegroups.com
I want to convert the image and label to LMDB to train a net. Although I have read some caffe's examples, I still don't know the method. I want to get the detail  about how to finish that.
And I also try to use convert_imageset.cpp. But there are many errors when I compile it.  When the file use relative path, it show that can't find the files. Then I change it to absolute path. After that, it show many files(google::InitGoogleLogging(char const*),etc) undefined used. Who can tell me why? Thanks very much.

Prasanna Gyawali

unread,
Jan 8, 2015, 4:23:24 AM1/8/15
to caffe...@googlegroups.com
convert_imageset.cpp is exactly the file you are looking for. Try to fix the errors as using this file I also have created both leveldb and LMDB file. Best of luck!

user

unread,
Mar 11, 2015, 10:12:31 AM3/11/15
to caffe...@googlegroups.com
can you please explain to me how to use this convert_imageset.cpp?
In the case of a shell script (like create_imagenet.sh) you just change the paths to the data and run it in the terminal
So what are the steps to do, when i have my text files and want to convert them with convert_imageset.cpp.

Thanks a lot!

Carlos Treviño

unread,
Jun 1, 2015, 2:09:56 PM6/1/15
to caffe...@googlegroups.com
Hi,

I'm also struggling trying to create my own lmdb data, but the next message appears:

MacBook-Pro:caffe CarlosTrevino$ GLOG_logtostderr=1 $TOOLS/convert_imageset.cpp

tools/convert_imageset.cpp: line 1: //: is a directory

tools/convert_imageset.cpp: line 2: //: is a directory

tools/convert_imageset.cpp: line 3: //: is a directory

tools/convert_imageset.cpp: line 4: //: is a directory

tools/convert_imageset.cpp: line 5: //: is a directory

tools/convert_imageset.cpp: line 6: //: is a directory

tools/convert_imageset.cpp: line 7: //: is a directory

tools/convert_imageset.cpp: line 8: //: is a directory

tools/convert_imageset.cpp: line 9: //: is a directory

tools/convert_imageset.cpp: line 26: syntax error near unexpected token `('

tools/convert_imageset.cpp: line 26: `using namespace caffe;  // NOLINT(build/namespaces)'

Any ideas?

-Carlos

林子達

unread,
Jun 1, 2015, 8:58:58 PM6/1/15
to caffe...@googlegroups.com
You should run its binary file
$ ./.build_release/tools/convert_imageset
Result:
convert_imageset: Convert a set of images to the leveldb/lmdb
format used as input for Caffe.
Usage:
    convert_imageset [FLAGS] ROOTFOLDER/ LISTFILE DB_NAME
The ImageNet dataset for the training demo is at


  Flags from tools/convert_imageset.cpp:
    -backend (The backend {lmdb, leveldb} for storing the result) type: string
      default: "lmdb"
    -check_size (When this option is on, check that all the datum have the same
      size) type: bool default: false
    -encode_type (Optional: What type should we encode the image as
      ('png','jpg',...).) type: string default: ""
    -encoded (When this option is on, the encoded image will be save in datum)
      type: bool default: false
    -gray (When this option is on, treat images as grayscale ones) type: bool
      default: false
    -resize_height (Height images are resized to) type: int32 default: 0
    -resize_width (Width images are resized to) type: int32 default: 0
    -shuffle (Randomly shuffle the order of images and their labels) type: bool
      default: false



Carlos Treviño於 2015年6月2日星期二 UTC+8上午2時09分56秒寫道:
Message has been deleted

文小森

unread,
Jun 15, 2015, 10:23:13 PM6/15/15
to caffe...@googlegroups.com
I also have this problem,when I want to convert the image and label to LMDB to train a net.The terminal display:
/home/cwt/work/caffe-master/data/mydata/train.txt: 10990: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2462.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10991: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2463.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10992: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2464.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10993: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2465.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10994: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2466.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10995: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2467.jpg: not found
/home/cwt/work/caffe-master/data/mydata/train.txt: 10996: /home/cwt/work/caffe-master/data/mydata/train.txt: four/four2468.jpg: not found


在 2014年12月29日星期一 UTC+8下午10:04:05,china...@gmail.com写道:

Shai Bagon

unread,
Mar 13, 2016, 6:08:13 AM3/13/16
to Caffe Users
You might find this SO answer useful for using `convert_imageset`.

S. Majid Azimi

unread,
Mar 13, 2016, 7:58:09 AM3/13/16
to Shai Bagon, Caffe Users

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/f5eb26e6-7fcb-440e-a024-de38a5e83b69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sidharth Ramesh

unread,
Jun 20, 2016, 10:50:01 PM6/20/16
to Caffe Users
Thanks a lot. It was very helpful :)
Reply all
Reply to author
Forward
0 new messages