-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
padding aware im2col and col2im functions #128
Conversation
BTW, I wonder how the net_speed_benchmark get each forward backward time under GPU mode. Ain't the kernels calls asynchronous? I added cuda_timer under util to measure kernel execution time. |
Thanks for rebased PR. I'm fine with keeping the original and padding aware versions for the reasons you gave
at least for now, but defer to @Yangqing's judgement. |
@mavenlin net_speed_benchmark compute the GPU time by doing several forward/backward calls to each layer in order. It will be cleared if you look at the code https://github.com/BVLC/caffe/blob/master/examples/net_speed_benchmark.cpp#L72 |
@sguada but I think all the kernel calls will be issued at once, the cpu code will move on without waiting for their return. |
@kloudkl i tried cudadevicesynchronize approach, but it seems not working, the results are wired, that's why i implemented the gpu timer approach and pack it in the CudaTimer class under util. But I didn't see cudadevicesynchronize in the forward backward functions, that's why I doubt the benchmark code won't work on gpu. Or please tell me if I was wrong. |
Something to look into |
@sguada I'm actually not that into the article. Much of their story is fixing the problems they gave themselves by running in virtualization. To me, Caffe scores a victory achieving excellent performance without mucking about in drivers and kernel code. The model search / hyperparameter optimization by bayesian optimization and random search by Bergstra and Adams are interesting in themselves though [1, 2, 3]. It could be a better way than humans turning knobs, but "graduate student decay" for conditioning has been the best performer so far. [1] J. Snoek, H. Larochelle, and R. P. Adams. Practical bayesian optimization of machine learning algorithms. In NIPS, 2012. |
@mavenlin we have discussed this and decided padding-aware is always the right thing to do. Please refactor to use the padding-aware version everywhere, remove the non-padding-aware version, and drop the obsolete padding layer, and then we will happily merge! Thanks again. |
@forresti should benefit from this change as well, please chime in if any concerns! |
Very nice -- sounds useful. :) |
@shelhamer a few questions:
I think I'll keep the name im2col and add pad parameter to that function, and remove the padded_im2col, as the name padded_xxx is quite ugly. |
Note the example prototxt will need to be updated and the reference model. This can be prepared and double-checked when this migrates from dev to master. Thanks again for your work. |
remove test code (no longer needed and won't compile)
@shelhamer It is resolved and rebased on dev. |
im2col and col2im learn to pad and padding layer is obsolete
Great work, all. One question: How much faster is the original im2col() when pad=0? |
ah, perfect. looks good! thanks for creating this, @mavenlin ! |
im2col and col2im learn to pad and padding layer is obsolete
im2col and col2im learn to pad and padding layer is obsolete
im2col and col2im learn to pad and padding layer is obsolete
Sorry @mavenlin @shelhamer I think we should leave the padding layer, otherwise it will break all the models I have already. Maybe we can think in removing when we do the change in the protobuf and write the conversion script. |
@sguada I don't think this should hold on that whole endeavour. This is a simple change to networks–perhaps we could write the first conversion script for this change and have a little practice for the great shift. However, we all do have a lot happening right now so I am going to keep this contribution in dev for the moment. @mavenlin, your contribution will make it to master once models are updated. Thanks again! |
@shelhamer This is the error I get now with all my previous prototxt (~100) and pretrained models For the future I think we should try to avoid removing old stuff and breaking caffe with each PR. We could mark it as DEPRECATED to indicate it will be removed in the future and then remove it when we change the version and have conversion tool. Otherwise this interfere too much with developing. |
@sguada Yes, this does break current models. That is why this change is in We have You raise the good point that Luckily, this break is a relatively simple one: remove padding layers and add a padding field. We can fix this within Deprecation will be done from the beginning for changes relating to #169, so that a healthy level of order will be preserved in Thank you for bringing this up so we can improve the contributing workflow. |
@shelhamer I agree with you, #169 is a great plan, and I'm totally for it, but maybe marking things as deprecated in Just opened a new issue for removing padding layers and add a padding field #170 |
im2col and col2im learn to pad and padding layer is obsolete
Congrats @mavenlin this merge brings the memory requirements #119 for training imagenet from 4167MB down to 3475MB (updated) and from 3631MB to 3001MB (updated) when not using a test-net. @shelhamer worthy the change. |
Kudos! On Wednesday, February 26, 2014, Sergio Guadarrama [email protected]
Sent from Gmail Mobile - apologeez for any typoz. |
im2col and col2im learn to pad and padding layer is obsolete
Fix windows build in appveyor by disabling parallel build
This PR is to replace #99