Caffe for Windows Training Cifar10 and several issues

Source: Internet
Author: User

statement:Part of the content is reproduced to the smile of the demon teacher1, prepare Cifar10Database

cifar10 database consists of 60000 32*32 color images total 10 categories

50000 of the training

10000-piece Test

Download Cifar10 database: http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz

This is binary format, so we're going to convert it to LEVELDB format.


2, converting data

In.. There is a convert_cifar_data.cpp in the/caffe-windows/examples/cifar10 folder

Include him in the MainCaller.cpp. As follows:


Then recompile, one pass. This will create a MainCaller.exe in the Bin folder, and rename it to Convert_cifar_data.exe.

You can create a new input folder under the Bin folder. Unzip the file you downloaded in the first step into the input folder so that you don't have to write the path when you convert it. As shown




CMD into the bin folder




After execution, there are two folders in Cifar_train_leveldb and Cifar_test_leveldb under the output folder. Inside is the converted Leveldb format data.

Of course, you can also write a bat file processing, easy to use again later. (I'm a beginner, neither will I.) Forgive me... )


problems that may occur:at compile time, the following error occurred:
convert_cifar_data.cpp ($ ): Error C3861: "snprintf": identifier not found
Open a Caffe for Windows\examples\cifar10\convert_cifar_data.cpp file, there are two solutions:
(1): Find snprintf, precede the underscore, or directly double-click the error, will pop up this CPP, 3 of them need to underline, save, and then compile.
(2): In front of this CPP file #define SNPRINTF _snprintf can be. I am using the second method, such as:

3, the average value of the data image is calculated

As follows: Recompile the compilation in Maincaller. /.. /tools/comput_image_mean.cpp


After the compilation succeeds. Here will appear MainCaller.exe, here to change it to Ompute_image_mean.exe

Next, you can ask for the image to mean.

CMD into the bin.




Problems that may occur:
Compile Caffe Example Cifar10: assertion Failed:dummy_versions_.next_ = = &dummy_versions_ appears. file. \db\version_set.cc, line 803
or:db/version_set.cc:806:leveldb::versionset::~versionset (): assertion ' Dummy_versions_.next_ = = & Dummy_versions_ ' failed.

What to do if you encounter this problem?

search on the Internet, you can find Cynric's Blog There is such a passage:

In version 1.15, if the Newiterator function was used to create the Leveldb::iterator object without the Delete object, the following error will be reported when the program exits:Db/version_set.cc:806:leveldb::versionset::~versionset (): assertion ' Dummy_versions_.next_ = = &dummy_versions_ ' failed. based on code analysis, the reason for the Assert failure here is primarily to prevent memory leaks.
refer to the above error prompt, open Source:(in.. /tools/compute_image_mean.cpp inside), based on the blog's tips, I'll do a delete after creating the Lterator. Probably in the 70th line of the source code around the position. As shown in the following:


And then recompile, you can fix it.



4, Training Cifar network

There are already network profiles in the/examples/cifar10 folder, we only need to cifar_train_leveldb and Cifar_test_ Leveldb two folders and Mean.binaryproto files are copied to the Cifar10 folder.

Modify Cifar10_quick_train.prototxt source in: "Cifar-train-leveldb" Mean_file: "Mean.binaryproto" and Cifar10_quick_test.prototxt source in: "Cifar-test-leveldb". (Modify the path so that its read path is correct)
Mean_file: "Mean.binaryproto" on it,

Back training is similar to Mnist's training. Write a train_quick.bat that reads as follows:

Copy.. \\.. \\bin\\MainCaller.exe. \\.. \\bin\\train_net.exeSET glog_logtostderr=1 ". /.. /bin/train_net.exe "Cifar10_quick_solver.prototxt  Pause
compile it again train_net.cpp

Run Train_quick.bat


5 Running Results

Appendix: Here my Notebook card is too poor, the function can't keep up. Then, he was killed directly. So I didn't come out with this result. Here is a map of the online borrowing ....----------------------------------------------------------
-----------I want to buy a computer-----------------------------------------------------------------------

so I would like to help you to support the point ....



Caffe for Windows Training Cifar10 and several issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.