{
  "id": 294006,
  "title": "Augmentation in Detectron2",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/294006",
  "author_name": "",
  "post_date": "2021-12-08T01:59:03.821545400Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I used Detectron2 API to do instance segmentation.<br>\nI tried to augment data like below.</p>\n<pre><code>class AugTrainer(DefaultTrainer):\n    @classmethod\n    def build_train_loader(cls, cfg):\n        return build_detection_train_loader(cfg, \n            mapper=DatasetMapper(cfg, is_train=True, augmentations=[\n                T.RandomBrightness(0.9, 1.1),\n                T.RandomContrast(0.9, 1.1),\n                T.RandomSaturation(0.9, 1.1),\n                T.RandomLighting(0.9),\n                T.RandomFlip(prob=0.5, horizontal=False, vertical=True),\n                T.RandomFlip(prob=0.5, horizontal=True, vertical=False),\n            ]))\n</code></pre>\n<p>It threw no error but Map IoU decreased compared with training with no augmentation.<br>\nCan anyone solve why?</p>",
  "messages": [
    {
      "id": "1611460",
      "postDate": "12/08/2021 01:59:03",
      "content": "<p>I used Detectron2 API to do instance segmentation.<br>\nI tried to augment data like below.</p>\n<pre><code>class AugTrainer(DefaultTrainer):\n    @classmethod\n    def build_train_loader(cls, cfg):\n        return build_detection_train_loader(cfg, \n            mapper=DatasetMapper(cfg, is_train=True, augmentations=[\n                T.RandomBrightness(0.9, 1.1),\n                T.RandomContrast(0.9, 1.1),\n                T.RandomSaturation(0.9, 1.1),\n                T.RandomLighting(0.9),\n                T.RandomFlip(prob=0.5, horizontal=False, vertical=True),\n                T.RandomFlip(prob=0.5, horizontal=True, vertical=False),\n            ]))\n</code></pre>\n<p>It threw no error but Map IoU decreased compared with training with no augmentation.<br>\nCan anyone solve why?</p>",
      "rawMarkdown": "I used Detectron2 API to do instance segmentation.\nI tried to augment data like below.\n\n```python\nclass AugTrainer(DefaultTrainer):\n    @classmethod\n    def build_train_loader(cls, cfg):\n        return build_detection_train_loader(cfg, \n            mapper=DatasetMapper(cfg, is_train=True, augmentations=[\n                T.RandomBrightness(0.9, 1.1),\n                T.RandomContrast(0.9, 1.1),\n                T.RandomSaturation(0.9, 1.1),\n                T.RandomLighting(0.9),\n                T.RandomFlip(prob=0.5, horizontal=False, vertical=True),\n                T.RandomFlip(prob=0.5, horizontal=True, vertical=False),\n            ]))\n\n```\n\nIt threw no error but Map IoU decreased compared with training with no augmentation.\nCan anyone solve why?",
      "votes": null
    },
    {
      "id": "1611574",
      "postDate": "12/08/2021 04:50:10",
      "content": "<p>Maybe some augmentation you adopted brought new data which has not similar distribution as the training set/test set</p>",
      "rawMarkdown": "Maybe some augmentation you adopted brought new data which has not similar distribution as the training set/test set",
      "votes": null
    },
    {
      "id": "1613748",
      "postDate": "12/10/2021 08:49:32",
      "content": "<p>I meet this problem too it seems no  flip rotate and crop all hurt performance ， I dont know why</p>",
      "rawMarkdown": "I meet this problem too it seems no  flip rotate and crop all hurt performance ， I dont know why",
      "votes": null
    },
    {
      "id": "1613847",
      "postDate": "12/10/2021 10:23:00",
      "content": "<p>I believe Broken Astro masks are the reason, since the top and bottom parts of some masks are broken in their own ways.<br>\nThat being said, I've not tested this, so don't quote me on this.</p>",
      "rawMarkdown": "I believe Broken Astro masks are the reason, since the top and bottom parts of some masks are broken in their own ways.\nThat being said, I've not tested this, so don't quote me on this.",
      "votes": null
    },
    {
      "id": "1614178",
      "postDate": "12/10/2021 18:02:11",
      "content": "<pre><code>[DatasetMapper] Augmentations used in training: \n[\nResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style='choice'), \nRandomFlip()\n]\n</code></pre>\n<p>augmentations of default trainer, maybe the ResizeShortestEdge is crucial </p>",
      "rawMarkdown": "```\n [DatasetMapper] Augmentations used in training: \n[\nResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style='choice'), \nRandomFlip()\n]\n```\n\naugmentations of default trainer, maybe the ResizeShortestEdge is crucial",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1611574,
      "author_name": "charonwangg",
      "author_url": "",
      "post_date": "12/08/2021 04:50:10",
      "content": "<p>Maybe some augmentation you adopted brought new data which has not similar distribution as the training set/test set</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1613748,
      "author_name": "drzhuzhe",
      "author_url": "",
      "post_date": "12/10/2021 08:49:32",
      "content": "<p>I meet this problem too it seems no  flip rotate and crop all hurt performance ， I dont know why</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1613847,
      "author_name": "woprime",
      "author_url": "",
      "post_date": "12/10/2021 10:23:00",
      "content": "<p>I believe Broken Astro masks are the reason, since the top and bottom parts of some masks are broken in their own ways.<br>\nThat being said, I've not tested this, so don't quote me on this.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1614178,
      "author_name": "jychiou",
      "author_url": "",
      "post_date": "12/10/2021 18:02:11",
      "content": "<pre><code>[DatasetMapper] Augmentations used in training: \n[\nResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style='choice'), \nRandomFlip()\n]\n</code></pre>\n<p>augmentations of default trainer, maybe the ResizeShortestEdge is crucial </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1611460": "I used Detectron2 API to do instance segmentation.\nI tried to augment data like below.\n\n```python\nclass AugTrainer(DefaultTrainer):\n    @classmethod\n    def build_train_loader(cls, cfg):\n        return build_detection_train_loader(cfg, \n            mapper=DatasetMapper(cfg, is_train=True, augmentations=[\n                T.RandomBrightness(0.9, 1.1),\n                T.RandomContrast(0.9, 1.1),\n                T.RandomSaturation(0.9, 1.1),\n                T.RandomLighting(0.9),\n                T.RandomFlip(prob=0.5, horizontal=False, vertical=True),\n                T.RandomFlip(prob=0.5, horizontal=True, vertical=False),\n            ]))\n\n```\n\nIt threw no error but Map IoU decreased compared with training with no augmentation.\nCan anyone solve why?",
    "1611574": "Maybe some augmentation you adopted brought new data which has not similar distribution as the training set/test set",
    "1613748": "I meet this problem too it seems no  flip rotate and crop all hurt performance ， I dont know why",
    "1613847": "I believe Broken Astro masks are the reason, since the top and bottom parts of some masks are broken in their own ways.\nThat being said, I've not tested this, so don't quote me on this.",
    "1614178": "```\n [DatasetMapper] Augmentations used in training: \n[\nResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style='choice'), \nRandomFlip()\n]\n```\n\naugmentations of default trainer, maybe the ResizeShortestEdge is crucial"
  },
  "source": "meta"
}