How apply cropping to the data stored in HDF5?

661 views
Skip to first unread message

Niko Gamulin

unread,
May 30, 2015, 2:10:43 PM5/30/15
to caffe...@googlegroups.com
Hi,

The size of images I use in training procedure is 256x256. At first I used a lmdb dataset and applied cropping:

layers {
  name: "mnist"
  type: DATA
  top: "data"
  top: "label"
  data_param {
    source: "train_lmdb"
    backend: LMDB
    batch_size: 32
  }
  transform_param {
    crop_size: 224
    mean_file: "mean.binaryproto"
    mirror: true
  }
  include: { phase: TRAIN }
}

In another training procedure I wanted to apply cropping to the data stored in HDF5 dataset:

layers {
  name: "mnist"
  type: HDF5_DATA
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "./hdf5/training_output.txt"
    batch_size: 24
  }
  transform_param {
    crop_size: 224
    mean_file: "mean.binaryproto"
    mirror: true
  }
  include: { phase: TRAIN }
}

In the latter case I realized that the crop_size had no effect; when I tried to use the learned model for predictions with input_dim 224 it returned an error. When I changed the input_dim of deploy.prototxt to 256 it worked well. 

Anyway, if anyone knows if it is possible to crop the images from HDF5 dataset similarly to images from lmdb I would be thankful for any suggestions.

Best regards,

Niko



 

justin goodwin

unread,
Jun 8, 2015, 3:13:51 PM6/8/15
to caffe...@googlegroups.com
Hi Niko, did you ever find a solution to this? This issue just came up for me.

Justin

Niko Gamulin

unread,
Jun 8, 2015, 4:04:01 PM6/8/15
to caffe...@googlegroups.com
Hi Justin,

I haven't found the solution yet.

황영태

unread,
Aug 31, 2015, 7:47:01 AM8/31/15
to Caffe Users
Hi Niko, did you ever find a solution to this? 

I'm just finding the solution to handle this issue.

Yeong-Tae
2015년 6월 9일 화요일 오전 5시 4분 1초 UTC+9, Niko Gamulin 님의 말:

Yucheng Wang

unread,
Sep 29, 2015, 9:22:55 PM9/29/15
to Caffe Users
So could you tell us how to handle this issue?

在 2015年8月31日星期一 UTC+10下午9:47:01,황영태写道:

lz....@siat.ac.cn

unread,
Oct 14, 2015, 10:11:09 AM10/14/15
to Caffe Users
Hi, Have you solved this problem? I write a random crop matlab function but I find it inferior to cropping in caffe prototxt. I analyse this is because caffe do cropping randomly during every time of prefetching data.

Niko Gamulin於 2015年5月31日星期日 UTC+8上午2時10分43秒寫道:

Devendra Mandan

unread,
Jan 8, 2016, 11:56:01 PM1/8/16
to Caffe Users

So, does anyone has a solution to this?

Clément Fuji Tsang

unread,
May 30, 2016, 11:37:23 AM5/30/16
to Caffe Users
Hi everybody, got the same issue, is there anybody who find something to get around this ?
Message has been deleted

Sai Prabhakar

unread,
Nov 7, 2016, 1:06:31 PM11/7/16
to Caffe Users
The only solution to data transformation if you want to use HDF5 layer is to do them manually and store them on the images and then generate the hdf5 layer. Or you can create a python layer (which is very simple) which loads from hdf5 layer and process it on the fly. 

Reply all
Reply to author
Forward
0 new messages