{
  "id": 301336,
  "title": "Will splitting image into a grid, give us higher score?",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/301336",
  "author_name": "",
  "post_date": "2022-01-17T07:16:56.167476500Z",
  "votes": 9,
  "comment_count": 11,
  "views": 0,
  "content": "<p>These days massive progresses are in LB.<br>\nSome notebooks say that the larger input image size leads higher score. <br>\nHowever, as comments in those notebooks say, the bigger img size needs the more gpu power, memory, and time to train and predict.<br>\nSo, I think that splitting the original image into 4 or 9 grid small images and resizing them to original size will also give us high lb score.</p>\n<p>What do you think about my Idea?</p>\n<p>[Update] I use <a href=\"https://github.com/obss/sahi\" target=\"_blank\">SAHI lib</a> to split test images.But my trained model(using not split image to train) score dropped.<br>\nNext, I split my train/val dataset and I am training yolo model with these dataset.</p>",
  "messages": [
    {
      "id": "1653029",
      "postDate": "01/17/2022 07:16:56",
      "content": "<p>These days massive progresses are in LB.<br>\nSome notebooks say that the larger input image size leads higher score. <br>\nHowever, as comments in those notebooks say, the bigger img size needs the more gpu power, memory, and time to train and predict.<br>\nSo, I think that splitting the original image into 4 or 9 grid small images and resizing them to original size will also give us high lb score.</p>\n<p>What do you think about my Idea?</p>\n<p>[Update] I use <a href=\"https://github.com/obss/sahi\" target=\"_blank\">SAHI lib</a> to split test images.But my trained model(using not split image to train) score dropped.<br>\nNext, I split my train/val dataset and I am training yolo model with these dataset.</p>",
      "rawMarkdown": "These days massive progresses are in LB.\nSome notebooks say that the larger input image size leads higher score. \nHowever, as comments in those notebooks say, the bigger img size needs the more gpu power, memory, and time to train and predict.\nSo, I think that splitting the original image into 4 or 9 grid small images and resizing them to original size will also give us high lb score.\n\nWhat do you think about my Idea?\n\n[Update] I use [SAHI lib](https://github.com/obss/sahi) to split test images.But my trained model(using not split image to train) score dropped.\nNext, I split my train/val dataset and I am training yolo model with these dataset.",
      "votes": null
    },
    {
      "id": "1653059",
      "postDate": "01/17/2022 07:58:52",
      "content": "<p>Sounds interesting. but how can we deal with COTS divided by grid? There is a chance to detect the same COTS twice without advanced postprocessing. In that case, it is possible to union such predictions. But what about an opposite case where the model will not detect half of COTS?</p>\n<p>Anyway, I believe that such an approach (along with grid augmentation) will produce exponentially more data samples, so it should reduce overfitting, isn't it?</p>",
      "rawMarkdown": "Sounds interesting. but how can we deal with COTS divided by grid? There is a chance to detect the same COTS twice without advanced postprocessing. In that case, it is possible to union such predictions. But what about an opposite case where the model will not detect half of COTS?\n\nAnyway, I believe that such an approach (along with grid augmentation) will produce exponentially more data samples, so it should reduce overfitting, isn't it?",
      "votes": null
    },
    {
      "id": "1662275",
      "postDate": "01/24/2022 06:48:39",
      "content": "<p>I'm so sorry for replying so late. <br>\nThanks for your helpful suggestions!<br>\nI'll think more about the problem you said…</p>",
      "rawMarkdown": "I'm so sorry for replying so late. \nThanks for your helpful suggestions!\nI'll think more about the problem you said...",
      "votes": null
    },
    {
      "id": "1662282",
      "postDate": "01/24/2022 06:55:14",
      "content": "<p>I would suggest a naive approach to deal with half of COTS. What do you think about splitting images into grids with overlaps? I mean, each cell will overlap a neighbor for N pixels. We may choose N according to the average COTS size. Working like that ensures that each COTS will hit at least one cell. Having that, we need just to union prediction along cell edges.<br>\nWhat is your opinion about that idea?</p>",
      "rawMarkdown": "I would suggest a naive approach to deal with half of COTS. What do you think about splitting images into grids with overlaps? I mean, each cell will overlap a neighbor for N pixels. We may choose N according to the average COTS size. Working like that ensures that each COTS will hit at least one cell. Having that, we need just to union prediction along cell edges.\nWhat is your opinion about that idea?",
      "votes": null
    },
    {
      "id": "1662438",
      "postDate": "01/24/2022 09:29:26",
      "content": "<p>i have done some exps,but they droped the lb…</p>",
      "rawMarkdown": "i have done some exps,but they droped the lb...",
      "votes": null
    },
    {
      "id": "1662465",
      "postDate": "01/24/2022 09:45:06",
      "content": "<p>Is it due to missing COTS on the cell edges?</p>",
      "rawMarkdown": "Is it due to missing COTS on the cell edges?",
      "votes": null
    },
    {
      "id": "1662598",
      "postDate": "01/24/2022 12:14:47",
      "content": "<p>Thank you for replying!<br>\nBefore I saw your reply, I had found <a href=\"https://www.kaggle.com/remekkinas/sahi-slicing-aided-hyper-inference-yv5-and-yx\" target=\"_blank\">this notebook</a> which uses <a href=\"https://github.com/obss/sahi\" target=\"_blank\">SAHI lib</a>.<br>\nThis library does almost the same thing I wanted to do.<br>\nThis lib splits an image with overlapping (as <a href=\"https://www.kaggle.com/meowmeowmeowmeowmeow\" target=\"_blank\">@meowmeowmeowmeowmeow</a> said!).</p>\n<p>And I tried to use this library but the lb score dropped(as <a href=\"https://www.kaggle.com/junyun1002\" target=\"_blank\">@junyun1002</a> said)…<br>\nI watched the predicted vs label anno video, but I think the reason that the scores dropped is others…</p>",
      "rawMarkdown": "Thank you for replying!\nBefore I saw your reply, I had found [this notebook](https://www.kaggle.com/remekkinas/sahi-slicing-aided-hyper-inference-yv5-and-yx) which uses [SAHI lib](https://github.com/obss/sahi).\nThis library does almost the same thing I wanted to do.\nThis lib splits an image with overlapping (as @meowmeowmeowmeowmeow said!).\n\nAnd I tried to use this library but the lb score dropped(as @junyun1002 said)...\nI watched the predicted vs label anno video, but I think the reason that the scores dropped is others...",
      "votes": null
    },
    {
      "id": "1662654",
      "postDate": "01/24/2022 12:59:59",
      "content": "<p>Wait a little bit …. I am investigating …. I see where potential problem could be … Checking :)</p>",
      "rawMarkdown": "Wait a little bit .... I am investigating .... I see where potential problem could be ... Checking :)",
      "votes": null
    },
    {
      "id": "1662772",
      "postDate": "01/24/2022 14:16:21",
      "content": "<p>Oh! Hi <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>! Thank you for your very very helpful notebooks and discussions!!<br>\nI learned a lot from them and they saved much time for me!</p>\n<p>I used public best single model weight(as this <a href=\"https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer\" target=\"_blank\">https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer</a> notebook uses.) and changed img_size(1920~9000).</p>\n<ul>\n<li>img_size → public lb score</li>\n<li>1920 → <strong>0.455</strong></li>\n<li>3000 → <strong>0.489</strong></li>\n<li>5000 → <strong>0.476</strong></li>\n<li>7000 → time over</li>\n<li>9000 → time over</li>\n</ul>\n<p>I think train images are very different from the images which my model predicts(for example, cots size).<br>\nSo I will change my train data to more similar to the data for prediction!<br>\nI believe some experiments lead better score!</p>",
      "rawMarkdown": "Oh! Hi @remekkinas! Thank you for your very very helpful notebooks and discussions!!\nI learned a lot from them and they saved much time for me!\n\nI used public best single model weight(as this https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer notebook uses.) and changed img_size(1920~9000).\n- img_size → public lb score\n- 1920 → **0.455**\n- 3000 → **0.489**\n- 5000 → **0.476**\n- 7000 → time over\n- 9000 → time over\n\nI think train images are very different from the images which my model predicts(for example, cots size).\nSo I will change my train data to more similar to the data for prediction!\nI believe some experiments lead better score!",
      "votes": null
    },
    {
      "id": "1662790",
      "postDate": "01/24/2022 14:24:33",
      "content": "<p>Great! Let us know if you find way to jump. Thank you!</p>",
      "rawMarkdown": "Great! Let us know if you find way to jump. Thank you!",
      "votes": null
    },
    {
      "id": "1663575",
      "postDate": "01/25/2022 08:20:11",
      "content": "<p>Given my observation that inference size is proportionate to the square of the resolution, grid-wise inference will be just as slow (if not slower) than single inference of the whole image.</p>\n<p>Personally, I found SAHI gave lower score than single inference.</p>",
      "rawMarkdown": "Given my observation that inference size is proportionate to the square of the resolution, grid-wise inference will be just as slow (if not slower) than single inference of the whole image.\n\nPersonally, I found SAHI gave lower score than single inference.",
      "votes": null
    },
    {
      "id": "1663577",
      "postDate": "01/25/2022 08:20:43",
      "content": "<p>correction: Inference time is proportionate to square of resolution</p>",
      "rawMarkdown": "correction: Inference time is proportionate to square of resolution",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1653059,
      "author_name": "meowmeowmeowmeowmeow",
      "author_url": "",
      "post_date": "01/17/2022 07:58:52",
      "content": "<p>Sounds interesting. but how can we deal with COTS divided by grid? There is a chance to detect the same COTS twice without advanced postprocessing. In that case, it is possible to union such predictions. But what about an opposite case where the model will not detect half of COTS?</p>\n<p>Anyway, I believe that such an approach (along with grid augmentation) will produce exponentially more data samples, so it should reduce overfitting, isn't it?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1662275,
          "author_name": "umepon0626",
          "author_url": "",
          "post_date": "01/24/2022 06:48:39",
          "content": "<p>I'm so sorry for replying so late. <br>\nThanks for your helpful suggestions!<br>\nI'll think more about the problem you said…</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662282,
          "author_name": "meowmeowmeowmeowmeow",
          "author_url": "",
          "post_date": "01/24/2022 06:55:14",
          "content": "<p>I would suggest a naive approach to deal with half of COTS. What do you think about splitting images into grids with overlaps? I mean, each cell will overlap a neighbor for N pixels. We may choose N according to the average COTS size. Working like that ensures that each COTS will hit at least one cell. Having that, we need just to union prediction along cell edges.<br>\nWhat is your opinion about that idea?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662438,
          "author_name": "junyun1002",
          "author_url": "",
          "post_date": "01/24/2022 09:29:26",
          "content": "<p>i have done some exps,but they droped the lb…</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662465,
          "author_name": "meowmeowmeowmeowmeow",
          "author_url": "",
          "post_date": "01/24/2022 09:45:06",
          "content": "<p>Is it due to missing COTS on the cell edges?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662598,
          "author_name": "umepon0626",
          "author_url": "",
          "post_date": "01/24/2022 12:14:47",
          "content": "<p>Thank you for replying!<br>\nBefore I saw your reply, I had found <a href=\"https://www.kaggle.com/remekkinas/sahi-slicing-aided-hyper-inference-yv5-and-yx\" target=\"_blank\">this notebook</a> which uses <a href=\"https://github.com/obss/sahi\" target=\"_blank\">SAHI lib</a>.<br>\nThis library does almost the same thing I wanted to do.<br>\nThis lib splits an image with overlapping (as <a href=\"https://www.kaggle.com/meowmeowmeowmeowmeow\" target=\"_blank\">@meowmeowmeowmeowmeow</a> said!).</p>\n<p>And I tried to use this library but the lb score dropped(as <a href=\"https://www.kaggle.com/junyun1002\" target=\"_blank\">@junyun1002</a> said)…<br>\nI watched the predicted vs label anno video, but I think the reason that the scores dropped is others…</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662654,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/24/2022 12:59:59",
          "content": "<p>Wait a little bit …. I am investigating …. I see where potential problem could be … Checking :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662772,
          "author_name": "umepon0626",
          "author_url": "",
          "post_date": "01/24/2022 14:16:21",
          "content": "<p>Oh! Hi <a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>! Thank you for your very very helpful notebooks and discussions!!<br>\nI learned a lot from them and they saved much time for me!</p>\n<p>I used public best single model weight(as this <a href=\"https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer\" target=\"_blank\">https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer</a> notebook uses.) and changed img_size(1920~9000).</p>\n<ul>\n<li>img_size → public lb score</li>\n<li>1920 → <strong>0.455</strong></li>\n<li>3000 → <strong>0.489</strong></li>\n<li>5000 → <strong>0.476</strong></li>\n<li>7000 → time over</li>\n<li>9000 → time over</li>\n</ul>\n<p>I think train images are very different from the images which my model predicts(for example, cots size).<br>\nSo I will change my train data to more similar to the data for prediction!<br>\nI believe some experiments lead better score!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1662790,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/24/2022 14:24:33",
          "content": "<p>Great! Let us know if you find way to jump. Thank you!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1663575,
          "author_name": "alexchwong",
          "author_url": "",
          "post_date": "01/25/2022 08:20:11",
          "content": "<p>Given my observation that inference size is proportionate to the square of the resolution, grid-wise inference will be just as slow (if not slower) than single inference of the whole image.</p>\n<p>Personally, I found SAHI gave lower score than single inference.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1663577,
          "author_name": "alexchwong",
          "author_url": "",
          "post_date": "01/25/2022 08:20:43",
          "content": "<p>correction: Inference time is proportionate to square of resolution</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1653029": "These days massive progresses are in LB.\nSome notebooks say that the larger input image size leads higher score. \nHowever, as comments in those notebooks say, the bigger img size needs the more gpu power, memory, and time to train and predict.\nSo, I think that splitting the original image into 4 or 9 grid small images and resizing them to original size will also give us high lb score.\n\nWhat do you think about my Idea?\n\n[Update] I use [SAHI lib](https://github.com/obss/sahi) to split test images.But my trained model(using not split image to train) score dropped.\nNext, I split my train/val dataset and I am training yolo model with these dataset.",
    "1653059": "Sounds interesting. but how can we deal with COTS divided by grid? There is a chance to detect the same COTS twice without advanced postprocessing. In that case, it is possible to union such predictions. But what about an opposite case where the model will not detect half of COTS?\n\nAnyway, I believe that such an approach (along with grid augmentation) will produce exponentially more data samples, so it should reduce overfitting, isn't it?",
    "1662275": "I'm so sorry for replying so late. \nThanks for your helpful suggestions!\nI'll think more about the problem you said...",
    "1662282": "I would suggest a naive approach to deal with half of COTS. What do you think about splitting images into grids with overlaps? I mean, each cell will overlap a neighbor for N pixels. We may choose N according to the average COTS size. Working like that ensures that each COTS will hit at least one cell. Having that, we need just to union prediction along cell edges.\nWhat is your opinion about that idea?",
    "1662438": "i have done some exps,but they droped the lb...",
    "1662465": "Is it due to missing COTS on the cell edges?",
    "1662598": "Thank you for replying!\nBefore I saw your reply, I had found [this notebook](https://www.kaggle.com/remekkinas/sahi-slicing-aided-hyper-inference-yv5-and-yx) which uses [SAHI lib](https://github.com/obss/sahi).\nThis library does almost the same thing I wanted to do.\nThis lib splits an image with overlapping (as @meowmeowmeowmeowmeow said!).\n\nAnd I tried to use this library but the lb score dropped(as @junyun1002 said)...\nI watched the predicted vs label anno video, but I think the reason that the scores dropped is others...",
    "1662654": "Wait a little bit .... I am investigating .... I see where potential problem could be ... Checking :)",
    "1662772": "Oh! Hi @remekkinas! Thank you for your very very helpful notebooks and discussions!!\nI learned a lot from them and they saved much time for me!\n\nI used public best single model weight(as this https://www.kaggle.com/awsaf49/great-barrier-reef-yolov5-infer notebook uses.) and changed img_size(1920~9000).\n- img_size → public lb score\n- 1920 → **0.455**\n- 3000 → **0.489**\n- 5000 → **0.476**\n- 7000 → time over\n- 9000 → time over\n\nI think train images are very different from the images which my model predicts(for example, cots size).\nSo I will change my train data to more similar to the data for prediction!\nI believe some experiments lead better score!",
    "1662790": "Great! Let us know if you find way to jump. Thank you!",
    "1663575": "Given my observation that inference size is proportionate to the square of the resolution, grid-wise inference will be just as slow (if not slower) than single inference of the whole image.\n\nPersonally, I found SAHI gave lower score than single inference.",
    "1663577": "correction: Inference time is proportionate to square of resolution"
  },
  "source": "meta"
}