{
  "id": 414035,
  "title": "Has anyone experimented with techniques that can reduce edge effects?",
  "url": "/competitions/vesuvius-challenge-ink-detection/discussion/414035",
  "author_name": "",
  "post_date": "2023-05-31T05:28:18.467289900Z",
  "votes": 5,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Please share any insights you have :)<br>\nI'll start by sharing this <a href=\"https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0229839\" target=\"_blank\">paper</a><br>\nand this <a href=\"https://github.com/Vooban/Smoothly-Blend-Image-Patches\" target=\"_blank\">repo</a></p>",
  "messages": [
    {
      "id": "2281745",
      "postDate": "05/31/2023 05:28:18",
      "content": "<p>Please share any insights you have :)<br>\nI'll start by sharing this <a href=\"https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0229839\" target=\"_blank\">paper</a><br>\nand this <a href=\"https://github.com/Vooban/Smoothly-Blend-Image-Patches\" target=\"_blank\">repo</a></p>",
      "rawMarkdown": "Please share any insights you have :)\nI'll start by sharing this [paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0229839)\nand this [repo](https://github.com/Vooban/Smoothly-Blend-Image-Patches)",
      "votes": null
    },
    {
      "id": "2281857",
      "postDate": "05/31/2023 07:16:33",
      "content": "<p>I think morphological transformations like opening and closing can be useful.<br>\n<a href=\"https://docs.opencv.org/4.x/d9/d61/tutorial_py_morphological_ops.html\" target=\"_blank\">OpenCV Morphological transformations</a></p>",
      "rawMarkdown": "I think morphological transformations like opening and closing can be useful.\n[OpenCV Morphological transformations](https://docs.opencv.org/4.x/d9/d61/tutorial_py_morphological_ops.html)",
      "votes": null
    },
    {
      "id": "2283495",
      "postDate": "06/01/2023 09:41:57",
      "content": "<p>Haven't investigated thoroughly, but isn't this:</p>\n<pre><code>def make_infer_mask():\n    s = CFG.crop_size\n    f = CFG.crop_fade\n    x = np.linspace(-1, 1, s)\n    y = np.linspace(-1, 1, s)\n    xx, yy = np.meshgrid(x, y)\n    d = 1 - np.maximum(np.abs(xx), np.abs(yy))\n    d1 = np.clip(d, 0, f / s * 2)\n    d1 = d1 / d1.max()\n    infer_mask = d1\n    return infer_mask\n</code></pre>\n<p>in combination with the code a bit further down <code>probability[y0:y0 + crop_size, x0:x0 + crop_size] += k[b,0]*infer_mask</code> doing that?</p>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> notebook <a href=\"https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook\" target=\"_blank\">https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook</a>?</p>",
      "rawMarkdown": "Haven't investigated thoroughly, but isn't this:\n\n```\ndef make_infer_mask():\n\ts = CFG.crop_size\n\tf = CFG.crop_fade\n\tx = np.linspace(-1, 1, s)\n\ty = np.linspace(-1, 1, s)\n\txx, yy = np.meshgrid(x, y)\n\td = 1 - np.maximum(np.abs(xx), np.abs(yy))\n\td1 = np.clip(d, 0, f / s * 2)\n\td1 = d1 / d1.max()\n\tinfer_mask = d1\n\treturn infer_mask\n```\n\nin combination with the code a bit further down `probability[y0:y0 + crop_size, x0:x0 + crop_size] += k[b,0]*infer_mask` doing that?\n\n@hengck23 notebook https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook?",
      "votes": null
    },
    {
      "id": "2294930",
      "postDate": "06/10/2023 13:17:27",
      "content": "<p>I used the morphological transformation to reduce mask near edge, but it didn’t result in higher CV in my case.</p>",
      "rawMarkdown": "I used the morphological transformation to reduce mask near edge, but it didn’t result in higher CV in my case.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2281857,
      "author_name": "vijaybj",
      "author_url": "",
      "post_date": "05/31/2023 07:16:33",
      "content": "<p>I think morphological transformations like opening and closing can be useful.<br>\n<a href=\"https://docs.opencv.org/4.x/d9/d61/tutorial_py_morphological_ops.html\" target=\"_blank\">OpenCV Morphological transformations</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 2294930,
          "author_name": "clearwaterkzk",
          "author_url": "",
          "post_date": "06/10/2023 13:17:27",
          "content": "<p>I used the morphological transformation to reduce mask near edge, but it didn’t result in higher CV in my case.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2283495,
      "author_name": "lucasvw",
      "author_url": "",
      "post_date": "06/01/2023 09:41:57",
      "content": "<p>Haven't investigated thoroughly, but isn't this:</p>\n<pre><code>def make_infer_mask():\n    s = CFG.crop_size\n    f = CFG.crop_fade\n    x = np.linspace(-1, 1, s)\n    y = np.linspace(-1, 1, s)\n    xx, yy = np.meshgrid(x, y)\n    d = 1 - np.maximum(np.abs(xx), np.abs(yy))\n    d1 = np.clip(d, 0, f / s * 2)\n    d1 = d1 / d1.max()\n    infer_mask = d1\n    return infer_mask\n</code></pre>\n<p>in combination with the code a bit further down <code>probability[y0:y0 + crop_size, x0:x0 + crop_size] += k[b,0]*infer_mask</code> doing that?</p>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> notebook <a href=\"https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook\" target=\"_blank\">https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook</a>?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2281745": "Please share any insights you have :)\nI'll start by sharing this [paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0229839)\nand this [repo](https://github.com/Vooban/Smoothly-Blend-Image-Patches)",
    "2281857": "I think morphological transformations like opening and closing can be useful.\n[OpenCV Morphological transformations](https://docs.opencv.org/4.x/d9/d61/tutorial_py_morphological_ops.html)",
    "2283495": "Haven't investigated thoroughly, but isn't this:\n\n```\ndef make_infer_mask():\n\ts = CFG.crop_size\n\tf = CFG.crop_fade\n\tx = np.linspace(-1, 1, s)\n\ty = np.linspace(-1, 1, s)\n\txx, yy = np.meshgrid(x, y)\n\td = 1 - np.maximum(np.abs(xx), np.abs(yy))\n\td1 = np.clip(d, 0, f / s * 2)\n\td1 = d1 / d1.max()\n\tinfer_mask = d1\n\treturn infer_mask\n```\n\nin combination with the code a bit further down `probability[y0:y0 + crop_size, x0:x0 + crop_size] += k[b,0]*infer_mask` doing that?\n\n@hengck23 notebook https://www.kaggle.com/code/hengck23/lb0-68-one-fold-stacked-unet/notebook?",
    "2294930": "I used the morphological transformation to reduce mask near edge, but it didn’t result in higher CV in my case."
  },
  "source": "meta"
}