{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/1920","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/1920/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/1920/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/1920/events","html_url":"https://github.com/fchollet/keras/issues/1920","id":139243178,"number":1920,"title":"Variable-size image to convolutional layer","user":{"login":"shodutta92","id":1606036,"avatar_url":"https://avatars1.githubusercontent.com/u/1606036?v=4","gravatar_id":"","url":"https://api.github.com/users/shodutta92","html_url":"https://github.com/shodutta92","followers_url":"https://api.github.com/users/shodutta92/followers","following_url":"https://api.github.com/users/shodutta92/following{/other_user}","gists_url":"https://api.github.com/users/shodutta92/gists{/gist_id}","starred_url":"https://api.github.com/users/shodutta92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shodutta92/subscriptions","organizations_url":"https://api.github.com/users/shodutta92/orgs","repos_url":"https://api.github.com/users/shodutta92/repos","events_url":"https://api.github.com/users/shodutta92/events{/privacy}","received_events_url":"https://api.github.com/users/shodutta92/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-03-08T10:45:38Z","updated_at":"2017-09-04T06:56:02Z","closed_at":"2016-03-08T17:39:31Z","author_association":"NONE","body":"Hi, I'm trying to run variable-sized images through convolutional layers but I'm getting an error about the row sizes not matching. From what i understand in [this post](https://groups.google.com/d/msg/keras-users/cPogZ6yhovQ/gBEZqnbxEwAJ), I should be able to use a snippet like \n\n``` python\nfrom keras.models import Sequential\nfrom keras.layers import Convolution2D\nimport numpy as np\n\nm = Sequential()\nm.add(Convolution2D(8, 3, 3, input_shape=(1, 10, 10)))\nm.compile(loss=\"mae\", optimizer=\"sgd\")\nc = m.predict(np.random.rand(1, 1, 10, 10))\nc = m.predict(np.random.rand(1, 1, 20, 20))\n```\n\nHowever, the second predict statement throws an error:\n\n```\nValueError: The hardcoded shape for the number of rows in the image (10) isn't the run time shape (20).\n```\n\n Is there some way to use this in an input-shape independent fashion?\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/326880663","html_url":"https://github.com/fchollet/keras/issues/1920#issuecomment-326880663","issue_url":"https://api.github.com/repos/fchollet/keras/issues/1920","id":326880663,"user":{"login":"andreidi","id":20060279,"avatar_url":"https://avatars1.githubusercontent.com/u/20060279?v=4","gravatar_id":"","url":"https://api.github.com/users/andreidi","html_url":"https://github.com/andreidi","followers_url":"https://api.github.com/users/andreidi/followers","following_url":"https://api.github.com/users/andreidi/following{/other_user}","gists_url":"https://api.github.com/users/andreidi/gists{/gist_id}","starred_url":"https://api.github.com/users/andreidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreidi/subscriptions","organizations_url":"https://api.github.com/users/andreidi/orgs","repos_url":"https://api.github.com/users/andreidi/repos","events_url":"https://api.github.com/users/andreidi/events{/privacy}","received_events_url":"https://api.github.com/users/andreidi/received_events","type":"User","site_admin":false},"created_at":"2017-09-04T06:56:02Z","updated_at":"2017-09-04T06:56:02Z","author_association":"NONE","body":"Hi Shay86,\r\nIt still puzzles me your architecture. So basically you input a variable size sequence and use 16 filters of 4 bytes to generate 16 maps from 1 variable size sequence then you use the 16 maps to generate another 32 maps with a 4 bytes convolution, add some dropout, then another  64 filters, convolution and finally 128 convolution filter that generate the input of your maxpool. Here is the tricky part: as long as you have sequences for 10 bytes or less your last convolutional layer will generate 128 maps of maximum 10 bytes that will be transformed to 128x1 by your MaxPooling1D - basically you have a GlobalMaxPooling although you dropped it - for any input with less than 10 steps the MaxPooling will generate 1 downsampled step...  Then your Dense will receive the 128x1 vector and will compute the final 1 byte sigmoid activation.\r\nIf, let's say,  you input a 15 sequence then after multiple conv propagation without any downsampling the MaxPooling will convert it to a 2 byte sequence (128x2) and will feed it to final Dense output thus generating a error - expecting a different input... This is quite strange... I dont even understand how you model compiles: meaning how it DOES determine the required weights between the MaxPooling and the Dense layer ...\r\nStrangely and finally your target data is also multiple bytes per observation although your net expects single binary target ....\r\nI hope I was clear enough so you understand the intuition/analysis I made on your model and maybe it will help you further..."}}
{"actor":{"display_login":"andreidi"}}