在安装好的 caffe 环境里训练模型时报错
$ cd <caffe根目录>
$ ./build/tools/caffe train -solver examples/mnist/lenet_solver.prototxt
...
I0111 15:27:57.013530 20030 layer_factory.hpp:77] Creating layer mnist
F0111 15:27:57.013805 20030 db_lmdb.hpp:15] Check failed: mdb_status == 0 (2 vs. 0) No such file or directory
*** Check failure stack trace: ***
@ 0x7f4ca2072e6d (unknown)
@ 0x7f4ca2074ced (unknown)
@ 0x7f4ca2072a5c (unknown)
@ 0x7f4ca207563e (unknown)
@ 0x7f4ca2554321 caffe::db::LMDB::Open()
@ 0x7f4ca24639b4 caffe::DataLayer<>::DataLayer()
@ 0x7f4ca2463b62 caffe::Creator_DataLayer<>()
@ 0x7f4ca252a149 caffe::Net<>::Init()
@ 0x7f4ca252c322 caffe::Net<>::Net()
@ 0x7f4ca2533a30 caffe::Solver<>::InitTrainNet()
@ 0x7f4ca2534983 caffe::Solver<>::Init()
@ 0x7f4ca2534c5f caffe::Solver<>::Solver()
@ 0x7f4ca254bad1 caffe::Creator_SGDSolver<>()
@ 0x40ee8e caffe::SolverRegistry<>::CreateSolver()
@ 0x40812c train()
@ 0x405b8c main
@ 0x7f4c9c8ddb35 __libc_start_main
@ 0x40654b (unknown)
Aborted (core dumped)
问题原因是没有找到训练用的数据,所以我们需要先下载训练数据,如下
$ cd <caffe根目录>
$ ./data/mnist/get_mnist.sh
$ ./examples/mnist/create_mnist.sh
然后重新运行训练模型
$ cd <caffe根目录>
$ ./build/tools/caffe train -solver examples/mnist/lenet_solver.prototxt
或
$ ./examples/mnist/train_lenet.sh
网友评论