{"action":"created","issue":{"url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/17","repository_url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation","labels_url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/17/comments","events_url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/17/events","html_url":"https://github.com/jocicmarko/ultrasound-nerve-segmentation/issues/17","id":208167493,"number":17,"title":"let u-net predict images having different size with training images","user":{"login":"wenouyang","id":5430158,"avatar_url":"https://avatars.githubusercontent.com/u/5430158?v=3","gravatar_id":"","url":"https://api.github.com/users/wenouyang","html_url":"https://github.com/wenouyang","followers_url":"https://api.github.com/users/wenouyang/followers","following_url":"https://api.github.com/users/wenouyang/following{/other_user}","gists_url":"https://api.github.com/users/wenouyang/gists{/gist_id}","starred_url":"https://api.github.com/users/wenouyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenouyang/subscriptions","organizations_url":"https://api.github.com/users/wenouyang/orgs","repos_url":"https://api.github.com/users/wenouyang/repos","events_url":"https://api.github.com/users/wenouyang/events{/privacy}","received_events_url":"https://api.github.com/users/wenouyang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-02-16T16:10:40Z","updated_at":"2017-02-16T21:12:01Z","closed_at":null,"body":"Hi Marko,\r\n\r\nI have limited number (around 500~700) images with large size (1024*1024). I constructed large amount of training set based on sampling from original images. The sampled size is 128*128.  I trained a model, and then tried to predict over the test images (1024*1024). Previously, I just make prediction over the sub-frame of the test images, and then stitch these predicted masked together. \r\n\r\nI heard that there is a way to let trained network can predict any size of images. The trick is replacing `inputs = Input((1, img_rows, img_cols))` to `inputs = Input((1, None, None))`. I tried, but i have error messages as. Do you have any thoughts on this? Or is it possible to let U-net predict images having different size with trained images.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"train-unet-v3b.py\", line 113, in <module>\r\n    train_and_predict()\r\n  File \"train-unet-v3b.py\", line 96, in train_and_predict\r\n    model = get_unet()\r\n  File \"train-unet-v3b.py\", line 54, in get_unet\r\n    up6 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat', concat_axis=1)\r\n  File \"/development/gtfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/engine/topology.py\", line 485, in __call__\r\n    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)\r\n  File \"/development/gtfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/engine/topology.py\", line 543, in add_inbound_node\r\n    Node.create_node(self, inbound_layers, node_indices, tensor_indices)\r\n  File \"/development/gtfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/engine/topology.py\", line 148, in create_node\r\n    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))\r\n  File \"/development/gtfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/layers/convolutional.py\", line 1043, in call\r\n    self.dim_ordering)\r\n  File \"/development/gtfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/backend/tensorflow_backend.py\", line 508, in resize_images\r\n    X.set_shape((None, None, original_shape[2] * height_factor, original_shape[3] * width_factor))\r\nTypeError: unsupported operand type(s) for *: 'NoneType' and 'int'\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/comments/280462020","html_url":"https://github.com/jocicmarko/ultrasound-nerve-segmentation/issues/17#issuecomment-280462020","issue_url":"https://api.github.com/repos/jocicmarko/ultrasound-nerve-segmentation/issues/17","id":280462020,"user":{"login":"wenouyang","id":5430158,"avatar_url":"https://avatars.githubusercontent.com/u/5430158?v=3","gravatar_id":"","url":"https://api.github.com/users/wenouyang","html_url":"https://github.com/wenouyang","followers_url":"https://api.github.com/users/wenouyang/followers","following_url":"https://api.github.com/users/wenouyang/following{/other_user}","gists_url":"https://api.github.com/users/wenouyang/gists{/gist_id}","starred_url":"https://api.github.com/users/wenouyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenouyang/subscriptions","organizations_url":"https://api.github.com/users/wenouyang/orgs","repos_url":"https://api.github.com/users/wenouyang/repos","events_url":"https://api.github.com/users/wenouyang/events{/privacy}","received_events_url":"https://api.github.com/users/wenouyang/received_events","type":"User","site_admin":false},"created_at":"2017-02-16T21:12:01Z","updated_at":"2017-02-16T21:12:01Z","body":"Hi, \r\n\r\nI am using Tensorflow. \r\n\r\nAnother possible approach is that I scale the test image(1024*1024) to the size of training image (128*128). After making the prediction, I scale it back. Does it make sense, or does it have any potential issue? Thanks."}}
{"actor":{"display_login":"wenouyang"}}