1. 程式人生 > >對 caffe 中Xavier, msra 權值初始化方式的解釋

對 caffe 中Xavier, msra 權值初始化方式的解釋

If you work through the Caffe MNIST tutorial, you’ll come across this curious line

weight_filler { type: "xavier" }

and the accompanying explanation

For the weight filler, we will use the xavier algorithm that automatically determines the scale of initialization based on the number of input and output neurons.

Unfortunately, as of the time this post was written, Google hasn’t heard much about “the xavier algorithm”. To work out what it is, you need to poke around the Caffe source until you find the right docstring and then read the referenced paper, Xavier Glorot & Yoshua Bengio’s Understanding the difficulty of training deep feedforward neural networks

.

Why’s Xavier initialization important?

In short, it helps signals reach deep into the network.

  • If the weights in a network start too small, then the signal shrinks as it passes through each layer until it’s too tiny to be useful.
  • If the weights in a network start too large, then the signal grows as it passes through each layer until it’s too massive to be useful.

Xavier initialization makes sure the weights are ‘just right’, keeping the signal in a reasonable range of values through many layers.

To go any further than this, you’re going to need a small amount of statistics - specifically you need to know about random distributions and their variance.

Okay, hit me with it. What’s Xavier initialization?

In Caffe, it’s initializing the weights in your network by drawing them from a distribution with zero mean and a specific variance,

Var(W)=1ninVar(W)=1nin

where WW is the initialization distribution for the neuron in question, and ninnin is the number of neurons feeding into it. The distribution used is typically Gaussian or uniform.

It’s worth mentioning that Glorot & Bengio’s paper originally recommended using

Var(W)=2nin+noutVar(W)=2nin+nout

where noutnout is the number of neurons the result is fed to. We’ll come to why Caffe’s scheme might be different in a bit.

And where did those formulas come from?

Suppose we have an input XX with nn components and a linear neuron with random weights WW that spits out a number YY. What’s the variance of YY? Well, we can write

Y=W1X1+W2X2++WnXnY=W1X1+W2X2+⋯+WnXn

And from Wikipedia we can work out that WiXiWiXi is going to have variance

Var(

相關推薦

caffe Xavier msra 初始方式解釋

If you work through the Caffe MNIST tutorial, you’ll come across this curious line weight_filler { type: "xavier" } and the acc

初始方法之XavierMSRA

首先介紹一下Xavier等初始化方法比直接用高斯分佈進行初始化W的優勢所在:  一般的神經網路在前向傳播時神經元輸出值的方差會不斷增大,而使用Xavier等方法理論上可以保證每層神經元輸入輸出方差一致。  這裡先介紹一個方差相乘的公式,以便理解Xavier: Xavie

卷積神經網路(三):初始方法之XavierMSRA

基礎知識 首先介紹一下Xavier等初始化方法比直接用高斯分佈進行初始化W的優勢所在: 一般的神經網路在前向傳播時神經元輸出值的方差會不斷增大,而使用Xavier等方法理論上可以保證每層神經元輸入輸出方差一致。 這裡先介紹一個方差相乘的公式,以便理解Xav

初始 - XavierMSRA方法

設計好神經網路結構以及loss function 後,訓練神經網路的步驟如下: 初始化權值引數 選擇一個合適的梯度下降演算法(例如:Adam,RMSprop等) 重複下面的迭代過程: 輸入的正向傳播 計算loss function 的值 反向傳播,計算loss function 相對於權值引數的梯度值 根

神經網絡初始的方法

網絡 mac tro 推導 6.4 linear diff ati soft from:http://blog.csdn.net/u013989576/article/details/76215989 權值初始化的方法主要有:常量初始化(constant)、高斯分布初始化(

深度學習剖根問底:初始xavier

權值初始化的方法主要有:常量初始化(constant)、高斯分佈初始化(gaussian)、positive_unitball初始化、均勻分佈初始化(uniform)、xavier初始化、msra初始化、雙線性初始化(bilinear)常量初始化(constant)     

感知器 初始

>>> import numpy as np >>> a = np.zeros(3) >>> b = np.random.random(3) >>> a array([0., 0., 0.]) >>> b ar

前饋神經網路的初始方法

前饋神經網路(Feedforward Neural Networks, FNNs)在眾多學習問題,例如特徵選擇、函式逼近、以及多標籤學習中有著不錯的應用。 針對訓練前饋網路的學習演算法,目前已經有不少研究者提出了新穎的研究結果,但是其它相關問題的研究卻不多,例

深層神經網路的初始問題

        在上篇文章深層神經網路的搭建中,我們提到關於超引數權值的初始化至關重要。今天我們就來談談其重要性以及如何選擇恰當的數值來初始化這一引數。1. 權值初始化的意義     一個好的權值初始值,有以下優點:加快梯度下降的收斂速度增加梯度下降到最小訓練誤差的機率2.

使用vue的axios後例項的data進行賦的問題

總結一下我遇到的一個糾結很久的問題。 在專案中需要用到後臺的資料對前端渲染,使用到了vue整合的axios,使用vue中的鉤子函式在頁面元件掛載完成之後向後臺傳送一個get請求然後將返回後的資料賦值data()中定義的屬性: 執行後前端報錯: 原因: 在請求執行成功後執行

給定的一組構造相應的哈夫曼樹計算

#include<iostream> #include<stdlib.h> using namespace std; typedef int ElemType; struct BTreeNode { ElemType data; struct BTreeNode* lef

關於js屬性的增刪改查問題

增刪改查 alt func 字面量 person per 技術分享 spa fine 刪除主要是delet方法; 1 function Person(){}; 2 var person = new Person();

判斷一個可滾動元素是否滾動到了底部將源象合並到目標判斷是否為字符串

docs == ret 字符 xtend body for 目標 tom function isScrollToBottom(e, fn) { // e.srcElement存在兼容性問題,並非標準特性 // https://developer.mozil

python實現caffe的訓練初始權重訓練和繼續訓練

1、直接訓練 直接訓練比較簡單,幾行程式碼就可以搞定 import caffe caffe.set_device(0) caffe.set_mode_gpu() #solver root caffe_root = 'D:/caffe-ssd-micros

深度學習框架Caffe-視覺[重啟]

配置 ubuntu16.04 Matlab2018b gcc6.3 (安裝教程): 安裝ubuntu16.04所遇到的問題 https://blog.csdn.net/baidu_40840693/article/details/85061079 安裝方面和下面的部落格一樣:

caffe視覺,特徵視覺,網路模型視覺

-------------------------------------------------------------------------------- 權值視覺化 對訓練後的網路權值進行視覺化可以判斷模型的優劣及是否欠(過)擬合。經過良好訓練的網路權值通常表現為美

HNUM1370: 巍巍嶽麓解題報告---(所有生成樹情況最大邊的最小

題目描述 嶽麓山風景區位於湖南省長沙市嶽麓區,佔地面積 35.20 平方公里,是南嶽衡山 72 峰的最後一峰,位於 橘子洲旅遊景區內,為城市山嶽型風景名勝區,是中國四大賞楓勝地之一。 嶽麓山位於首

javaHashMap的key或者value進行排序!

前段時間從csdn 上看到了一個問題。 有個網友解答的很巧妙。以下是問題原型,我對其中做了一些修改。java 可以按照 HashMap 中的 key 或者 value 來進行排序。import java.util.*; public class MapTest { pu

hiho1576 子樹的最小【dfs序】

題意:求以x為根的子樹中的最小權值 思路:dfs序,把樹轉化成一個序列,類似LCA中的轉化,記錄1棵子樹進去的時間戳和出去的時間戳。線段樹求區間最小值 #include<stdio.h> #include<iostream> #include&l

[c#.net]遍歷一個所有的屬性和

through 圖片 ict init 空類 alt style for inf 利用反射 SpDictItem sp = GetCFHObject.GetSpItem("655"); PropertyInfo[] propertys = sp.GetType().