alexgkendall / SegNet-Tutorial

Files for a tutorial to train SegNet for road scenes using the CamVid dataset
http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html
851 stars 518 forks source link

Demo - Change input size #37

Open nzoroa opened 8 years ago

nzoroa commented 8 years ago

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 _Netforward 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!

alexgkendall commented 8 years ago

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
  }
shaystrong commented 8 years ago

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?