Caffe: Check failed: cv_img.data Could not load examples/images/cat.jpg

Created on 21 Nov 2015  ·  12Comments  ·  Source: BVLC/caffe

While running make runtest apparently it is not possible to load the images.

I'm running "make runtest" from the main folder "caffe-master" and the error is as follows...

I have installed CUDA 7.0, cuDNN-v3.0, the latest version of Caffe-master (downloaded two days ago) and the OS is RedHat 6.

Hope you can confirm that this is a BUG

[----------] 4 tests from ImageDataLayerTest/3, where TypeParam = caffe::GPUDevice
[ RUN ] ImageDataLayerTest/3.TestShuffle
E1120 20:20:07.836431 5387 io.cpp:80] Could not open or find file examples/images/cat.jpg
F1120 20:20:07.836463 5387 image_data_layer.cpp:65] Check failed: cv_img.data Could not load examples/images/cat.jpg
* Check failure stack trace:
@ 0x2b00a03f0b5d google::LogMessage::Fail()
@ 0x2b00a03f4b77 google::LogMessage::SendToLog()
@ 0x2b00a03f29f9 google::LogMessage::Flush()
@ 0x2b00a03f2cfd google::LogMessageFatal::~LogMessageFatal()
@ 0x2b00a6c97c0b caffe::ImageDataLayer<>::DataLayerSetUp()
@ 0x2b00a6c2f243 caffe::BaseDataLayer<>::LayerSetUp()
@ 0x2b00a6c2f2c3 caffe::BasePrefetchingDataLayer<>::LayerSetUp()
@ 0x50c35f caffe::Layer<>::SetUp()
@ 0x6a589e caffe::ImageDataLayerTest_TestShuffle_Test<>::TestBody()
@ 0x8e63f3 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x8ded6a testing::Test::Run()
@ 0x8deeb8 testing::TestInfo::Run()
@ 0x8def95 testing::TestCase::Run()
@ 0x8df8c8 testing::internal::UnitTestImpl::RunAllTests()
@ 0x8dfba3 testing::UnitTest::Run()
@ 0x50439a main
@ 0x317581ed5d (unknown)
@ 0x504075 (unknown)
make: *
* [runtest] Aborted (core dumped)

This error is found in other tests...

[ FAILED ] DBTest/0.TestSeekToFirst, where TypeParam = caffe::TypeLevelDB (211 ms)
[ RUN ] DBTest/0.TestNext
E1120 20:19:36.755816 5387 io.cpp:80] Could not open or find file examples/images/cat.jpg
E1120 20:19:36.755985 5387 io.cpp:80] Could not open or find file examples/images/fish-bike.jpg

[ FAILED ] DBTest/0.TestKeyValue, where TypeParam = caffe::TypeLevelDB (185 ms)
[ RUN ] DBTest/0.TestSeekToFirst
E1120 20:19:36.519708 5387 io.cpp:80] Could not open or find file examples/images/cat.jpg
E1120 20:19:36.519881 5387 io.cpp:80] Could not open or find file examples/images/fish-bike.jpg

Most helpful comment

I tried hardcoding the abolute path in include/caffe/test/test_caffe_main.hpp based on the suggestion from @jpsquare above, but I still got the could not load error message, even though the error message now included the full path to the file.

I got around this error by rebuilding OpenCV with the following cmake flags:

-DBUILD_JPEG=ON -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON

so that it could build its own media i/o libraries and not depend on the one found in Anaconda's library path. I probably only needed the JPEG option to get around this error, but I just went ahead and did the others to be consistent.

Hope that helps someone.

All 12 comments

I have met the same problem,,could you tell me how to solve it?Thank you!

I've met with this problem too, don't know how to handle

did any one find solution to the above issue

Is there a solution for this issue?

Hi all,
It's because there is non-compatible version of libjpeg in the system. I reinstalled libjpeg module, and finally solved this problem.
Just remind, try to test your libjpeg module first and make sure your libjpeg is OK.

@ylqfp, which operating system are you using? and how did u install this module? . Thanks for the help

Hi @jpsquare RHEL 6.5 santigo. Just download source from http://libjpeg.sourceforge.net/ and reinstall following its instructions.

Thanks @ylqfp, I resolved this issue by prepending the absolute path to the images in the file holding the image names. Thus the image urls could now be resolved by the opencv methods

Closing, since this seems to be resolved, and related to installation/library problems and not caffe.

I tried hardcoding the abolute path in include/caffe/test/test_caffe_main.hpp based on the suggestion from @jpsquare above, but I still got the could not load error message, even though the error message now included the full path to the file.

I got around this error by rebuilding OpenCV with the following cmake flags:

-DBUILD_JPEG=ON -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON

so that it could build its own media i/o libraries and not depend on the one found in Anaconda's library path. I probably only needed the JPEG option to get around this error, but I just went ahead and did the others to be consistent.

Hope that helps someone.

how to hardcode the absolute path in include/caffe/test/test_caffe_main.hpp. Can you specify clearly. I did rebuild opencv with the above cmake.

Thanks!!!!!!!!!!!!!!!!1

I tried hardcoding the abolute path in include/caffe/test/test_caffe_main.hpp based on the suggestion from @jpsquare above, but I still got the could not load error message, even though the error message now included the full path to the file.

I got around this error by rebuilding OpenCV with the following cmake flags:

-DBUILD_JPEG=ON -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON

so that it could build its own media i/o libraries and not depend on the one found in Anaconda's library path. I probably only needed the JPEG option to get around this error, but I just went ahead and did the others to be consistent.

Hope that helps someone.

Thanks!!! I have solved that follow your solutions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hawklucky picture hawklucky  ·  3Comments

amit-dat picture amit-dat  ·  3Comments

prathmeshrmadhu picture prathmeshrmadhu  ·  3Comments

OpenHero picture OpenHero  ·  3Comments

Ruhjkg picture Ruhjkg  ·  3Comments