Caffe Framework Introduction _caffe

Source: Internet
Author: User
Tags nets use definition

1.Caffe is an open source software framework that provides a basic set of programming frameworks, or a template framework for the implementation of deep convolution neural networks, Deep learning algorithms, in parallel to the GPU, and we can define the structure of various convolution neural networks according to the framework, And you can add your own code in this framework, design a new algorithm, the framework of a problem is that only the use of convolution network, all frameworks are based on convolution neural network model.
2. And TensorFlow can complete more depth learning algorithms, such as rnn,lstm and so on.
3.caffe has three basic atomic structures, as the name implies, the atomic structure that is not arbitrary change, Caffe programming framework is in these three atoms are implemented, they are: Blobs, Layers, and Nets.
A blob is a wrapper in which all data is packaged into a BLOB format in the Caffe process. And then programming and processing under the Caffe architecture, this is something we can not change at will, because Caffe itself provides a lot of already designed functions and classes, we arbitrarily change the data packet Converter is no longer use the function, you can no longer caffe the framework of the design of deep neural network. The format of the Blob is (Number,channel,height,width) store the data in a four-tuple way, because it is processed image data, so the back three-dimensional representation of the image Data format, Channel represents the number of channels of the image, such as the grayscale map is 1 channels, The CHANNEL=1,RGB image is 3 channels, channel=3,height and width are the width of the image respectively. As for number is batch, because memory is limited, so we are trained in batches, here also for each batch set an ID, followed by the use of random gradient descent algorithm (schocastic gredient descent, SGD) to train the model, which is to use the data that the BATCH,BLOB is not only used to hold the depth network for the forward process, but also to preserve the gradient data when the gradient process is being evaluated.
Specific use of the way:
Const dtype* Cpu_data () const;
dtype* Mutable_cpu_data ();
The above two formats represent the solid mode and free mode of the data, respectively. The blob has CPU data retention and GPU data preservation, while the blob encapsulates the data between the CPU and the GPU and synchronizes it, so we don't have to ignore the data between the GPU and the CPU.
Layers is the unit that makes up the network structure, accepts the lower data as input, and outputs through the internal operation. The use definition of the network layer in Caffe, similar to the general depth learning Library, has three steps, 1: building layers, including establishing a connection relationship to initialize some of these variables. 2: Forward calculation process, accept input data and calculate output, 3: Backward process, reverse gradient calculation, and the gradient stored in the layer structure.
The Nets is composed of layers, defines the input and output and the layers of the network, defines a net. For example: A basic single hidden layer network definition is as follows:
Name: "Logreg"
Layers {
Name: "Mnist"
Type:data
Top: "Data"
Top: "Label"
Data_param {
Source: "Input_leveldb"
Batch_size:64
}
}
Layers {
Name: "IP"
Type:inner_product
Bottom: "Data"
Top: "IP"
Inner_product_param {
Num_output:2
}
}
Layers {
Name: "Loss"
Type:softmax_loss
Bottom: "IP"
Bottom: "Label"
Top: "Loss"
}
You can use Net::init () to initialize and check the defined network, including initialization of some variable weights, checking for the correctness of the structure of the network, which involves matching and coupling connections between the upper and lower connections of the network.

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.