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

Changing kernel_size in the Segmentation example produce a crash #989

Closed
lasandcris opened this issue Aug 21, 2016 · 7 comments
Closed

Changing kernel_size in the Segmentation example produce a crash #989

lasandcris opened this issue Aug 21, 2016 · 7 comments
Labels

Comments

@lasandcris
Copy link

Has anyone had this issue before? I get a crash every time I change the kernel size in the segmentation example. But it runs when defaults left as is.

thanks,

@gheinrich
Copy link
Contributor

Hello, are you referring to the binary segmentation example (segmentation of the inside of triangles) or the more complete semantic segmentation example on #961? Are you using Caffe or Torch? Either way, if you change the kernel size (especially if you increase it) you need to make sure there are enough pixels in the input image to "survive" the successive convolutional layers. Review the formulas there to make sure your kernel size makes sense.

@lasandcris
Copy link
Author

Thanks for the quick reply. Yes it is the binary example, I was trying to take it apart to learn about it. Thanks for the link for the formulas, I do have to have a good read of it.

Also, re-reading your comment, do you mean in the successive layers the image sizes have to be larger than the kernel size (which would make sense in my mind)? And it might be a very elementary question, but how do I know the images sizes in the successive layers?

@gheinrich
Copy link
Contributor

how do I know the images sizes in the successive layers?

You would do this by applying the formulas. As explained on the example the first layer produces an output that has identical width/height as the input image. That is because we have k*k=3*3 kernels, stride s=1 and padding p=1 on each side. If you change the kernel size of the first layer then you need to change padding accordingly if you want the output to remain the same size as the input image. For example, if you increase kernel size to k*k=5*5 you will need padding of p=2 on each side. If you keep the padding parameter unchanged at p=1 and assuming a L*L=32*32 input then the width/height of the output of your first layer would have a size of floor(L+2*p-k)/s+1=30. Similarly, by applying the formula to the next layer, the output of the next layer will be 16x16 and when we finally try to compute the Euclidean distance to the 32x32 label, an error will be dropped because the dimensions don't match.

I am closing the issue now.

@lasandcris
Copy link
Author

@gheinrich - Thanks for the detailed explanation, this is exactly what I was looking for.
thanks again,
laszlo

@lasandcris
Copy link
Author

@gheinrich - one more thing while we're on this topic (and I promise I'll drop the subject) - are you aware of any link that addresses designing network architectures?

@gheinrich
Copy link
Contributor

You can check one of the online resources such as http://cs231n.stanford.edu/ or http://www.deeplearningbook.org/. I don't know of a guide to designing networks though. Like coding, it teaches a lot to understand how other people have solved their own problems so I recommend reviewing standard network architectures. If you're interested in image segmentation in DIGITS, have a look at this doc.

@lasandcris
Copy link
Author

@gheinrich - thanks again!

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

No branches or pull requests

2 participants