天天看点

语义分割学习笔记(四)——ENet 训练问题

根据ENet说明https://github.com/TimoSaemann/ENet/tree/master/Tutorial ,进行训练遇到以下问题

1 No module named spatial_dropout

   ENet通过python接口定义了新层spatial_dropout,根据说明直接在终端启动训练,出现“No module named spatial_dropout”,原因是caffe,python层所在文件夹路径,没有添加到系统PYTHONPATH,一个解决方法是:用Python接口来启动训练:

import sys  
caffe_root = 'home/f/caffe/'  
sys.path.insert(0,caffe_root+'python')  

import caffe
caffe.set_device(0)
caffe.set_mode_gpu()
solver = caffe.SGDSolver('/home/xxx/data/solver.prototxt')
solver.solve()
           

2 drop1_0_3 新建时,  img_height == height 验证失败

   data层的new_height new_weight不能删掉,根据输入图像设定大小即可。

layer {
  name: "data"
  type: "DenseImageData"
  top: "data"
  top: "label"
  dense_image_data_param {
    source: "ENet/dataset/train_fine_2columns.txt"
    batch_size: 4
    shuffle: true
    new_height: 512
    new_width: 1024
    label_divide_factor: 8
  }
}
           

继续阅读