1. 程式人生 > >Caffe入門(2)-Caffe讀取並轉換圖片資料

Caffe入門(2)-Caffe讀取並轉換圖片資料

vim examples/re/train_val.prototxt
name: "CaffeNet"
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN                                    #表示訓練階段
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "examples/re/train_mean.binaryproto" #輸入減均值處理的引數檔案
  }
  data_param {
    source: "examples/myfile/img_train_lmdb         #輸入mdb格式的訓練資料

    batch_size: 256
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST                                      #表示測試階段

  }
  transform_param {
    mirror: false
    crop_size: 227                                   
    mean_file: "examples/re/train_mean.binaryproto"  #對測試資料做同樣減均值處理,故用一樣的引數

  }
  data_param {
    source: "examples/re/img_test_lmdb"              #輸入mdb格式的測試資料

    batch_size: 50                                   #50張圖片一個batch
    backend: LMDB
  }
}

六、訓練和測試