{
  "id": 172382,
  "title": "Sharing my Refined Dataset (Stitched images & manually edited)",
  "url": "/competitions/global-wheat-detection/discussion/172382",
  "author_name": "",
  "post_date": "2020-08-04T21:07:59.296747600Z",
  "votes": 4,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Now that the competition is nearing close, I have prepared my refined dataset to be released! While this dataset is still not perfect, it is definitely a step up from the initial dataset and I did spend a good amount of time on it. </p>\n\n<p>Here's the main things I did:\n1. Restored the original images by stitching the image patches together. If you didn't know, the dataset authors split the original images into patches as shown below. I wrote a script to stitch the images back together so we could work with the original full-size images. I credit the idea of this approach to <a href=\"/pestipeti\">@pestipeti</a> as he introduced it <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/149805\">here</a>.\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F846065%2Fa6bfd3bc3a81ef564b67af9346a70af8%2FScreenshot%20from%202020-08-04%2016-11-00.png?generation=1596572041971789&amp;alt=media\" alt=\"\"></p>\n\n<ol>\n<li><p>One issue with stitching the images back together is that some boxes along the edge do not line up with the box on the other image and cannot be joined using a script. Therefor, I manually reviewed <strong>every</strong> stitched image at the joining edge to ensure one box per wheat head.</p></li>\n<li><p>There were also a good deal of missing and incorrect boxes. To fix this I compared predictions from one of my models to the ground truth by eye. This allowed me to easily detect boxes that are incorrect, and also helped spot images with the small/large box issue. I corrected several thousand boxes during this step, not sure on an exact count.</p></li>\n<li><p>Finally, some boxes were extended beyond the wheat head to include some of the background while others were more \"tight\" to the wheat head. As one of the competition organizers eluded to, the boxes in the test set were all close to the wheat head so I tried to emulate that in my dataset. I did this just by manually adjusting the size of boxes but was not able to do this for all images. A semi-supervised/pseudolabeling method probably would have worked better here and could probably still improve upon my dataset.</p></li>\n</ol>\n\n<p>All the manual corrections I did were done by converting the CSV to XML, using <a href=\"https://github.com/tzutalin/labelImg\">labelImg</a> to perform the corrections, and converting it back to the CSV format.</p>\n\n<p>The full refined dataset can be found on Kaggle here: <a href=\"https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined\">https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined</a></p>\n\n<p>If you have questions, feel free to ask! :)</p>",
  "messages": [
    {
      "id": "958214",
      "postDate": "08/04/2020 21:07:59",
      "content": "<p>Now that the competition is nearing close, I have prepared my refined dataset to be released! While this dataset is still not perfect, it is definitely a step up from the initial dataset and I did spend a good amount of time on it. </p>\n\n<p>Here's the main things I did:\n1. Restored the original images by stitching the image patches together. If you didn't know, the dataset authors split the original images into patches as shown below. I wrote a script to stitch the images back together so we could work with the original full-size images. I credit the idea of this approach to <a href=\"/pestipeti\">@pestipeti</a> as he introduced it <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/149805\">here</a>.\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F846065%2Fa6bfd3bc3a81ef564b67af9346a70af8%2FScreenshot%20from%202020-08-04%2016-11-00.png?generation=1596572041971789&amp;alt=media\" alt=\"\"></p>\n\n<ol>\n<li><p>One issue with stitching the images back together is that some boxes along the edge do not line up with the box on the other image and cannot be joined using a script. Therefor, I manually reviewed <strong>every</strong> stitched image at the joining edge to ensure one box per wheat head.</p></li>\n<li><p>There were also a good deal of missing and incorrect boxes. To fix this I compared predictions from one of my models to the ground truth by eye. This allowed me to easily detect boxes that are incorrect, and also helped spot images with the small/large box issue. I corrected several thousand boxes during this step, not sure on an exact count.</p></li>\n<li><p>Finally, some boxes were extended beyond the wheat head to include some of the background while others were more \"tight\" to the wheat head. As one of the competition organizers eluded to, the boxes in the test set were all close to the wheat head so I tried to emulate that in my dataset. I did this just by manually adjusting the size of boxes but was not able to do this for all images. A semi-supervised/pseudolabeling method probably would have worked better here and could probably still improve upon my dataset.</p></li>\n</ol>\n\n<p>All the manual corrections I did were done by converting the CSV to XML, using <a href=\"https://github.com/tzutalin/labelImg\">labelImg</a> to perform the corrections, and converting it back to the CSV format.</p>\n\n<p>The full refined dataset can be found on Kaggle here: <a href=\"https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined\">https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined</a></p>\n\n<p>If you have questions, feel free to ask! :)</p>",
      "rawMarkdown": "Now that the competition is nearing close, I have prepared my refined dataset to be released! While this dataset is still not perfect, it is definitely a step up from the initial dataset and I did spend a good amount of time on it. \n\nHere's the main things I did:\n1. Restored the original images by stitching the image patches together. If you didn't know, the dataset authors split the original images into patches as shown below. I wrote a script to stitch the images back together so we could work with the original full-size images. I credit the idea of this approach to @pestipeti as he introduced it [here](https://www.kaggle.com/c/global-wheat-detection/discussion/149805).\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F846065%2Fa6bfd3bc3a81ef564b67af9346a70af8%2FScreenshot%20from%202020-08-04%2016-11-00.png?generation=1596572041971789&amp;alt=media)\n\n2. One issue with stitching the images back together is that some boxes along the edge do not line up with the box on the other image and cannot be joined using a script. Therefor, I manually reviewed **every** stitched image at the joining edge to ensure one box per wheat head.\n\n3. There were also a good deal of missing and incorrect boxes. To fix this I compared predictions from one of my models to the ground truth by eye. This allowed me to easily detect boxes that are incorrect, and also helped spot images with the small/large box issue. I corrected several thousand boxes during this step, not sure on an exact count.\n\n4. Finally, some boxes were extended beyond the wheat head to include some of the background while others were more \"tight\" to the wheat head. As one of the competition organizers eluded to, the boxes in the test set were all close to the wheat head so I tried to emulate that in my dataset. I did this just by manually adjusting the size of boxes but was not able to do this for all images. A semi-supervised/pseudolabeling method probably would have worked better here and could probably still improve upon my dataset.\n\nAll the manual corrections I did were done by converting the CSV to XML, using [labelImg](https://github.com/tzutalin/labelImg) to perform the corrections, and converting it back to the CSV format.\n\nThe full refined dataset can be found on Kaggle here: https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined\n\nIf you have questions, feel free to ask! :)",
      "votes": null
    },
    {
      "id": "958227",
      "postDate": "08/04/2020 21:16:36",
      "content": "<p>You did a lot of manual work!\nHow do you think, how much do such clearing help you? Maybe you know the boost.</p>",
      "rawMarkdown": "You did a lot of manual work!\nHow do you think, how much do such clearing help you? Maybe you know the boost.",
      "votes": null
    },
    {
      "id": "958237",
      "postDate": "08/04/2020 21:24:55",
      "content": "<p>I'm not sure on an exact score boost as I didn't do a great job tracking all my submissions. It did definitely help though.</p>",
      "rawMarkdown": "I'm not sure on an exact score boost as I didn't do a great job tracking all my submissions. It did definitely help though.",
      "votes": null
    },
    {
      "id": "958252",
      "postDate": "08/04/2020 21:55:42",
      "content": "<p>This is very impressive. I cleaned my extended dataset using an automatic heuristic.</p>",
      "rawMarkdown": "This is very impressive. I cleaned my extended dataset using an automatic heuristic.",
      "votes": null
    },
    {
      "id": "958256",
      "postDate": "08/04/2020 21:58:30",
      "content": "<p>I'm sure that would have been a lot faster than my manual review! Do you care to share what kind of heuristic? I would be interested to hear more. I thought about adding some kind of heuristic like contracting/expanding the boxes based on source or box size but didn't actually try this.</p>",
      "rawMarkdown": "I'm sure that would have been a lot faster than my manual review! Do you care to share what kind of heuristic? I would be interested to hear more. I thought about adding some kind of heuristic like contracting/expanding the boxes based on source or box size but didn't actually try this.",
      "votes": null
    },
    {
      "id": "958261",
      "postDate": "08/04/2020 22:04:53",
      "content": "<p>Regarding bad box, I just banned boxes that are too large and too small by the distribution on GWHD paper.</p>\n\n<p>Regarding the non-aligned images, I realized that their characteristics is that one of (x1, y1, x2, y2) is exactly divisible by 1024. So I prefilter all boxes in the first place by this. Then I group them by IoU between vertical and horizontal semgents. This leaves out only the real overlapping 2-groupings. Then I fuse these boxes by simply (min(y1,y'1), min(x1,x'1), max(y2,y'2), max(x2,x'2)) .</p>",
      "rawMarkdown": "Regarding bad box, I just banned boxes that are too large and too small by the distribution on GWHD paper.\n\nRegarding the non-aligned images, I realized that their characteristics is that one of (x1, y1, x2, y2) is exactly divisible by 1024. So I prefilter all boxes in the first place by this. Then I group them by IoU between vertical and horizontal semgents. This leaves out only the real overlapping 2-groupings. Then I fuse these boxes by simply (min(y1,y'1), min(x1,x'1), max(y2,y'2), max(x2,x'2)) .",
      "votes": null
    },
    {
      "id": "958264",
      "postDate": "08/04/2020 22:06:52",
      "content": "<p>Interesting! Thank you for sharing</p>",
      "rawMarkdown": "Interesting! Thank you for sharing",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 958227,
      "author_name": "sergeyzlobin",
      "author_url": "",
      "post_date": "08/04/2020 21:16:36",
      "content": "<p>You did a lot of manual work!\nHow do you think, how much do such clearing help you? Maybe you know the boost.</p>",
      "votes": null,
      "replies": [
        {
          "id": 958237,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "08/04/2020 21:24:55",
          "content": "<p>I'm not sure on an exact score boost as I didn't do a great job tracking all my submissions. It did definitely help though.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 958252,
      "author_name": "alexanderliao",
      "author_url": "",
      "post_date": "08/04/2020 21:55:42",
      "content": "<p>This is very impressive. I cleaned my extended dataset using an automatic heuristic.</p>",
      "votes": null,
      "replies": [
        {
          "id": 958256,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "08/04/2020 21:58:30",
          "content": "<p>I'm sure that would have been a lot faster than my manual review! Do you care to share what kind of heuristic? I would be interested to hear more. I thought about adding some kind of heuristic like contracting/expanding the boxes based on source or box size but didn't actually try this.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 958261,
          "author_name": "alexanderliao",
          "author_url": "",
          "post_date": "08/04/2020 22:04:53",
          "content": "<p>Regarding bad box, I just banned boxes that are too large and too small by the distribution on GWHD paper.</p>\n\n<p>Regarding the non-aligned images, I realized that their characteristics is that one of (x1, y1, x2, y2) is exactly divisible by 1024. So I prefilter all boxes in the first place by this. Then I group them by IoU between vertical and horizontal semgents. This leaves out only the real overlapping 2-groupings. Then I fuse these boxes by simply (min(y1,y'1), min(x1,x'1), max(y2,y'2), max(x2,x'2)) .</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 958264,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "08/04/2020 22:06:52",
          "content": "<p>Interesting! Thank you for sharing</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "958214": "Now that the competition is nearing close, I have prepared my refined dataset to be released! While this dataset is still not perfect, it is definitely a step up from the initial dataset and I did spend a good amount of time on it. \n\nHere's the main things I did:\n1. Restored the original images by stitching the image patches together. If you didn't know, the dataset authors split the original images into patches as shown below. I wrote a script to stitch the images back together so we could work with the original full-size images. I credit the idea of this approach to @pestipeti as he introduced it [here](https://www.kaggle.com/c/global-wheat-detection/discussion/149805).\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F846065%2Fa6bfd3bc3a81ef564b67af9346a70af8%2FScreenshot%20from%202020-08-04%2016-11-00.png?generation=1596572041971789&amp;alt=media)\n\n2. One issue with stitching the images back together is that some boxes along the edge do not line up with the box on the other image and cannot be joined using a script. Therefor, I manually reviewed **every** stitched image at the joining edge to ensure one box per wheat head.\n\n3. There were also a good deal of missing and incorrect boxes. To fix this I compared predictions from one of my models to the ground truth by eye. This allowed me to easily detect boxes that are incorrect, and also helped spot images with the small/large box issue. I corrected several thousand boxes during this step, not sure on an exact count.\n\n4. Finally, some boxes were extended beyond the wheat head to include some of the background while others were more \"tight\" to the wheat head. As one of the competition organizers eluded to, the boxes in the test set were all close to the wheat head so I tried to emulate that in my dataset. I did this just by manually adjusting the size of boxes but was not able to do this for all images. A semi-supervised/pseudolabeling method probably would have worked better here and could probably still improve upon my dataset.\n\nAll the manual corrections I did were done by converting the CSV to XML, using [labelImg](https://github.com/tzutalin/labelImg) to perform the corrections, and converting it back to the CSV format.\n\nThe full refined dataset can be found on Kaggle here: https://www.kaggle.com/matthewmasters/global-wheat-head-dataset-manually-refined\n\nIf you have questions, feel free to ask! :)",
    "958227": "You did a lot of manual work!\nHow do you think, how much do such clearing help you? Maybe you know the boost.",
    "958237": "I'm not sure on an exact score boost as I didn't do a great job tracking all my submissions. It did definitely help though.",
    "958252": "This is very impressive. I cleaned my extended dataset using an automatic heuristic.",
    "958256": "I'm sure that would have been a lot faster than my manual review! Do you care to share what kind of heuristic? I would be interested to hear more. I thought about adding some kind of heuristic like contracting/expanding the boxes based on source or box size but didn't actually try this.",
    "958261": "Regarding bad box, I just banned boxes that are too large and too small by the distribution on GWHD paper.\n\nRegarding the non-aligned images, I realized that their characteristics is that one of (x1, y1, x2, y2) is exactly divisible by 1024. So I prefilter all boxes in the first place by this. Then I group them by IoU between vertical and horizontal semgents. This leaves out only the real overlapping 2-groupings. Then I fuse these boxes by simply (min(y1,y'1), min(x1,x'1), max(y2,y'2), max(x2,x'2)) .",
    "958264": "Interesting! Thank you for sharing"
  },
  "source": "meta"
}