《科研实验室-Caffe教程》由会员分享,可在线阅读,更多相关《科研实验室-Caffe教程(66页珍藏版)》请在金锄头文库上搜索。
1、PyTorchTorch TensorFlowCaffe TheanoMXNet Deep Learning Platforms for Deep Learning Outline Introduction Experiment Pipeline in Caffe Deeper into Caffe Python Interface Define Custom Layers Introduction What is Caffe Convolution Architecture For Feature Extraction CAFFE Open framework models and work
2、ed examples for deep learning 600 citations 200 contributions 18K stars 11K forks focus on vision but branching out sequences reinforcement learning speech text What is Caffe Pure C CUDA architecture for deep learning command line Python Matlab interfaces Fast well tested code Tools reference models
3、 demos and recipes Seamless switch between CPU and GPU Caffe set model Caffe GPU Official Websites Home page http caffe berkeleyvision org GitHub Installation http caffe berkeleyvision org installation html Step by step Instructions Docker setup out of the box brewing Ubuntu installation the standar
4、d platform Debian installation install caffe with a single command OS X installation RHEL CentOS Fedora installation Windows see the Windows branch led by Guillaume Dumont OpenCL see the OpenCL branch led by Fabian Tschopp AWS AMI pre configured for AWS Overview Prerequisites Compilation Hardware Wi
5、ndows Linux http caffe berkeleyvision org install apt html General dependencies sudo apt get install libprotobuf dev libleveldb dev libsnappy dev libopencv dev libhdf5 serial dev protobuf compiler sudo apt get install no install recommends libboost all dev CUDA BLAS Python Compilation with Make Expe
6、riment Pipeline in Caffe Architecture of Caffe Main classes blob store data and derivatives layers transforms bottom blobs to top blobs net consists of many layers computes gradients via forward backward solver uses gradients to update weights Architecture of Caffe Main files train test prototxt dep
7、loy prototxt descript structure of the network solver prototxt descript training parameters create train test prototxt create solver prototxt TrainingTesting Define Network Step 1 create a train test prototxt layer name data type Data top data top label include phase TRAIN transform param mirror tru
8、e crop size 28 mean file home data cifar10 cifar10 mean binaryproto data param source home data cifar10 cifar10 train lmdb batch size 128 backend LMDB layer name conv 1 type Convolution bottom data top conv 1 param lr mult 1 0 decay mult 1 0 convolution param num output 16 pad 1 kernel size 3 stride
9、 1 weight filler type gaussian std 0 117851130198 bias filler type constant value 0 0 layer name loss type SoftmaxWithLoss bottom fc10 bottom label top loss DataLayersLoss Define Training Parameters Step 2 create solver prototxt train net train test prototxt base lr 0 01 momentum 0 9 weight decay 0
10、0001 max iter 10000 snapshot prefix snapshot other options 1 L Wt 1 1 Details on SGD parameters MomentumLRDecay Training Step 3 training and testing build tools caffe train solver solver prototxt gpu 0 commandattributesvalues Deeper into Caffe prototxt Protocol buffers Like strongly typed binary JSO
11、N Developed by Google Define message types in proto file Define messages in prototxt or binaryproto files Caffe also uses caffemodel All Caffe messages defined in caffe proto train test prototxt deploy prototxt descript structure of the network solver prototxt descript training parameters Layers htt
12、p caffe berkeleyvision org tutorial layers html Data layers Image data read raw images Database read data from LEVELDB or LMDB Vision layers Convolutional layer convolves the input image learnable filters each producing one feature map in the output image Pooling layer max average or stochastic pool
13、ing Common layers Inner product fully connected layer Normalization layers Batch Normalization performs normalization Database Layer get definition from src caffe proto caffe proto data source batch size backend of database mean file crop size mirror transform param Data Layer layer name data type D
14、ata top data top label include phase TRAIN transform param mirror true crop size 28 mean file home data cifar10 cifar10 mean binaryproto data param source home data cifar10 cifar10 train lmdb batch size 128 backend LMDB common parameters Layer name layer name top layers this layer only used for trai
15、ning data preprocessing data path batch size and file format Convolutional Layer http caffe berkeleyvision org tutorial layers convolution html layer name conv1 type Convolution bottom data top conv1 learning rate and decay multipliers for the filters param lr mult 1 decay mult 1 learning rate and d
16、ecay multipliers for the biases param lr mult 2 decay mult 0 convolution param num output 96 learn 96 filters kernel size 11 each filter is 11x11 stride 4 step 4 pixels between each filter application weight filler type gaussian initialize the filters from a Gaussian std 0 01 distribution with stdev 0 01 default mean 0 bias filler type constant initialize the biases to zero 0 value 0 More Layers Batch normalization layer name batchNorm 1 type BatchNorm bottom conv 1 top conv 1 batch norm param S