Cuda-convnet tutorial on using other data sets

Source: Internet
Author: User

Cuda-convnet is a set of CNN code published by Alex Krizhevsky , running on a Linux system, using the GPU to perform operations, providing only a demo of the CIFAR data set in Cuda-convnet. And the website does not explain how the Cuda-convnet code is used in other databases, so Bo Master I try to modify the source, for the mnist data set, to do a handwritten number recognition Cnndemo


The article is divided into three parts:

First, the IO module

Second, modify the parameters of the layer

Finally, some of the Python files inside the description, Bo Master I also for this code to learn Python and cuda, so the understanding of Python is very superficial, Python learning can refer to Liaoche's website


Alex's website offers three sets of Cifar datasets--python,matlab and C, while the source code is only supported in Python format. The data store under Python is a data type using the dictionary, Io is a dump () and load () function using the Cpickle module in Python, where the dump () function helps us to modify the files of other databases to cuda-convnet acceptable, For the construction of the dataset, the load () function is the function that reads the data in the code and exists in the util.py file of the source code.


Simply say the format of the Cifar dataset under Python, which is divided into two parts, one is the meta file of Data_batch_i, and the Cpickle.load () method is used to read data_batch_i get a dictionary, the useful keyword is-- ' Data ' and ' labels ', where data must be stored by column . Meta files hold useful keywords for ' label_names ', ' Data_mean ', ' Num_vis ', ' Num_cases_per_batch '. You can modify the source code util.py, add print to look at the dictionary format, in fact, there are many other information in the source file, but there is not much use.


Knowing the format of the data, then the rest of the task is to write cuda-convnet acceptable data, using the function is said above Cpickle.dump ()


Then explain the structure of the neural network, because the recognition of handwritten numbers is not very difficult, so only with a layer of convolution can be, if you want to refer to the previous parameters, you can see Caffe mnist-tutorial or LeCun 98 years of the document, I almost self-change, The parameters of the front are set to the same. Feel a simple model, as long as the CNN understanding in place, or can modify the parameters of their own.


There is a very need to point out is the type of neuron neuron, the literature said Relu convergence rate is much faster than the logistic, but pay attention to the use of Relu will cause the problem is the Nan and INF error message, this in the Alex Source code site A group of people reaction , this should be because of the relu of the range of the unbounded characteristics of the cause, with the logistic must be able to avoid this problem, is the convergence is very slow, but relu when you can use, Bo Master also in groping, should be a certain mathematical deduction.


Finally, we introduce the important modules of Python files in the source code, so that we can understand the framework of this code.

The Unpickle function under util.py is very important, you can print dict view the data dictionary format


CONVDATA.PY provides three source code accepted data type Cifardataprovider,croppedcifardataprovider,dummyconvnetdataprovider, Bloggers just focus on Cifardataprovider, this file is nothing to see.


Convnet.py is the entry point for the entire Python program, which is known at the bottom of the code. This file is mainly implemented in the command line form of the startup program


data.py and convdata.py, not much worth seeing.


gpumodel.py the entire code of the loop module here--train () function, there is a while loop, understand people naturally understand ~


layer.py option.py ordereddict.py These three documents have not looked carefully, at present does not seem to need to modify


shownet.py because of the SSH protocol access to the server, so Bo master of the drawing function can not be used directly ...


Almost finished, feel Alex this set of code is still not very friendly, supposedly should give an IO standard, for Yimeimei test other data set, not seen Caffe, is said to be better readability


Have any questions welcome to point out!





Cuda-convnet tutorial on using other data sets

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.