summer of 2016错误及解决汇总(1)

本文针对AlexNet训练过程中遇到的问题进行详细分析,包括prototxt文件格式错误导致的网络读取失败、plt.imshow()使用不当引发的TypeError以及训练时网络无法收敛等问题。通过参数可视化发现卷积层参数异常,并提出解决方案。
读入Net时发生:
Error parsing text-format caffe.NetParameter: 64:7: Message type "caffe.LayerParameter" has no field named "layer".
Reson:
prototxt文件格式出错,line 64 缺少‘}’

python Visualize param:
=>plt.imshow()
TypeError: Invalid dimensions for image data
Reason:
plt.imshow() needs a 2D array (or a 3D array with the third dimension being of shape 3 or 4)!
# Assuming your array/image has the variable name: array

import numpy as np
np.asarray(array).ndim 
# If the result is 2 you can always use it with imshow

# If the result is 3 you need to check the third dimension:
np.asarray(array).shape[2] # Must be 3 or 4 for RGB or RGBA images

 

Train a reformed AlexNet,keep conv layer input size,transform fc layers to conv which kernel size is 1*1.But loss is shocking and Net cannot converge.

By visualizing each Layer parameters and Blob,find conv6/conv7(kernel = 1*1) parameters are all zero!

Reason:

conv6/conv7 in train_val.prototxt cannot initialize.

convolution_param {
 num_output: 1
 bias_term: false
 kernel_size: 16
 stride: 8
 pad: 4

 weight_filler {
  type: "gaussian"
  std: 0.01
 }
 bias_filler {
  type: "constant"
  value: 0.1
 }
}

Or:利用已有的caffemodel fine-tuning

在训练脚本中加上:-weights=models/bvlc_alexnet/bvlc_alexnet.caffemodel

 

转载于:https://www.cnblogs.com/chanyn/p/5796407.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值