caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Problem in converting my images to leveldb by convert_imageset

Open lireagan opened this issue 11 years ago • 9 comments

I'm a newbie. Recently I'm learning how to use CAFFEE and employ it to my own vision work. As the first thing to do, I try to convert orignal images from my own dataset to leveldb format. I employed the convert_imageset just like what create_imagenet.sh do. And I did the Data Preparation.

  1. I saved the images in file.
  2. Made a txt containing label info like "1004653180_AcmcIps6v 0" or "1014186831_AaHXRytua 1"

And edit the codes like create_imagenet.sh

!/bin/bash

TOOLS=/home/llx/work/NN/Tools/caffe/caffe-master/build/tools TRAIN_DATA_ROOT=/home/llx/work/NN/Tools/caffe/image-convertor/origdata/ DATA=/home/llx/work/NN/Tools/caffe/caffe-master/data/mytest EXAMPLE=/home/llx/work/NN/Tools/caffe/caffe-master/examples/mytest

RESIZE=true if $RESIZE; then RESIZE_HEIGHT=256 RESIZE_WIDTH=256 else RESIZE_HEIGHT=0 RESIZE_WIDTH=0 fi

if [ ! -d "$TRAIN_DATA_ROOT" ]; then echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT" echo "Set the TRAIN_DATA_ROOT variable in create_test.sh to the path"
"where the orignal training data is stored." exit 1 fi

echo "Creating train lmdb..."

GLOG_logtostderr=1 $TOOLS/convert_imageset
--resize_height=$RESIZE_HEIGHT
--resize_width=$RESIZE_WIDTH
--shuffle
$TRAIN_DATA_ROOT
$DATA/train.txt
$EXAMPLE/mytest_train_lmdb

echo "Done."

BUT when I run the codes, it fails ...

Creating train lmdb... I0313 19:40:32.082293 2497 convert_imageset.cpp:70] Shuffling data I0313 19:40:32.082804 2497 convert_imageset.cpp:73] A total of 12 images. I0313 19:40:32.082826 2497 convert_imageset.cpp:104] Opening lmdb /home/llx/work/NN/Tools/caffe/caffe-master/examples/mytest/mytest_train_lmdb F0313 19:40:32.082855 2497 convert_imageset.cpp:105] Check failed: mkdir(db_path, 0744) == 0 (-1 vs. 0) mkdir /home/llx/work/NN/Tools/caffe/caffe-master/examples/mytest/mytest_train_lmdbfailed *** Check failure stack trace: *** @ 0x7ff3ddaeedaa (unknown) @ 0x7ff3ddaeece4 (unknown) @ 0x7ff3ddaee6e6 (unknown) @ 0x7ff3ddaf1687 (unknown) @ 0x40998b main @ 0x7ff3db417ec5 (unknown) @ 0x4091e9 (unknown) @ (nil) (unknown) ./create_test.sh: 行 32: 2497 已放弃 (核心已转储) GLOG_logtostderr=1 $TOOLS/convert_imageset --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $TRAIN_DATA_ROOT $DATA/train.txt $EXAMPLE/mytest_train_lmdb Done.

Could anyone help me how I could convert my image data to the format that can be put into CAFFEE? It will be very appreciate of you! THANK YOU!

lireagan avatar Mar 13 '15 12:03 lireagan

try deleting the folder mytest_train_lmdb if it already exists in the folder thentry again

waelHamdan avatar Mar 13 '15 14:03 waelHamdan

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 17:03 n-zhang

Hi, I meet the same problem . And I have already deleting the folder mytest_train_lmdb. I wonder if you have solved the problem. Can you help me? Thank you so much!

sjtujulian avatar May 21 '15 07:05 sjtujulian

@sjtujulian just check the backen parameter of convert_imageset , and make sure all the db format is lmdb if you want your_data.lmdb, vice versa for leveldb.

lireagan avatar May 21 '15 08:05 lireagan

@SoldierNeverDie Thanks for your reply. However, I just check my convert_imageset.cpp, and the db format is the same with my_data.lmdb. when I run the code, it shows: Error: TRAIN_DATA_ROOT is not a path to a directory: /home/nsj/caffe/data/2

sjtujulian avatar May 22 '15 00:05 sjtujulian

Hi!

I don't know why but whenever i try to create the lmdb file the following message appears:

tools/convert_imageset: No such file or directory

The cpp file is there but still not working

@sjtujulian you should write it with no spaces after the '=' sign. Like this:

TRAIN_DATA_ROOT=path/tomy/data

ctrevino avatar May 29 '15 14:05 ctrevino

@ctrevino Hi I have the same error here. Can I ask how did you solve it?

kam1107 avatar Jan 02 '17 15:01 kam1107

don't make the last folder.

For example: if your path is /root/caffe/data/imageset/lmdb/trainval_lmdb create up to lmdb folder manually but not the trainval_lmdb

richardharmadi avatar Apr 04 '18 05:04 richardharmadi

Errors are only printed if there is fault in giving path to train_data_root or val_data_root but if there is fault in Example or Data or Tools path - it will show you such error

wasniksudesh avatar Apr 05 '19 04:04 wasniksudesh