{
  "id": 150270,
  "title": "Data Augmentation for object detection experiments ",
  "url": "/competitions/global-wheat-detection/discussion/150270",
  "author_name": "",
  "post_date": "2020-05-11T17:24:40.920948700Z",
  "votes": 6,
  "comment_count": 18,
  "views": 0,
  "content": "<p>Since my GPU quota is out for the week, I'm stepping back a little and looking at what can be done to enhance the training process by augmentation.</p>\n\n<p>The most successful approaches I found in literature generally for object detection are either an RL/autoaugment approach by Google Research and the EfficientDet work (which can be expensive because the standard config needs an RL agent try a policy and train for 120 epochs 😅 ) as well as the self supervised approaches (or pseudo labels that has impressive results in this competition).</p>\n\n<p>I'm wondering if there are specific techniques that anyone is aware of for the dataset type (tileable/ patches) , the obvious one being combine batches and random crop a 1K box to generate a new sample, <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">work</a> by @pestipeti would definitely help in that area.</p>\n\n<p>Maybe ideas from GIS / satellite imagery folks?   </p>\n\n<p>Share ideas here please 😁 </p>",
  "messages": [
    {
      "id": "842891",
      "postDate": "05/11/2020 17:24:40",
      "content": "<p>Since my GPU quota is out for the week, I'm stepping back a little and looking at what can be done to enhance the training process by augmentation.</p>\n\n<p>The most successful approaches I found in literature generally for object detection are either an RL/autoaugment approach by Google Research and the EfficientDet work (which can be expensive because the standard config needs an RL agent try a policy and train for 120 epochs 😅 ) as well as the self supervised approaches (or pseudo labels that has impressive results in this competition).</p>\n\n<p>I'm wondering if there are specific techniques that anyone is aware of for the dataset type (tileable/ patches) , the obvious one being combine batches and random crop a 1K box to generate a new sample, <a href=\"https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved\">work</a> by @pestipeti would definitely help in that area.</p>\n\n<p>Maybe ideas from GIS / satellite imagery folks?   </p>\n\n<p>Share ideas here please 😁 </p>",
      "rawMarkdown": "Since my GPU quota is out for the week, I'm stepping back a little and looking at what can be done to enhance the training process by augmentation.\n\nThe most successful approaches I found in literature generally for object detection are either an RL/autoaugment approach by Google Research and the EfficientDet work (which can be expensive because the standard config needs an RL agent try a policy and train for 120 epochs 😅 ) as well as the self supervised approaches (or pseudo labels that has impressive results in this competition).\n\nI'm wondering if there are specific techniques that anyone is aware of for the dataset type (tileable/ patches) , the obvious one being combine batches and random crop a 1K box to generate a new sample, [work](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved) by @pestipeti would definitely help in that area.\n\nMaybe ideas from GIS / satellite imagery folks?   \n\nShare ideas here please 😁",
      "votes": null
    },
    {
      "id": "844635",
      "postDate": "05/12/2020 18:13:36",
      "content": "<p>Here are my experiments (I'm new to object detection tasks): I've tried Horizontal, Vertical Flips and Bluring the images but in my case my public LB score decreased. I don't know why. Also I wonder whether should I try image scaling/zooming in/out or not? As this will create bounding boxes out of the images and can confuse the model.</p>",
      "rawMarkdown": "Here are my experiments (I'm new to object detection tasks): I've tried Horizontal, Vertical Flips and Bluring the images but in my case my public LB score decreased. I don't know why. Also I wonder whether should I try image scaling/zooming in/out or not? As this will create bounding boxes out of the images and can confuse the model.",
      "votes": null
    },
    {
      "id": "845764",
      "postDate": "05/13/2020 12:21:56",
      "content": "<p><a href=\"/kaushal2896\">@kaushal2896</a>  May I ask if you perform the augmentations first to expand the existing dataset, or using ImageDataGenerator in keras to perform augmentation on the fly?</p>",
      "rawMarkdown": "kaushal2896  May I ask if you perform the augmentations first to expand the existing dataset, or using ImageDataGenerator in keras to perform augmentation on the fly?",
      "votes": null
    },
    {
      "id": "846290",
      "postDate": "05/13/2020 16:54:49",
      "content": "<p><a href=\"/reighns\">@reighns</a>  I'm using albumentations to perform data augmentation on the fly without expanding the dataset.</p>",
      "rawMarkdown": "reighns  I'm using albumentations to perform data augmentation on the fly without expanding the dataset.",
      "votes": null
    },
    {
      "id": "846317",
      "postDate": "05/13/2020 17:24:34",
      "content": "<p>You would need to transform the bboxes with the same transform you are applying to the images.</p>",
      "rawMarkdown": "You would need to transform the bboxes with the same transform you are applying to the images.",
      "votes": null
    },
    {
      "id": "846937",
      "postDate": "05/14/2020 04:35:05",
      "content": "<p>Yes, that's taken care by albumentations itself.</p>",
      "rawMarkdown": "Yes, that's taken care by albumentations itself.",
      "votes": null
    },
    {
      "id": "847305",
      "postDate": "05/14/2020 09:42:26",
      "content": "<p>For me, random crop improve score significantly.</p>",
      "rawMarkdown": "For me, random crop improve score significantly.",
      "votes": null
    },
    {
      "id": "847335",
      "postDate": "05/14/2020 10:16:57",
      "content": "<p>Do you use albumentations RandomCrop? It doesn't seem to crop the bounding boxes. Did you come across this problem?</p>",
      "rawMarkdown": "Do you use albumentations RandomCrop? It doesn't seem to crop the bounding boxes. Did you come across this problem?",
      "votes": null
    },
    {
      "id": "847439",
      "postDate": "05/14/2020 11:56:14",
      "content": "<p>I wrote the augmentation myself.</p>",
      "rawMarkdown": "I wrote the augmentation myself.",
      "votes": null
    },
    {
      "id": "847481",
      "postDate": "05/14/2020 12:36:57",
      "content": "<p><a href=\"/nvnnghia\">@nvnnghia</a> may I ask if you first artificially expanded the existing dataset with the aforementioned random crop augmentations, then you train?</p>",
      "rawMarkdown": "nvnnghia may I ask if you first artificially expanded the existing dataset with the aforementioned random crop augmentations, then you train?",
      "votes": null
    },
    {
      "id": "847486",
      "postDate": "05/14/2020 12:40:17",
      "content": "<p>I wrote the random crop inside MyDataGenerator(). So, it generates different data in different epoch.</p>",
      "rawMarkdown": "I wrote the random crop inside MyDataGenerator(). So, it generates different data in different epoch.",
      "votes": null
    },
    {
      "id": "847500",
      "postDate": "05/14/2020 12:51:28",
      "content": "<p>Thanks for replying!</p>",
      "rawMarkdown": "Thanks for replying!",
      "votes": null
    },
    {
      "id": "847849",
      "postDate": "05/14/2020 16:21:16",
      "content": "<p><a href=\"/nvnnghia\">@nvnnghia</a> it looks I'm going the same route with custom augmentation ... Thank you for sharing :) </p>",
      "rawMarkdown": "nvnnghia it looks I'm going the same route with custom augmentation ... Thank you for sharing :)",
      "votes": null
    },
    {
      "id": "848404",
      "postDate": "05/15/2020 00:11:47",
      "content": "<p>good to hear that :)</p>",
      "rawMarkdown": "good to hear that :)",
      "votes": null
    },
    {
      "id": "850648",
      "postDate": "05/16/2020 21:30:54",
      "content": "<p>Hi <a href=\"/nvnnghia\">@nvnnghia</a> and <a href=\"/ma7moud\">@ma7moud</a> . I'm new to machine learning.  I'm curious to know why you chose to write the augmentation yourself when Albumentations can augment the bounding boxes and the image as well with RandomCrop and RandomSizedCrop. Your response is highly appreciated. Thanks</p>",
      "rawMarkdown": "Hi @nvnnghia and @ma7moud . I'm new to machine learning.  I'm curious to know why you chose to write the augmentation yourself when Albumentations can augment the bounding boxes and the image as well with RandomCrop and RandomSizedCrop. Your response is highly appreciated. Thanks",
      "votes": null
    },
    {
      "id": "850724",
      "postDate": "05/17/2020 00:26:57",
      "content": "<p>Hi <a href=\"/puneeth333\">@puneeth333</a> \nAlbumentations doesn't seem to crop the bounding boxes. Then I wrote the function myself.</p>",
      "rawMarkdown": "Hi @puneeth333 \nAlbumentations doesn't seem to crop the bounding boxes. Then I wrote the function myself.",
      "votes": null
    },
    {
      "id": "850845",
      "postDate": "05/17/2020 04:52:20",
      "content": "<p><a href=\"/puneeth333\">@puneeth333</a> in this instance I found no out of the box augmentation package that does the augmentation I'm looking for :) </p>",
      "rawMarkdown": "puneeth333 in this instance I found no out of the box augmentation package that does the augmentation I'm looking for :)",
      "votes": null
    },
    {
      "id": "850850",
      "postDate": "05/17/2020 04:54:50",
      "content": "<p><a href=\"/ma7moud\">@ma7moud</a> Would you mind sharing the augmentation package that does the bbox cropping as well? Having major troubles writing out it myself... I did try to refer to albumentations' source code.</p>",
      "rawMarkdown": "ma7moud Would you mind sharing the augmentation package that does the bbox cropping as well? Having major troubles writing out it myself... I did try to refer to albumentations' source code.",
      "votes": null
    },
    {
      "id": "853145",
      "postDate": "05/19/2020 01:59:33",
      "content": "<p><a href=\"/reighns\">@reighns</a> this is a typical geometry problem (is Polygon A inside Polygon B) ... I wrote my own code, but according to this <a href=\"https://stackoverflow.com/questions/55840924/how-to-judge-if-a-polygon-is-inside-another-polygon-in-python\">stackoverflow</a> there seems to be a more reliable (and more tested) package named <a href=\"https://pypi.org/project/Shapely/\">sharply</a> </p>",
      "rawMarkdown": "reighns this is a typical geometry problem (is Polygon A inside Polygon B) ... I wrote my own code, but according to this [stackoverflow](https://stackoverflow.com/questions/55840924/how-to-judge-if-a-polygon-is-inside-another-polygon-in-python) there seems to be a more reliable (and more tested) package named [sharply](https://pypi.org/project/Shapely/)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 844635,
      "author_name": "kaushal2896",
      "author_url": "",
      "post_date": "05/12/2020 18:13:36",
      "content": "<p>Here are my experiments (I'm new to object detection tasks): I've tried Horizontal, Vertical Flips and Bluring the images but in my case my public LB score decreased. I don't know why. Also I wonder whether should I try image scaling/zooming in/out or not? As this will create bounding boxes out of the images and can confuse the model.</p>",
      "votes": null,
      "replies": [
        {
          "id": 845764,
          "author_name": "reighns",
          "author_url": "",
          "post_date": "05/13/2020 12:21:56",
          "content": "<p><a href=\"/kaushal2896\">@kaushal2896</a>  May I ask if you perform the augmentations first to expand the existing dataset, or using ImageDataGenerator in keras to perform augmentation on the fly?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 846290,
          "author_name": "kaushal2896",
          "author_url": "",
          "post_date": "05/13/2020 16:54:49",
          "content": "<p><a href=\"/reighns\">@reighns</a>  I'm using albumentations to perform data augmentation on the fly without expanding the dataset.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 846317,
          "author_name": "ma7moud",
          "author_url": "",
          "post_date": "05/13/2020 17:24:34",
          "content": "<p>You would need to transform the bboxes with the same transform you are applying to the images.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 846937,
          "author_name": "kaushal2896",
          "author_url": "",
          "post_date": "05/14/2020 04:35:05",
          "content": "<p>Yes, that's taken care by albumentations itself.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 847305,
      "author_name": "nvnnghia",
      "author_url": "",
      "post_date": "05/14/2020 09:42:26",
      "content": "<p>For me, random crop improve score significantly.</p>",
      "votes": null,
      "replies": [
        {
          "id": 847335,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/14/2020 10:16:57",
          "content": "<p>Do you use albumentations RandomCrop? It doesn't seem to crop the bounding boxes. Did you come across this problem?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 847439,
          "author_name": "nvnnghia",
          "author_url": "",
          "post_date": "05/14/2020 11:56:14",
          "content": "<p>I wrote the augmentation myself.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 847481,
          "author_name": "reighns",
          "author_url": "",
          "post_date": "05/14/2020 12:36:57",
          "content": "<p><a href=\"/nvnnghia\">@nvnnghia</a> may I ask if you first artificially expanded the existing dataset with the aforementioned random crop augmentations, then you train?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 847486,
          "author_name": "nvnnghia",
          "author_url": "",
          "post_date": "05/14/2020 12:40:17",
          "content": "<p>I wrote the random crop inside MyDataGenerator(). So, it generates different data in different epoch.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 847500,
          "author_name": "reighns",
          "author_url": "",
          "post_date": "05/14/2020 12:51:28",
          "content": "<p>Thanks for replying!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 847849,
          "author_name": "ma7moud",
          "author_url": "",
          "post_date": "05/14/2020 16:21:16",
          "content": "<p><a href=\"/nvnnghia\">@nvnnghia</a> it looks I'm going the same route with custom augmentation ... Thank you for sharing :) </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 848404,
          "author_name": "nvnnghia",
          "author_url": "",
          "post_date": "05/15/2020 00:11:47",
          "content": "<p>good to hear that :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 850648,
          "author_name": "puneeth333",
          "author_url": "",
          "post_date": "05/16/2020 21:30:54",
          "content": "<p>Hi <a href=\"/nvnnghia\">@nvnnghia</a> and <a href=\"/ma7moud\">@ma7moud</a> . I'm new to machine learning.  I'm curious to know why you chose to write the augmentation yourself when Albumentations can augment the bounding boxes and the image as well with RandomCrop and RandomSizedCrop. Your response is highly appreciated. Thanks</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 850724,
          "author_name": "nvnnghia",
          "author_url": "",
          "post_date": "05/17/2020 00:26:57",
          "content": "<p>Hi <a href=\"/puneeth333\">@puneeth333</a> \nAlbumentations doesn't seem to crop the bounding boxes. Then I wrote the function myself.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 850845,
          "author_name": "ma7moud",
          "author_url": "",
          "post_date": "05/17/2020 04:52:20",
          "content": "<p><a href=\"/puneeth333\">@puneeth333</a> in this instance I found no out of the box augmentation package that does the augmentation I'm looking for :) </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 850850,
          "author_name": "reighns",
          "author_url": "",
          "post_date": "05/17/2020 04:54:50",
          "content": "<p><a href=\"/ma7moud\">@ma7moud</a> Would you mind sharing the augmentation package that does the bbox cropping as well? Having major troubles writing out it myself... I did try to refer to albumentations' source code.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 853145,
          "author_name": "ma7moud",
          "author_url": "",
          "post_date": "05/19/2020 01:59:33",
          "content": "<p><a href=\"/reighns\">@reighns</a> this is a typical geometry problem (is Polygon A inside Polygon B) ... I wrote my own code, but according to this <a href=\"https://stackoverflow.com/questions/55840924/how-to-judge-if-a-polygon-is-inside-another-polygon-in-python\">stackoverflow</a> there seems to be a more reliable (and more tested) package named <a href=\"https://pypi.org/project/Shapely/\">sharply</a> </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "842891": "Since my GPU quota is out for the week, I'm stepping back a little and looking at what can be done to enhance the training process by augmentation.\n\nThe most successful approaches I found in literature generally for object detection are either an RL/autoaugment approach by Google Research and the EfficientDet work (which can be expensive because the standard config needs an RL agent try a policy and train for 120 epochs 😅 ) as well as the self supervised approaches (or pseudo labels that has impressive results in this competition).\n\nI'm wondering if there are specific techniques that anyone is aware of for the dataset type (tileable/ patches) , the obvious one being combine batches and random crop a 1K box to generate a new sample, [work](https://www.kaggle.com/pestipeti/jigsaw-puzzle-solved) by @pestipeti would definitely help in that area.\n\nMaybe ideas from GIS / satellite imagery folks?   \n\nShare ideas here please 😁",
    "844635": "Here are my experiments (I'm new to object detection tasks): I've tried Horizontal, Vertical Flips and Bluring the images but in my case my public LB score decreased. I don't know why. Also I wonder whether should I try image scaling/zooming in/out or not? As this will create bounding boxes out of the images and can confuse the model.",
    "845764": "kaushal2896  May I ask if you perform the augmentations first to expand the existing dataset, or using ImageDataGenerator in keras to perform augmentation on the fly?",
    "846290": "reighns  I'm using albumentations to perform data augmentation on the fly without expanding the dataset.",
    "846317": "You would need to transform the bboxes with the same transform you are applying to the images.",
    "846937": "Yes, that's taken care by albumentations itself.",
    "847305": "For me, random crop improve score significantly.",
    "847335": "Do you use albumentations RandomCrop? It doesn't seem to crop the bounding boxes. Did you come across this problem?",
    "847439": "I wrote the augmentation myself.",
    "847481": "nvnnghia may I ask if you first artificially expanded the existing dataset with the aforementioned random crop augmentations, then you train?",
    "847486": "I wrote the random crop inside MyDataGenerator(). So, it generates different data in different epoch.",
    "847500": "Thanks for replying!",
    "847849": "nvnnghia it looks I'm going the same route with custom augmentation ... Thank you for sharing :)",
    "848404": "good to hear that :)",
    "850648": "Hi @nvnnghia and @ma7moud . I'm new to machine learning.  I'm curious to know why you chose to write the augmentation yourself when Albumentations can augment the bounding boxes and the image as well with RandomCrop and RandomSizedCrop. Your response is highly appreciated. Thanks",
    "850724": "Hi @puneeth333 \nAlbumentations doesn't seem to crop the bounding boxes. Then I wrote the function myself.",
    "850845": "puneeth333 in this instance I found no out of the box augmentation package that does the augmentation I'm looking for :)",
    "850850": "ma7moud Would you mind sharing the augmentation package that does the bbox cropping as well? Having major troubles writing out it myself... I did try to refer to albumentations' source code.",
    "853145": "reighns this is a typical geometry problem (is Polygon A inside Polygon B) ... I wrote my own code, but according to this [stackoverflow](https://stackoverflow.com/questions/55840924/how-to-judge-if-a-polygon-is-inside-another-polygon-in-python) there seems to be a more reliable (and more tested) package named [sharply](https://pypi.org/project/Shapely/)"
  },
  "source": "meta"
}