{
  "id": 39507,
  "title": "How do you resize mask from net output back to original size?",
  "url": "/competitions/carvana-image-masking-challenge/discussion/39507",
  "author_name": "",
  "post_date": "2017-09-15T09:19:56.013683700Z",
  "votes": null,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Assuming I train and predict using u-net with 128x128, is there any good way to scale the output mask back to 1280x1918?</p>\n\n<p>I think imresize will roughly obtain the silimar dice coefficient with neural net output.</p>\n\n<p>Would using Conv2DTranspose helps improve further?</p>",
  "messages": [
    {
      "id": "221436",
      "postDate": "09/15/2017 09:19:56",
      "content": "<p>Assuming I train and predict using u-net with 128x128, is there any good way to scale the output mask back to 1280x1918?</p>\n\n<p>I think imresize will roughly obtain the silimar dice coefficient with neural net output.</p>\n\n<p>Would using Conv2DTranspose helps improve further?</p>",
      "rawMarkdown": "Assuming I train and predict using u-net with 128x128, is there any good way to scale the output mask back to 1280x1918?\n\nI think imresize will roughly obtain the silimar dice coefficient with neural net output.\n\nWould using Conv2DTranspose helps improve further?",
      "votes": null
    },
    {
      "id": "221526",
      "postDate": "09/15/2017 15:19:00",
      "content": "<p>I use bilinear interpolation to upsample the images during training and testing both.</p>",
      "rawMarkdown": "I use bilinear interpolation to upsample the images during training and testing both.",
      "votes": null
    },
    {
      "id": "221537",
      "postDate": "09/15/2017 15:39:53",
      "content": "<p>Not sure if I understand bilinear interpolation correctly:\nAssuming the upscale ratio is exactly 2, using bilinear interpolation: <br>\n1 <br>\nwill upsample to <br>\n    1   1 <br>\n    1   1  </p>\n\n<p>However, the truth could be a boundary line, e.g.: <br>\n    0 1 <br>\n    1  1</p>\n\n<p>I am thinking if it could be better to also consider surround pixel, so that: <br>\n0 1 <br>\n1  1 <br>\nwill upsample to: <br>\n0 0 0 1 <br>\n0 0 1 1 <br>\n0 1 1 1 <br>\n1 1 1 1 <br>\ninstead of <br>\n0 0 1 1 <br>\n0 0 1 1 <br>\n1 1 1 1 <br>\n1 1 1 1 <br>\nwhich looks smoother.</p>",
      "rawMarkdown": "Not sure if I understand bilinear interpolation correctly:\nAssuming the upscale ratio is exactly 2, using bilinear interpolation:  \n1     \nwill upsample to  \n    1   1  \n    1   1  \n\nHowever, the truth could be a boundary line, e.g.:  \n    0 1  \n    1  1\n\nI am thinking if it could be better to also consider surround pixel, so that:  \n0 1  \n1  1  \nwill upsample to:  \n0 0 0 1  \n0 0 1 1   \n0 1 1 1  \n1 1 1 1  \ninstead of  \n0 0 1 1  \n0 0 1 1  \n1 1 1 1  \n1 1 1 1  \nwhich looks smoother.",
      "votes": null
    },
    {
      "id": "221612",
      "postDate": "09/15/2017 20:32:16",
      "content": "<p>That's why it's a good idea not to upsample masks but to upsample your predictions, then you can mask them. For example, I output a number between 0 and 1 for each pixel, the possibility of being a car pixel,  and then use bilinear interpolation to upsample and then mask them using a threshold of 0.5.</p>",
      "rawMarkdown": "That's why it's a good idea not to upsample masks but to upsample your predictions, then you can mask them. For example, I output a number between 0 and 1 for each pixel, the possibility of being a car pixel,  and then use bilinear interpolation to upsample and then mask them using a threshold of 0.5.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 221526,
      "author_name": "harungunaydin",
      "author_url": "",
      "post_date": "09/15/2017 15:19:00",
      "content": "<p>I use bilinear interpolation to upsample the images during training and testing both.</p>",
      "votes": null,
      "replies": [
        {
          "id": 221537,
          "author_name": "alberthkcheng",
          "author_url": "",
          "post_date": "09/15/2017 15:39:53",
          "content": "<p>Not sure if I understand bilinear interpolation correctly:\nAssuming the upscale ratio is exactly 2, using bilinear interpolation: <br>\n1 <br>\nwill upsample to <br>\n    1   1 <br>\n    1   1  </p>\n\n<p>However, the truth could be a boundary line, e.g.: <br>\n    0 1 <br>\n    1  1</p>\n\n<p>I am thinking if it could be better to also consider surround pixel, so that: <br>\n0 1 <br>\n1  1 <br>\nwill upsample to: <br>\n0 0 0 1 <br>\n0 0 1 1 <br>\n0 1 1 1 <br>\n1 1 1 1 <br>\ninstead of <br>\n0 0 1 1 <br>\n0 0 1 1 <br>\n1 1 1 1 <br>\n1 1 1 1 <br>\nwhich looks smoother.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 221612,
          "author_name": "harungunaydin",
          "author_url": "",
          "post_date": "09/15/2017 20:32:16",
          "content": "<p>That's why it's a good idea not to upsample masks but to upsample your predictions, then you can mask them. For example, I output a number between 0 and 1 for each pixel, the possibility of being a car pixel,  and then use bilinear interpolation to upsample and then mask them using a threshold of 0.5.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "221436": "Assuming I train and predict using u-net with 128x128, is there any good way to scale the output mask back to 1280x1918?\n\nI think imresize will roughly obtain the silimar dice coefficient with neural net output.\n\nWould using Conv2DTranspose helps improve further?",
    "221526": "I use bilinear interpolation to upsample the images during training and testing both.",
    "221537": "Not sure if I understand bilinear interpolation correctly:\nAssuming the upscale ratio is exactly 2, using bilinear interpolation:  \n1     \nwill upsample to  \n    1   1  \n    1   1  \n\nHowever, the truth could be a boundary line, e.g.:  \n    0 1  \n    1  1\n\nI am thinking if it could be better to also consider surround pixel, so that:  \n0 1  \n1  1  \nwill upsample to:  \n0 0 0 1  \n0 0 1 1   \n0 1 1 1  \n1 1 1 1  \ninstead of  \n0 0 1 1  \n0 0 1 1  \n1 1 1 1  \n1 1 1 1  \nwhich looks smoother.",
    "221612": "That's why it's a good idea not to upsample masks but to upsample your predictions, then you can mask them. For example, I output a number between 0 and 1 for each pixel, the possibility of being a car pixel,  and then use bilinear interpolation to upsample and then mask them using a threshold of 0.5."
  },
  "source": "meta"
}