DL框架之Caffe:深度学习框架之Caffe的简介、安装、使用方法详细攻略
目录
Caffe的简介
1、Caffe 的特点
Caffe的安装
Caffe的使用方法
1、基本函数
1.1、LSTMLayer
2、进阶案例
2.1、构建LeNet
2.1、图像进行分类案例:使用 Caffe 进行即时识别
Caffe的简介Caffe,即Convolutional Architecture for Fast Feature Embedding,快速特征嵌入的卷积结构。是一种常用的深度学习框架,在视频、图像处理方面应用较多。Caffe是一个深度学习框架,具有表达、速度和模块化的思想。它是由伯克利AI研究(BAIR)和社区贡献者开发的。Yangqing Jia在加州大学伯克利分校博士期间创建了这个项目。 caffe本身就是用c++实现的。caffe是一个清晰,可读性高,快速的深度学习框架。作者是贾扬清,加州大学伯克利的ph.D,现就职于Facebook。
Caffe官网:Caffe | Deep Learning Framework
API文档:http://caffe.berkeleyvision.org/doxygen/annotated.html
Caffe Model Zoo:Caffe | Model Zoo
1、Caffe 的特点富有表现力的架构鼓励应用和创新:模型和优化由配置定义,无需硬编码。 通过设置单个标志在 GPU 机器上进行训练,然后部署到商品集群或移动设备,在 CPU 和 GPU 之间切换。可扩展的代码促进了积极的开发: 在 Caffe 的第一年,它已经被超过 1,000 名开发人员分叉,并有许多重大的变化回馈。 感谢这些贡献者,该框架跟踪了代码和模型中的最新技术。速度使 Caffe 非常适合研究实验和行业部署: Caffe 每天可以使用单个 NVIDIA K40 GPU* 处理超过 6000 万张图像。 推理需要 1 毫秒/图像,学习需要 4 毫秒/图像,并且更新的库版本和硬件速度更快。 我们相信 Caffe 是可用的最快的卷积网络实现之一。
Caffe的安装 Requirements- Visual Studio 2013 or 2015
- Technically only the VS C/C++ compiler is required (cl.exe)
- CMake 3.4 or higher (Visual Studio and Ninja generators are supported)
- Python for the pycaffe interface. Anaconda Python 2.7 or 3.5 x64 (or Miniconda)
- Matlab for the matcaffe interface.
- CUDA 7.5 or 8.0 (use CUDA 8 if using Visual Studio 2015)
- cuDNN v5
官网教程:https://github.com/BVLC/caffe/tree/windows
LSTMLayer (const LayerParameter ¶m)
virtual const char * type () const
Returns the layer type.
RecurrentLayer (const LayerParameter ¶m)
virtual void LayerSetUp (const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Does layer-specific setup: your layer should implement this function as well as Reshape. More...
virtual void Reshape (const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs. More...
virtual void Reset ()
virtual int MinBottomBlobs () const
Returns the minimum number of bottom blobs required by the layer, or -1 if no minimum number is required. More...
virtual int MaxBottomBlobs () const
Returns the maximum number of bottom blobs required by the layer, or -1 if no maximum number is required. More...
virtual int ExactNumTopBlobs () const
Returns the exact number of top blobs required by the layer, or -1 if no exact number is required. More...
virtual bool AllowForceBackward (const int bottom_index) const
Return whether to allow force_backward for a given bottom blob index. More...
2、进阶案例
2.1、构建LeNet
https://nbviewer.org/github/BVLC/caffe/blob/master/examples/01-learning-lenet.ipynb
2.1、图像进行分类案例:使用 Caffe 进行即时识别https://nbviewer.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb