什么是預訓練模型
簡單來說,預訓練模型(pre-trained model)是前人為了解決類似問題所創造出來的模型。你在解決問題的時候,不用從零開始訓練一個新模型,可以從在類似問題中訓練過的模型入手。
比如說,你如果想做一輛自動駕駛汽車,可以花數年時間從零開始構建一個性能優良的圖像識別算法,也可以從Google在ImageNet數據集上訓練得到的Inception model(一個預訓練模型)起步,來識別圖像。
一個預訓練模型可能對於你的應用中並不是100%的准確對口,但是它可以為你節省大量功夫。
為什么要使用預訓練模型
大大減少訓練時間
怎樣使用預訓練模型
當在訓練神經網絡的時候我們的目標是什么?我們希望網絡能夠在多次正向反向迭代的過程中,找到合適的權重。通過使用之前在大數據集上經過訓練的預訓練模型,我們可以直接使用相應的結構和權重,將它們應用到我們正在面對的問題上。這被稱作“遷移學習”,即將預訓練的模型“遷移”到我們正在應對的特定問題中。
在選擇預訓練模型的時候你需要非常仔細,如果你的問題與預訓練模型訓練情景下又很大的出入,那么模型所得到的預測結果將會非常不准確。
在遷移學習中,這些預訓練的網絡對於ImageNet數據集外的圖片也表現出類很好的泛化性能,既然預訓練模型已經訓練得很好,我們就不會在段時間內去修改過多的權重,在遷移學習中用到它的時候,往往只是進行微調(fine tune)。
在修改模型的過程中,我們通過會采用比一般訓練模型更低的學習速率。
tf模型權重百度雲下載地址
http://pan.baidu.com/s/1dE9giOD
VGG16:
WEIGHTS_PATH = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5’
WEIGHTS_PATH_NO_TOP = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5’
VGG19:
TF_WEIGHTS_PATH = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels.h5’
TF_WEIGHTS_PATH_NO_TOP = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels_notop.h5’
RESNET50:
WEIGHTS_PATH = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5’
WEIGHTS_PATH_NO_TOP = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5’
INCEPTIONS_V3:
WEIGHTS_PATH = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels.h5’
WEIGHTS_PATH_NO_TOP = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5’
XCEPTION:
TF_WEIGHTS_PATH = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels.h5’
TF_WEIGHTS_PATH_NO_TOP = ‘https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels_notop.h5’