{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3183","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3183/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3183/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3183/events","html_url":"https://github.com/fchollet/keras/pull/3183","id":164573399,"number":3183,"title":"Support atrous convolution(a.k.a dilated convolution)","user":{"login":"oeway","id":478667,"avatar_url":"https://avatars.githubusercontent.com/u/478667?v=3","gravatar_id":"","url":"https://api.github.com/users/oeway","html_url":"https://github.com/oeway","followers_url":"https://api.github.com/users/oeway/followers","following_url":"https://api.github.com/users/oeway/following{/other_user}","gists_url":"https://api.github.com/users/oeway/gists{/gist_id}","starred_url":"https://api.github.com/users/oeway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oeway/subscriptions","organizations_url":"https://api.github.com/users/oeway/orgs","repos_url":"https://api.github.com/users/oeway/repos","events_url":"https://api.github.com/users/oeway/events{/privacy}","received_events_url":"https://api.github.com/users/oeway/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-07-08T17:00:45Z","updated_at":"2016-07-13T19:28:08Z","closed_at":"2016-07-13T15:28:23Z","pull_request":{"url":"https://api.github.com/repos/fchollet/keras/pulls/3183","html_url":"https://github.com/fchollet/keras/pull/3183","diff_url":"https://github.com/fchollet/keras/pull/3183.diff","patch_url":"https://github.com/fchollet/keras/pull/3183.patch"},"body":"Atrous convolution(a.k.a dilated convolution or convolution with holes), both backend(theano and tensorflow) are supported. Just add `atrous_rate` to your regular Convolution2D layer.\r\n\r\n ```python\r\n# apply a 3x3 convolution with atrous rate 2x2 and 64 output filters on a 256x256 image:\r\nmodel = Sequential()\r\nmodel.add(AtrousConv2D(64, 3, 3, atrous_rate=(2,2), border_mode='valid', input_shape=(3, 256, 256)))\r\n# now the actual kernel size is dilated from 3x3 to 5x5 (3+(3-1)*(2-1)=5)\r\n# thus model.output_shape == (None, 64, 252, 252)\r\n```\r\n\r\nDifferences with theano and tensorflow backend:\r\n * With theano backend, you can do filter dilation(>1) and filter stride(>1) at the same time. But if you are using tensorflow backend, the stride is currently missing in [tf.nn.atrous_conv2d](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/api_docs/python/nn.md#tfnnatrous_conv2dvalue-filters-rate-padding-namenone-atrous_conv2d). So you can only do dilated convolution with stride=1 with tensorflow.\r\n * With theano backend, the filter dilation is defined with a tuple which can be different in width and height, but in tensorflow, dilation factor is defined by a single number, which means you can only use a single dilation factor for both width and height.\r\n\r\nYou may also want to see this issue here: #2978.\r\n\r\nTo use the new feature, you need to install theano from github(master branch) or the latest tensorflow.\r\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/232461042","html_url":"https://github.com/fchollet/keras/pull/3183#issuecomment-232461042","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3183","id":232461042,"user":{"login":"jfsantos","id":5733,"avatar_url":"https://avatars.githubusercontent.com/u/5733?v=3","gravatar_id":"","url":"https://api.github.com/users/jfsantos","html_url":"https://github.com/jfsantos","followers_url":"https://api.github.com/users/jfsantos/followers","following_url":"https://api.github.com/users/jfsantos/following{/other_user}","gists_url":"https://api.github.com/users/jfsantos/gists{/gist_id}","starred_url":"https://api.github.com/users/jfsantos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfsantos/subscriptions","organizations_url":"https://api.github.com/users/jfsantos/orgs","repos_url":"https://api.github.com/users/jfsantos/repos","events_url":"https://api.github.com/users/jfsantos/events{/privacy}","received_events_url":"https://api.github.com/users/jfsantos/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T19:28:08Z","updated_at":"2016-07-13T19:28:08Z","body":"Shouldn't we call this `DilatedConv2D` and rename `atrous_rate` as `dilation_rate`? The footnote on page 2 of [the paper](http://arxiv.org/abs/1511.07122) states that this is not the \"à trous algorithm\" used on wavelets, so using this name might lead to confusion. \r\n\r\nNote that this type of layer is also referred to as \"dilated convolution\" in all frameworks that currently support it:\r\n\r\n- [`DilatedConv2D` in Lasagne](http://lasagne.readthedocs.io/en/latest/modules/layers/conv.html?highlight=dilated#lasagne.layers.DilatedConv2DLayer)\r\n- [`SpatialDilatedConvolution`](https://github.com/torch/nn/blob/master/doc/convolution.md#nn.SpatialDilatedConvolution) in Torch\r\n- [implementation the authors provided for Caffe](https://github.com/fyu/dilation)"}}
{"actor":{"display_login":"jfsantos"}}