caffe Check failed: mdb_status == 0 (2 vs. 0) No such file or directory

  • 错误提示:Check failed: mdb_status == 0 (2 vs. 0) No such file or directory,创建数据层mnist是找不到mdb文件
I0417 13:28:17.764714 35030 layer_factory.hpp:77] Creating layer mnist
F0417 13:28:17.765067 35030 db_lmdb.hpp:15] Check failed: mdb_status == 0 (2 vs. 0) No such file or directory
*** Check failure stack trace: ***
    @     0x7f8be82acd3d  google::LogMessage::Fail()
    @     0x7f8be82aeb53  google::LogMessage::SendToLog()
    @     0x7f8be82ac8cb  google::LogMessage::Flush()
    @     0x7f8be82af53e  google::LogMessageFatal::~LogMessageFatal()
    @     0x7f8be88df8e8  caffe::db::LMDB::Open()
    @     0x7f8be898643f  caffe::DataLayer<>::DataLayer()
    @     0x7f8be89865d2  caffe::Creator_DataLayer<>()
    @     0x7f8be8a66209  caffe::Net<>::Init()
    @     0x7f8be8a6959a  caffe::Net<>::Net()
    @           0x40c404  time()
    @           0x407440  main
    @     0x7f8be7564830  __libc_start_main
    @           0x407d89  _start
  • 解决办法

After running the script there should be two datasets,mnist_train_lmdb, and mnist_test_lmdb.

Data Layers

Data enters Caffe through data layers: they lie at the bottom of nets. Data can come from efficient databases (LevelDB or LMDB), directly from memory, or, when efficiency is not critical, from files on disk in HDF5 or common image formats.

Common input preprocessing (mean subtraction, scaling, random cropping, and mirroring) is available by specifying TransformationParameters by some of the layers. The bias, scale, and crop layers can be helpful with transforming the inputs, when TransformationParameter isn’t available.


  • Image Data - read raw images.
  • Database - read data from LEVELDB or LMDB.
  • HDF5 Input - read HDF5 data, allows data of arbitrary dimensions.
  • HDF5 Output - write data as HDF5.
  • Input - typically used for networks that are being deployed.
  • Window Data - read window data file.
  • Memory Data - read data directly from memory.
  • Dummy Data - for static data and debugging.

Note that the Python Layer can be useful for create custom data layers.