SegNet-Tutorial icon indicating copy to clipboard operation
SegNet-Tutorial copied to clipboard

Demo - Change input size

Open nzoroa opened this issue 8 years ago • 2 comments

Hello, I'm using the DEMO, and I'm trying to change my input size to 480x640. I have tryed it in two different ways, and I obtaind some errors that I don't know how to solve. Could somebody help me?

I have changed the input in Scripts/webcam_demo.py: input_shape = (1, 1, 480, 640) And I obtain this error: File "Scripts/webcam_demo.py", line 65, in out = net.forward_all(data=input_image) File "/imatge/nzoroa/Downloads/caffe-segnet/python/caffe/pycaffe.py", line 168, in _Net_forward_all outs = self.forward(blobs=blobs, **batch) File "/imatge/nzoroa/Downloads/caffe-segnet/python/caffe/pycaffe.py", line 93, in Net_forward self.blobs[in].data[...] = blob ValueError: could not broadcast input array from shape (1,3,480,640) into shape (1,3,360,480)

Another attemp that I have done is change the input_dim in Example_Models/segnet_model_driving_webdemo.prototxt: input_dim: 1 input_dim: 3 input_dim: 480 input_dim: 640

But I obtain: F0411 12:07:27.651252 29563 upsample_layer.cpp:63] Check failed: bottom[0]->height() == bottom[1]->height() (23 vs. 30) *** Check failure stack trace: ***

Thanks in advance!

nzoroa avatar Apr 11 '16 14:04 nzoroa

You've done the correct thing so far - the last step is to change the padding parameters in the upsample layers. If a pooling layer receives an input dimension that is not divisible by 2 then the layer adds padding.

So you will also need to fiddle with the upsample_w and upsample_h (or remove them if no padding is required)

  upsample_param {
    scale: 2
    upsample_w: 30
    upsample_h: 23
  }

alexgkendall avatar Apr 12 '16 08:04 alexgkendall

It appears that upsampling widths and heights are simply a doubling of the image size from some arbitrarily small extent in upsample5 layer to upsample1 (almost full extent of original image?). Is this perhaps true?

shaystrong avatar Jul 12 '16 20:07 shaystrong