{
  "id": 149805,
  "title": "Jigsaw puzzle in train",
  "url": "/competitions/global-wheat-detection/discussion/149805",
  "author_name": "",
  "post_date": "2020-05-10T00:23:39.336802500Z",
  "votes": 47,
  "comment_count": 17,
  "views": 0,
  "content": "<h2>Jigsaw puzzle in train</h2>\n\n<p>According to the <a href=\"https://arxiv.org/pdf/2005.02162.pdf\">GWHD paper</a> the images were split into 1024 x 1024 squared patches containing roughly 20 to 60 heads with only a few heads crossing the edges.</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F9068f7f8dd526caa3657407c477e418f%2Fgwhd_splits.jpg?generation=1589069353753211&amp;alt=media\" alt=\"\"></p>\n\n<p>We can recreate the original images with a simple jigsaw puzzle. Here are a few examples:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F978876e212783321b2132be5af9fb826%2Farvalis_2_jigsaw_1.jpg?generation=1589069504810653&amp;alt=media\" alt=\"\">\n<em>Ids: ('59ade64e1', 'c8237c2e6', '740d3c904', '031ed396f')</em></p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F7c3e3c77044405c60b405f20cf4f5bd4%2Farvalis_2_jigsaw_2.jpg?generation=1589069517303620&amp;alt=media\" alt=\"\">\n<em>Ids: ('84d992b88', 'b72ba28ed', 'd950bfe39', '6ef909f8f')</em></p>\n\n<h2>How can we use these?</h2>\n\n<ul>\n<li>During training, we can generate lots of new images.</li>\n<li>Fortunately, this does not mean data leaking, because there is no overlap between train/test (the test set has different <code>sources</code>; <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/149770\">more details here</a>)</li>\n<li>In the test set, only images from <code>utokyo_2</code> (9%) were split.</li>\n</ul>\n\n<h2>Code</h2>\n\n<p>You can find the code <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">here</a></p>",
  "messages": [
    {
      "id": "840358",
      "postDate": "05/10/2020 00:23:39",
      "content": "<h2>Jigsaw puzzle in train</h2>\n\n<p>According to the <a href=\"https://arxiv.org/pdf/2005.02162.pdf\">GWHD paper</a> the images were split into 1024 x 1024 squared patches containing roughly 20 to 60 heads with only a few heads crossing the edges.</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F9068f7f8dd526caa3657407c477e418f%2Fgwhd_splits.jpg?generation=1589069353753211&amp;alt=media\" alt=\"\"></p>\n\n<p>We can recreate the original images with a simple jigsaw puzzle. Here are a few examples:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F978876e212783321b2132be5af9fb826%2Farvalis_2_jigsaw_1.jpg?generation=1589069504810653&amp;alt=media\" alt=\"\">\n<em>Ids: ('59ade64e1', 'c8237c2e6', '740d3c904', '031ed396f')</em></p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F7c3e3c77044405c60b405f20cf4f5bd4%2Farvalis_2_jigsaw_2.jpg?generation=1589069517303620&amp;alt=media\" alt=\"\">\n<em>Ids: ('84d992b88', 'b72ba28ed', 'd950bfe39', '6ef909f8f')</em></p>\n\n<h2>How can we use these?</h2>\n\n<ul>\n<li>During training, we can generate lots of new images.</li>\n<li>Fortunately, this does not mean data leaking, because there is no overlap between train/test (the test set has different <code>sources</code>; <a href=\"https://www.kaggle.com/c/global-wheat-detection/discussion/149770\">more details here</a>)</li>\n<li>In the test set, only images from <code>utokyo_2</code> (9%) were split.</li>\n</ul>\n\n<h2>Code</h2>\n\n<p>You can find the code <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">here</a></p>",
      "rawMarkdown": "## Jigsaw puzzle in train\nAccording to the [GWHD paper](https://arxiv.org/pdf/2005.02162.pdf) the images were split into 1024 x 1024 squared patches containing roughly 20 to 60 heads with only a few heads crossing the edges.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F9068f7f8dd526caa3657407c477e418f%2Fgwhd_splits.jpg?generation=1589069353753211&amp;alt=media)\n\nWe can recreate the original images with a simple jigsaw puzzle. Here are a few examples:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F978876e212783321b2132be5af9fb826%2Farvalis_2_jigsaw_1.jpg?generation=1589069504810653&amp;alt=media)\n*Ids: ('59ade64e1', 'c8237c2e6', '740d3c904', '031ed396f')*\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F7c3e3c77044405c60b405f20cf4f5bd4%2Farvalis_2_jigsaw_2.jpg?generation=1589069517303620&amp;alt=media)\n*Ids: ('84d992b88', 'b72ba28ed', 'd950bfe39', '6ef909f8f')*\n\n## How can we use these?\n- During training, we can generate lots of new images.\n- Fortunately, this does not mean data leaking, because there is no overlap between train/test (the test set has different `sources`; [more details here](https://www.kaggle.com/c/global-wheat-detection/discussion/149770))\n- In the test set, only images from `utokyo_2` (9%) were split.\n\n## Code\nYou can find the code [here](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved)",
      "votes": null
    },
    {
      "id": "840385",
      "postDate": "05/10/2020 01:09:32",
      "content": "<p>Wow, what a great idea! I hadn't thought about that</p>",
      "rawMarkdown": "Wow, what a great idea! I hadn't thought about that",
      "votes": null
    },
    {
      "id": "840422",
      "postDate": "05/10/2020 02:29:06",
      "content": "<p>awesome, thanks for sharing</p>",
      "rawMarkdown": "awesome, thanks for sharing",
      "votes": null
    },
    {
      "id": "840841",
      "postDate": "05/10/2020 12:30:58",
      "content": "<p>thank, its a very good idea</p>",
      "rawMarkdown": "thank, its a very good idea",
      "votes": null
    },
    {
      "id": "840878",
      "postDate": "05/10/2020 13:08:31",
      "content": "<p>That would be very very cool ... I'm wondering how this could be done in programmatically tho ;)</p>",
      "rawMarkdown": "That would be very very cool ... I'm wondering how this could be done in programmatically tho ;)",
      "votes": null
    },
    {
      "id": "840880",
      "postDate": "05/10/2020 13:10:27",
      "content": "<blockquote>\n  <p>During training, we can generate lots of new images.</p>\n</blockquote>\n\n<p>This is great! Especially because the training is so small.  </p>",
      "rawMarkdown": "&gt;During training, we can generate lots of new images.\n\nThis is great! Especially because the training is so small.",
      "votes": null
    },
    {
      "id": "840903",
      "postDate": "05/10/2020 13:30:35",
      "content": "<p>I'm working on it. Hopefully, I can share it today.</p>",
      "rawMarkdown": "I'm working on it. Hopefully, I can share it today.",
      "votes": null
    },
    {
      "id": "841269",
      "postDate": "05/10/2020 17:38:07",
      "content": "<p>Can I ask how you are going about the jigsaw?\nIs the main idea to split an image in a few places, randomly pair the splits and classify if they are actually next to each other? </p>",
      "rawMarkdown": "Can I ask how you are going about the jigsaw?\nIs the main idea to split an image in a few places, randomly pair the splits and classify if they are actually next to each other?",
      "votes": null
    },
    {
      "id": "841332",
      "postDate": "05/10/2020 18:26:48",
      "content": "<p>The code is available <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">here</a></p>",
      "rawMarkdown": "The code is available [here](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved)",
      "votes": null
    },
    {
      "id": "841419",
      "postDate": "05/10/2020 19:30:49",
      "content": "<p>I haven't looked at the code but I assume it's something like this: you take edges of each patch and compare it to edges from other patches. If the average difference in pixel color is below a certain threshold, then flag them as likely being connected.</p>",
      "rawMarkdown": "I haven't looked at the code but I assume it's something like this: you take edges of each patch and compare it to edges from other patches. If the average difference in pixel color is below a certain threshold, then flag them as likely being connected.",
      "votes": null
    },
    {
      "id": "841629",
      "postDate": "05/10/2020 22:45:46",
      "content": "<p>I am very new to all of this so my suggestion may be stupid but here goes.</p>\n\n<p>After the jigsaw is connected and we now have \"more\" data could we use some sort of ensemble method? Could we run a model with the jigsaw pieces as in the original and get estimates of the boxes, then run a second model with the \"full\" images where the pieces are connected to also predict the boxes. From there could there be some comparison of the models and only select boxes that were found on both the original model and the jigsaw model?</p>",
      "rawMarkdown": "I am very new to all of this so my suggestion may be stupid but here goes.\n\nAfter the jigsaw is connected and we now have \"more\" data could we use some sort of ensemble method? Could we run a model with the jigsaw pieces as in the original and get estimates of the boxes, then run a second model with the \"full\" images where the pieces are connected to also predict the boxes. From there could there be some comparison of the models and only select boxes that were found on both the original model and the jigsaw model?",
      "votes": null
    },
    {
      "id": "848471",
      "postDate": "05/15/2020 02:09:31",
      "content": "<p>🤔That's true.I have looked at the code,but i wonder that we should feed the new image into model directily? different input size will cause some problem.  </p>",
      "rawMarkdown": "🤔That's true.I have looked at the code,but i wonder that we should feed the new image into model directily? different input size will cause some problem.",
      "votes": null
    },
    {
      "id": "848571",
      "postDate": "05/15/2020 04:39:25",
      "content": "<p>You wouldn't feed the stitched together images into the network. The purpose of this is to generate more training data</p>",
      "rawMarkdown": "You wouldn't feed the stitched together images into the network. The purpose of this is to generate more training data",
      "votes": null
    },
    {
      "id": "848590",
      "postDate": "05/15/2020 05:08:24",
      "content": "<p>Do you mean that the full size image should be re-split into 1024*1024 squared patches(with a new up/dowm sample) so that can generate more training data to use?  What if you don’t feed into the network to train and generate training data? :D</p>",
      "rawMarkdown": "Do you mean that the full size image should be re-split into 1024*1024 squared patches(with a new up/dowm sample) so that can generate more training data to use?  What if you don’t feed into the network to train and generate training data? :D",
      "votes": null
    },
    {
      "id": "848614",
      "postDate": "05/15/2020 05:35:12",
      "content": "<p>Yeah, my general idea is that you could then take overlapping 1024^2 patches and therefor increase the dataset size. Perhaps this also enables you to take rotated patches as well, though this may effect the bounding boxes negatively.</p>",
      "rawMarkdown": "Yeah, my general idea is that you could then take overlapping 1024^2 patches and therefor increase the dataset size. Perhaps this also enables you to take rotated patches as well, though this may effect the bounding boxes negatively.",
      "votes": null
    },
    {
      "id": "848708",
      "postDate": "05/15/2020 07:13:46",
      "content": "<p>Got it.Thank you for reply.I will try it soon and public the e for reply.I will try it soon and public the effect.:D</p>",
      "rawMarkdown": "Got it.Thank you for reply.I will try it soon and public the e for reply.I will try it soon and public the effect.:D",
      "votes": null
    },
    {
      "id": "893641",
      "postDate": "06/19/2020 19:07:15",
      "content": "<p>Interesting</p>",
      "rawMarkdown": "Interesting",
      "votes": null
    },
    {
      "id": "914374",
      "postDate": "07/03/2020 19:59:06",
      "content": "<p>Very interesting observation. I was going to ask how you found the patches then saw you added a notebook. Thanks for everything. :)</p>",
      "rawMarkdown": "Very interesting observation. I was going to ask how you found the patches then saw you added a notebook. Thanks for everything. :)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 840385,
      "author_name": "matthewmasters",
      "author_url": "",
      "post_date": "05/10/2020 01:09:32",
      "content": "<p>Wow, what a great idea! I hadn't thought about that</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 840422,
      "author_name": "nvnnghia",
      "author_url": "",
      "post_date": "05/10/2020 02:29:06",
      "content": "<p>awesome, thanks for sharing</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 840841,
      "author_name": "kvishesh1",
      "author_url": "",
      "post_date": "05/10/2020 12:30:58",
      "content": "<p>thank, its a very good idea</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 840878,
      "author_name": "ma7moud",
      "author_url": "",
      "post_date": "05/10/2020 13:08:31",
      "content": "<p>That would be very very cool ... I'm wondering how this could be done in programmatically tho ;)</p>",
      "votes": null,
      "replies": [
        {
          "id": 840903,
          "author_name": "pestipeti",
          "author_url": "",
          "post_date": "05/10/2020 13:30:35",
          "content": "<p>I'm working on it. Hopefully, I can share it today.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 840880,
      "author_name": "timetraveller98",
      "author_url": "",
      "post_date": "05/10/2020 13:10:27",
      "content": "<blockquote>\n  <p>During training, we can generate lots of new images.</p>\n</blockquote>\n\n<p>This is great! Especially because the training is so small.  </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 841269,
      "author_name": "zero00",
      "author_url": "",
      "post_date": "05/10/2020 17:38:07",
      "content": "<p>Can I ask how you are going about the jigsaw?\nIs the main idea to split an image in a few places, randomly pair the splits and classify if they are actually next to each other? </p>",
      "votes": null,
      "replies": [
        {
          "id": 841419,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/10/2020 19:30:49",
          "content": "<p>I haven't looked at the code but I assume it's something like this: you take edges of each patch and compare it to edges from other patches. If the average difference in pixel color is below a certain threshold, then flag them as likely being connected.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848471,
          "author_name": "raininbox",
          "author_url": "",
          "post_date": "05/15/2020 02:09:31",
          "content": "<p>🤔That's true.I have looked at the code,but i wonder that we should feed the new image into model directily? different input size will cause some problem.  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848571,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/15/2020 04:39:25",
          "content": "<p>You wouldn't feed the stitched together images into the network. The purpose of this is to generate more training data</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848590,
          "author_name": "raininbox",
          "author_url": "",
          "post_date": "05/15/2020 05:08:24",
          "content": "<p>Do you mean that the full size image should be re-split into 1024*1024 squared patches(with a new up/dowm sample) so that can generate more training data to use?  What if you don’t feed into the network to train and generate training data? :D</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848614,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/15/2020 05:35:12",
          "content": "<p>Yeah, my general idea is that you could then take overlapping 1024^2 patches and therefor increase the dataset size. Perhaps this also enables you to take rotated patches as well, though this may effect the bounding boxes negatively.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848708,
          "author_name": "raininbox",
          "author_url": "",
          "post_date": "05/15/2020 07:13:46",
          "content": "<p>Got it.Thank you for reply.I will try it soon and public the e for reply.I will try it soon and public the effect.:D</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 841332,
      "author_name": "pestipeti",
      "author_url": "",
      "post_date": "05/10/2020 18:26:48",
      "content": "<p>The code is available <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">here</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 841629,
      "author_name": "blueturtle",
      "author_url": "",
      "post_date": "05/10/2020 22:45:46",
      "content": "<p>I am very new to all of this so my suggestion may be stupid but here goes.</p>\n\n<p>After the jigsaw is connected and we now have \"more\" data could we use some sort of ensemble method? Could we run a model with the jigsaw pieces as in the original and get estimates of the boxes, then run a second model with the \"full\" images where the pieces are connected to also predict the boxes. From there could there be some comparison of the models and only select boxes that were found on both the original model and the jigsaw model?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 893641,
      "author_name": "yosukey",
      "author_url": "",
      "post_date": "06/19/2020 19:07:15",
      "content": "<p>Interesting</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 914374,
      "author_name": "yassinealouini",
      "author_url": "",
      "post_date": "07/03/2020 19:59:06",
      "content": "<p>Very interesting observation. I was going to ask how you found the patches then saw you added a notebook. Thanks for everything. :)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "840358": "## Jigsaw puzzle in train\nAccording to the [GWHD paper](https://arxiv.org/pdf/2005.02162.pdf) the images were split into 1024 x 1024 squared patches containing roughly 20 to 60 heads with only a few heads crossing the edges.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F9068f7f8dd526caa3657407c477e418f%2Fgwhd_splits.jpg?generation=1589069353753211&amp;alt=media)\n\nWe can recreate the original images with a simple jigsaw puzzle. Here are a few examples:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F978876e212783321b2132be5af9fb826%2Farvalis_2_jigsaw_1.jpg?generation=1589069504810653&amp;alt=media)\n*Ids: ('59ade64e1', 'c8237c2e6', '740d3c904', '031ed396f')*\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F7c3e3c77044405c60b405f20cf4f5bd4%2Farvalis_2_jigsaw_2.jpg?generation=1589069517303620&amp;alt=media)\n*Ids: ('84d992b88', 'b72ba28ed', 'd950bfe39', '6ef909f8f')*\n\n## How can we use these?\n- During training, we can generate lots of new images.\n- Fortunately, this does not mean data leaking, because there is no overlap between train/test (the test set has different `sources`; [more details here](https://www.kaggle.com/c/global-wheat-detection/discussion/149770))\n- In the test set, only images from `utokyo_2` (9%) were split.\n\n## Code\nYou can find the code [here](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved)",
    "840385": "Wow, what a great idea! I hadn't thought about that",
    "840422": "awesome, thanks for sharing",
    "840841": "thank, its a very good idea",
    "840878": "That would be very very cool ... I'm wondering how this could be done in programmatically tho ;)",
    "840880": "&gt;During training, we can generate lots of new images.\n\nThis is great! Especially because the training is so small.",
    "840903": "I'm working on it. Hopefully, I can share it today.",
    "841269": "Can I ask how you are going about the jigsaw?\nIs the main idea to split an image in a few places, randomly pair the splits and classify if they are actually next to each other?",
    "841332": "The code is available [here](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved)",
    "841419": "I haven't looked at the code but I assume it's something like this: you take edges of each patch and compare it to edges from other patches. If the average difference in pixel color is below a certain threshold, then flag them as likely being connected.",
    "841629": "I am very new to all of this so my suggestion may be stupid but here goes.\n\nAfter the jigsaw is connected and we now have \"more\" data could we use some sort of ensemble method? Could we run a model with the jigsaw pieces as in the original and get estimates of the boxes, then run a second model with the \"full\" images where the pieces are connected to also predict the boxes. From there could there be some comparison of the models and only select boxes that were found on both the original model and the jigsaw model?",
    "848471": "🤔That's true.I have looked at the code,but i wonder that we should feed the new image into model directily? different input size will cause some problem.",
    "848571": "You wouldn't feed the stitched together images into the network. The purpose of this is to generate more training data",
    "848590": "Do you mean that the full size image should be re-split into 1024*1024 squared patches(with a new up/dowm sample) so that can generate more training data to use?  What if you don’t feed into the network to train and generate training data? :D",
    "848614": "Yeah, my general idea is that you could then take overlapping 1024^2 patches and therefor increase the dataset size. Perhaps this also enables you to take rotated patches as well, though this may effect the bounding boxes negatively.",
    "848708": "Got it.Thank you for reply.I will try it soon and public the e for reply.I will try it soon and public the effect.:D",
    "893641": "Interesting",
    "914374": "Very interesting observation. I was going to ask how you found the patches then saw you added a notebook. Thanks for everything. :)"
  },
  "source": "meta"
}