Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to specify input image dimensions and channels in caffe? #1783

Closed
olddocks opened this issue Jan 22, 2015 · 4 comments
Closed

Where to specify input image dimensions and channels in caffe? #1783

olddocks opened this issue Jan 22, 2015 · 4 comments

Comments

@olddocks
Copy link

i have stored grayscale images in hdf5. The stored images are 96*96 pixel numpy array using ravel. How does caffe know the dimensions of the input data. i understand the blob of grayscale image should be 100x1x96x96 (batchsize x channel x height x width)

But when i load the input data into caffe, the top blob output shows 100 x 9216 x 1 x 1. Shouldn it not be 100 x 1 x 96 x 96??? No??

Where do i specify the dimensions and channels of the input image
Something is wrong here, which is why convolution fails?

I0122 17:56:11.260375  5241 hdf5_data_layer.cpp:29] Loading HDF5 filefacialkp-train.hd5
I0122 17:56:12.127020  5241 hdf5_data_layer.cpp:49] Successully loaded 4934 rows
I0122 17:56:12.127089  5241 hdf5_data_layer.cpp:81] output data size: 100,9216,1,1
I0122 17:56:12.127132  5241 net.cpp:103] Top shape: 100 9216 1 1 (921600)
I0122 17:56:12.127156  5241 net.cpp:103] Top shape: 100 30 1 1 (3000)
I0122 17:56:12.127195  5241 net.cpp:67] Creating Layer conv1
I0122 17:56:12.127226  5241 net.cpp:394] conv1 <- data
I0122 17:56:12.127261  5241 net.cpp:356] conv1 -> conv1
I0122 17:56:12.127298  5241 net.cpp:96] Setting up conv1
F0122 17:56:12.281951  5241 blob.cpp:13] Check failed: height >= 0 (-3 vs. 0) 
@lukeyeager
Copy link
Contributor

Can you print the numpy.shape of the image before you store them to hdf5 (to make sure it's the right size), and also show us the definition for your data layer[s] in your .prototxt file?

@olddocks
Copy link
Author

Numpy output
(7049, 9216)
and the layer file here

name: "LogReg"
 layers {
 top: "data"
 top: "label"
 name: "fkp"
 type: HDF5_DATA
 hdf5_data_param {
 source: "train.txt"
 batch_size: 100
 }
 include {
 phase: TRAIN
 }
 }
 layers {
 bottom: "data"
 top: "conv1"
 name: "conv1"
 type: CONVOLUTION
 blobs_lr: 1
 blobs_lr: 2
 convolution_param {
 num_output: 64
 kernel_size: 5
 stride: 1
 weight_filler {
 type: "xavier"
 }
 bias_filler {
 type: "constant"
 }
 }
 }
 layers {
 bottom: "conv1"
 top: "pool1"
 name: "pool1"
 type: POOLING
 pooling_param {
 pool: MAX
 kernel_size: 2
 stride: 2
 }
 }
 layers {
 bottom: "pool1"
 top: "conv2"
 name: "conv2"
 type: CONVOLUTION
 blobs_lr: 1
 blobs_lr: 2
 convolution_param {
 num_output: 256
 kernel_size: 5
 stride: 1
 weight_filler {
 type: "xavier"
 }
 bias_filler {
 type: "constant"
 }
 }
 }
 layers {
 bottom: "conv2"
 top: "pool2"
 name: "pool2"
 type: POOLING
 pooling_param {
 pool: MAX
 kernel_size: 2
 stride: 2
 }
 }
 layers {
 bottom: "pool2"
 top: "ip1"
 name: "ip1"
 type: INNER_PRODUCT
 blobs_lr: 1
 blobs_lr: 2
 inner_product_param {
 num_output: 500
 weight_filler {
 type: "xavier"
 }
 bias_filler {
 type: "constant"
 }
 }
 }
 layers {
 bottom: "ip1"
 top: "ip1"
 name: "relu1"
 type: RELU
 }
 layers {
 bottom: "ip1"
 top: "ip2"
 name: "ip2"
 type: INNER_PRODUCT
 blobs_lr: 1
 blobs_lr: 2
 inner_product_param {
 num_output: 30
 weight_filler {
 type: "xavier"
 }
 bias_filler {
 type: "constant"
 }
 }
 }
 layers {
 bottom: "ip2"
 bottom: "label"
 top: "loss"
 name: "loss"
 type: EUCLIDEAN_LOSS
 }

@shelhamer
Copy link
Member

@Elpidam
Copy link

Elpidam commented Dec 17, 2015

Hello, as is I understood HDF5 contains images of the same dimensions. What about different sized images? How can I use matlab demo hdf5creation to create a .h5 file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants