PyCaffe imagedata layer works weird!

71 views
Skip to first unread message

Wonjun Lee

unread,
May 21, 2017, 4:01:10 AM5/21/17
to Caffe Users
Hello.

I'm very new to caffe and have some silly question.
Currently I'm working on writing python script to generate my model's prototxt file.

But pycaffe api of  image data layer works very weird.
Let me show my codes.

import caffe
from caffe import layers as L, params as P
data_root = os.path.abspath('./data/images/')
n.dclean, n.fakelabel2 = L.ImageData(image_data_param = dict(source=pclean_train, batch_size = 50, root_folder = data_root),
                                     ntop=2)

So it is very simple code. But caffe api automatically strip off the '/' of at the end of data_root.
Specifically I hoped this
layer {
  name: "dclean"
  type: "ImageData"
  top: "dclean"
  top: "fakelabel2"
  image_data_param {
    source: "source_clean_train_with_fakelabel.txt"
    batch_size: 50
    root_folder: "/data/images"
  }
}

but the generated prototxt was this
layer {
  name: "dclean"
  type: "ImageData"
  top: "dclean"
  top: "fakelabel2"
  image_data_param {
    source: "source_clean_train_with_fakelabel.txt"
    batch_size: 50
    root_folder: "data/images/"
  }
}

source_clean_train_with_fakelabel.txt
clean/images_001.jpg 0
clean/images_002.jpg 0
....

Because of the missing '/' at the end of root folder, the final path which is going to pass to caffe looks like this /data/imagesclean/ (but it should be like this '/data/images/clean/' this is what I want)
If I manually add '/' at the end of path of root_folder, it works fine.
So is there any one who have solution for this or any tips?

Shrabani Ghosh

unread,
May 21, 2017, 9:31:03 PM5/21/17
to Caffe Users
HI,

I am also a newb in caffe. Just started to look into the examples and tutorials. Can you tell me that is it easier to work on this framework as for me it seems little difficult. Please suggest. 

Thanks in advance
Reply all
Reply to author
Forward
0 new messages