使用caffe训练CSV数据的Lenet [英] use caffe to train Lenet with CSV data

查看:118
本文介绍了使用caffe训练CSV数据的Lenet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我对使用caffe采集高清数据有疑问吗?我尝试通过以下步骤在Kaggle mnist csv数据上运行示例

Excuse me, I have a question on using caffe for hd data? I try to run an example on the Kaggle mnist csv data with the following steps


  1. use h5py 转换为h5数据。 (我使用caffe-example.py进行转换)

  1. use h5py to convert it to h5 data. (I use the caffe-example.py to convert)

然后修改lenet_train_test_prototxt并对其进行训练。我对这一步不知所措。

Then modify the lenet_train_test_prototxt and train it. I am quite at a loss of this step.

我在这里所做的唯一更改是

The only change I made here is

layer {
  name: "mnist"
  type: "HDF5Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    scale: 0.00390625
  }
  data_param {
    source: "data/mnist_train_h5.txt"
    batch_size: 64
  }
}

如何更改lenet_train_test_prototxt适合数据?还是还有一些其他文件需要更改?错误日志为

how to change the lenet_train_test_prototxt to suit the data? Or also there are some other files I need to change? The error log is

enF0724 18:21:11.052737 79373 hdf5_data_layer.cpp:76] Check failed: !this->layer_param_.has_transform_param() HDF5Data does not transform data.

> *** Check failure stack trace: ***
>     @     0x7fe8188bbdaa  (unknown)
>     @     0x7fe8188bbce4  (unknown)
>     @     0x7fe8188bb6e6  (unknown)
>     @     0x7fe8188be687  (unknown)
>     @     0x7fe818caec10  caffe::HDF5DataLayer<>::LayerSetUp()
>     @     0x7fe818c520a3  caffe::Net<>::Init()
>     @     0x7fe818c53e12  caffe::Net<>::Net()
>     @     0x7fe818c0ba20  caffe::Solver<>::InitTrainNet()
>     @     0x7fe818c0c9c3  caffe::Solver<>::Init()
>     @     0x7fe818c0cb96  caffe::Solver<>::Solver()
>     @           0x40c8f0  caffe::GetSolver<>()
>     @           0x406541  train()
>     @           0x404a81  main
>     @     0x7fe817dcdec5  (unknown)
>     @           0x40502d  (unknown)
>     @              (nil)  (unknown) Aborted (core dumped)ter code here


推荐答案

我假设您有一个hdf5数据文件'data / mnist_train_h5.hd5'

I assume you have one hdf5 data file 'data/mnist_train_h5.hd5'.


  1. 从错误消息中可以看到, HDF5Data 层不支持数据转换。具体来说,您不能按层缩放数据。

    因此,要进行任何转换,必须在创建的过程中应用您自己 data / mnist_train_h5.hd5'

  1. As you can see from the error message you got, "HDF5Data" layer does not support data transformation. Specifically, you cannot scale the data by the layer.
    Thus, any transformations you wish to have, you must apply them yourself during the creation of 'data/mnist_train_h5.hd5'.

HDF5Data 层可以不接受 data_param ,而是接受带有参数 source hdf5_data_param 指定hd5二进制文件的 list 。在您的情况下,您应该准备一行额外的 text 文件'data / mnist_train_h5.txt',并用单行显示:

"HDF5Data" layer does not accept data_param, but rather hdf5_data_param with a parameter source specifying a list of hd5 binary files. In your case you should prepare an extra text file 'data/mnist_train_h5.txt' with a single line:




data / mnist_train_h5.hd5

data/mnist_train_h5.hd5

此文本文件将告诉caffe读取'data / mnist_train_h5.hd5'

This text file will tell caffe to read 'data/mnist_train_h5.hd5'.

结果图层应如下所示:

layer {
  name: "mnist"
  type: "HDF5Data"
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "data/mnist_train_h5.txt"
    batch_size: 64
  }
  include {
    phase: TRAIN
  }
}

这篇关于使用caffe训练CSV数据的Lenet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆