ImageNet example: Error while Computing mean: 'std::length_error'

1,945 views
Skip to first unread message

Rohit Durvasula

unread,
Feb 26, 2015, 9:48:38 PM2/26/15
to caffe...@googlegroups.com

I am trying to follow the ImagNet tutorial.
I had the dataset already, so I just skipped the steps for downloading it.
Next I cropped them to 256*256.
The next step involves computing the mean.

I have the paths all correct in the file: make_imagenet_mean.sh
I am pasting the file contents here: 
./build/tools/compute_image_mean examples/imagenet/ilsvrc12_train_lmdb \ data/ilsvrc12/imagenet_mean.binaryproto
echo "Done."

I run it using: ./examples/imagenet/make_imagenet_mean.sh

but i get an error: terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
Aborted (core dumped)
Done.

The error suggests that somewhere in the code it's trying to create a string bigger than std::string::max_size().

Can anyone tell me what's the error and how to rectify it?
Thanks

Sujit Pal

unread,
Apr 28, 2015, 9:02:26 PM4/28/15
to caffe...@googlegroups.com
I am getting the exact same error when trying to compute the mean. Did you find a solution for it?

Thanks
Sujit

Joshua Holly

unread,
Jul 10, 2015, 10:12:03 AM7/10/15
to caffe...@googlegroups.com
Me too. Any solution yet?

Ihsan Ullah

unread,
Jul 10, 2015, 3:10:39 PM7/10/15
to caffe...@googlegroups.com
Hi, my error is not the same but related to mean.
I selected a subset of Imagenet and created Lmdb using create_Imagenet.
Now when i try to create mean of it i receive error of :


/scr/ihs_caf/caffe-master$ ./examples/imagenet/make_imagenet_mean.sh
F0710 12:06:26.242373 30965 compute_image_mean.cpp:76] Check failed: size_in_datum == data_size (6435144 vs. 293493) Incorrect data field size 6435144
*** Check failure stack trace: ***
    @     0x7fa95b5e8daa  (unknown)
    @     0x7fa95b5e8ce4  (unknown)
    @     0x7fa95b5e86e6  (unknown)
    @     0x7fa95b5eb687  (unknown)
    @           0x4022b1  main
    @     0x7fa95a7f8ec5  (unknown)
    @           0x40243a  (unknown)
    @              (nil)  (unknown)
Aborted (core dumped)
Done.

I dont know where and what is different. Does compute_image_mean.cpp has some hard coded parameters or why?
How can i solve this problem.
Regards
ihsan




On Thursday, February 26, 2015 at 6:48:38 PM UTC-8, Rohit Durvasula wrote:
Message has been deleted

AJ

unread,
Jul 30, 2015, 8:05:21 PM7/30/15
to Caffe Users, ihsan...@gmail.com
I am also getting the same error while running the script. Any help?

$  ./examples/imagenet/make_imagenet_mean.sh                                                                                               
F0730 17:00:34.277210  3445 compute_image_mean.cpp:76] Check failed: size_in_datum == data_size (360000 vs. 499500) Incorrect data field size 360000

*** Check failure stack trace: ***
    @     0x7fdde2b35daa  (unknown)
    @     0x7fdde2b35ce4  (unknown)
    @     0x7fdde2b356e6  (unknown)
    @     0x7fdde2b38687  (unknown)
    @           0x4022b1  main
    @     0x7fdde1d45ec5  (unknown)

    @           0x40243a  (unknown)
    @              (nil)  (unknown)
Aborted
Done.

AJ

unread,
Jul 31, 2015, 3:00:19 PM7/31/15
to Caffe Users, ihsan...@gmail.com, amit.j...@gmail.com
Found the error. I forgot to resize the images as mentioned in the wiki.

Ayesha Siddiqua

unread,
Nov 12, 2015, 12:10:36 PM11/12/15
to Caffe Users
Hi , could you solve  your problem? how? I am getting the exact same problem.

Thanks
Ayesha
Message has been deleted

navee k

unread,
Apr 12, 2016, 7:41:20 PM4/12/16
to Caffe Users
I just started using caffe...I too got the same error as below

error: terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
Aborted (core dumped)

FIXED BY CHECKING THIS.
While generating  ilsvrc12_val_lmdb & ilsvrc12_train_lmdb  with create_imagenet.sh

After careful analysis this "ilsvrc12_train_lmdb " file was getting generated incorrectly.
When you run "create_imagenet.sh", success logs looks like below.


./examples/imagenet/create_imagenet.sh
Creating train lmdb...
I0412 16:33:56.927012  4747 convert_imageset.cpp:83] Shuffling data
I0412 16:33:56.927685  4747 convert_imageset.cpp:86] A total of 1 images.
I0412 16:33:56.927903  4747 db_lmdb.cpp:38] Opened lmdb examples/imagenet/ilsvrc12_train_lmdb
I0412 16:33:56.931938  4747 convert_imageset.cpp:150] Processed 1 files.
Creating val lmdb...
I0412 16:33:56.948639  4748 convert_imageset.cpp:83] Shuffling data
I0412 16:33:56.949429  4748 convert_imageset.cpp:86] A total of 1 images.
I0412 16:33:56.949672  4748 db_lmdb.cpp:38] Opened lmdb examples/imagenet/ilsvrc12_val_lmdb
I0412 16:33:56.953889  4748 convert_imageset.cpp:150] Processed 1 files.
Done.

One lmdb files are generated correctly, probably you should not see "'std::length_error'" this error.

Good luck.

On Tuesday, March 15, 2016 at 3:44:30 AM UTC-7, monjoy saha wrote:
I am facing same problem anyone fixed this issue?
Reply all
Reply to author
Forward
0 new messages