caffe_基礎

Caffe (Convolution Architecture For Feature Embedding
(Extraction))
網絡各層詳細解釋
http://caffe.berkeleyvision.org/tutorial/layers.html
Questions:
1. 從中斷處開始訓練
caffe train ­solver solver.prototxt ­snapshot train_1000.solverstate
https://github.com/BVLC/caffe/wiki/Training-and-Resuming
2. 可視化卷積層
name: "myconvnet"
input: "data"
input_dim: 1
input_dim: 1
input_dim: 256
input_dim: 256
layer {
name: "conv"
type: "Convolution"
bottom: "data"
top: "conv"
convolution_param {
num_output: 10
kernel_size: 3
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
} b
ias_filler {
type: "constant"
value: 0
}
}
}
$ pip insall pydot
$ sudo apt­get install graphviz libgraphviz­dev
$ pip install pygraphviz
$ python /path/to/caffe/python/draw_net.py myconvnet.prototxt
myconvnet.png
3. 什麼樣的 layer 才能它的 bottom 和 top 可以是相同的名稱?
目前只有 Relu 層它的上下層可以使用相同名稱,因爲它是 element-wise 的,
所以可以使用 in-place 的操作以節省內存
http://caffe.berkeleyvision.org/tutorial/interfaces.html
4. 測試網絡
impoort sys
sys.path.insert(0, '/path/to/caffe/python')
import numpy as np
import cv2
from pylab import * #畫圖
import caffe
#initialize

caffe.set_device(1)
caffe.set_mode_gpu()
#指定使用哪一塊GPU
#指定GPU計算

 

model_def = 'deploy.prototxt'
model_weight = 'net.cafffemodel'
#給定網絡模型
#給定參數
net = caffe.Net(model_def, model_weight, caffe.TEST) #給定phase =
TEST, 那麼網絡只會向前計算,不會 backpropagation

Net instance:
1. Mnist
http://caffe.berkeleyvision.org/gathered/examples/mnist.html

發佈了31 篇原創文章 · 獲贊 3 · 訪問量 2093
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章