{"action":"created","issue":{"url":"https://api.github.com/repos/BVLC/caffe/issues/3613","repository_url":"https://api.github.com/repos/BVLC/caffe","labels_url":"https://api.github.com/repos/BVLC/caffe/issues/3613/labels{/name}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/3613/comments","events_url":"https://api.github.com/repos/BVLC/caffe/issues/3613/events","html_url":"https://github.com/BVLC/caffe/pull/3613","id":129933868,"number":3613,"title":"Python/net spec coordinate map and crop computation","user":{"login":"longjon","id":940817,"avatar_url":"https://avatars.githubusercontent.com/u/940817?v=3","gravatar_id":"","url":"https://api.github.com/users/longjon","html_url":"https://github.com/longjon","followers_url":"https://api.github.com/users/longjon/followers","following_url":"https://api.github.com/users/longjon/following{/other_user}","gists_url":"https://api.github.com/users/longjon/gists{/gist_id}","starred_url":"https://api.github.com/users/longjon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/longjon/subscriptions","organizations_url":"https://api.github.com/users/longjon/orgs","repos_url":"https://api.github.com/users/longjon/repos","events_url":"https://api.github.com/users/longjon/events{/privacy}","received_events_url":"https://api.github.com/users/longjon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/BVLC/caffe/labels/enhancement","name":"enhancement","color":"c7def8"},{"url":"https://api.github.com/repos/BVLC/caffe/labels/ES","name":"ES","color":"bfdadc"},{"url":"https://api.github.com/repos/BVLC/caffe/labels/focus","name":"focus","color":"006b75"},{"url":"https://api.github.com/repos/BVLC/caffe/labels/in%20progress","name":"in progress","color":"5319e7"},{"url":"https://api.github.com/repos/BVLC/caffe/labels/Python","name":"Python","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-30T03:16:28Z","updated_at":"2016-03-03T08:57:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/BVLC/caffe/pulls/3613","html_url":"https://github.com/BVLC/caffe/pull/3613","diff_url":"https://github.com/BVLC/caffe/pull/3613.diff","patch_url":"https://github.com/BVLC/caffe/pull/3613.patch"},"body":"This PR provides an updated version of #1975 (see also #1976; this is the new version described there). This is meant for use along with #3570 (new ND crop layer).\r\n\r\nThis version has several _advantages_ over #1975, which make it a better candidate for merge.\r\n\r\n1. Unlike #1975, layers do not need a pointer back to their owning net, and are not responsible for inspecting each other. This preserves the clean separation between `Net` and `Layer`, whereas the strategy employed by #1975 allowed for layers to interact in arbitrary ways that are difficult to reason about and make certain kinds of functionality difficult to implement. (This was the primary objection blocking the merge of #1975.) The alternate strategy used here is to perform the net-level analysis at net definition time (through pycaffe's net spec), and bake the results into the parameters of the net, through a much more straightforward (e.g.) crop layer (now #3570).\r\n2. This alternate strategy makes the computed parameters user-visible and user-modifiable, which has value for debugging and understanding.\r\n2. Cropping issues appear at specification time rather than run time.\r\n2. Rather than adding C++ code scattered throughout layers, this patch adds a single Python file.\r\n4. The C++ `Layer` interface remains unchanged; layers don't gain an extra method which may be obscure to some users.\r\n\r\nIn addition, the functionality of this code is _significantly expanded_ from that of #1975. In particular,\r\n\r\n1. The assumption that common ancestors can be reached by descending through first bottoms is removed. Any two spatially-mappable blobs with a common ancestor should work for cropping or otherwise computing coordinate maps.\r\n2. Layers with multiple bottoms (e.g., `Eltwise` or `Convolution` with multiple inputs/outputs) should now be supported.\r\n2. Rectangular filters should now be supported.\r\n3. ND de/convolution should be supported.\r\n4. Dilated de/convolution should be supported.\r\n\r\nLike #1975, the coordinate maps computed with this code can be used for other purposes in addition to cropping.\r\n\r\nThe main _disadvantage_ of this approach compared to #1975 is that the coordinate mapping formulae are kept apart from the definitions of their corresponding layers, which have to be manually kept in sync. Given that these formulae only come in a few basic forms, this seems like a reasonable approach for now.\r\n\r\nThis PR is not complete. The latest version of this code has just been written and has not been well-tested. Work still to be done:\r\n- [x] nudge this PR/#3570 as needed for compatibility\r\n- [ ] add a test for basic functionality\r\n- [ ] add a test for rectangular filters\r\n- [ ] add a test for ND convolution\r\n- [ ] settle on names for functions (`coord_map_from_to` is more awkward than it needs to be)\r\n- [x] flesh out docstrings and comments (in particular, explain how to use `coord_map_from_to`)\r\n- [x] fix style issues\r\n- [x] consider whether any currently unsupported layers should be supported\r\n"},"comment":{"url":"https://api.github.com/repos/BVLC/caffe/issues/comments/191659804","html_url":"https://github.com/BVLC/caffe/pull/3613#issuecomment-191659804","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/3613","id":191659804,"user":{"login":"shelhamer","id":311113,"avatar_url":"https://avatars.githubusercontent.com/u/311113?v=3","gravatar_id":"","url":"https://api.github.com/users/shelhamer","html_url":"https://github.com/shelhamer","followers_url":"https://api.github.com/users/shelhamer/followers","following_url":"https://api.github.com/users/shelhamer/following{/other_user}","gists_url":"https://api.github.com/users/shelhamer/gists{/gist_id}","starred_url":"https://api.github.com/users/shelhamer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shelhamer/subscriptions","organizations_url":"https://api.github.com/users/shelhamer/orgs","repos_url":"https://api.github.com/users/shelhamer/repos","events_url":"https://api.github.com/users/shelhamer/events{/privacy}","received_events_url":"https://api.github.com/users/shelhamer/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T08:57:48Z","updated_at":"2016-03-03T08:57:48Z","body":"With this PR @ 775a5c7 and #3570 I have been able to reproduce FCN experiments. Once there are pytests for coord map this can merge."}}