{
  "id": 578566,
  "title": "vertical flips considered harmful",
  "url": "/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/578566",
  "author_name": "",
  "post_date": "2025-05-11T19:16:03.100843100Z",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I have been investigating augmenting the YOLO data, flipping the data horizontally or vertically., and training on the result.   I see a pretty consistent result: the horizontal flips seem to generate good models; but the vertical flips hurt model performance.</p>\n<p>Why?  Maybe there’s an anisotropy in the data (i.e. the data doesn’t differ, left-to-right; but does differ top-to-bottom (by top-to-bottom, I mean the y axis, not the z axis).  This seems a little unlikely to me, given how the samples were prepared given the discussion in  the <a href=\"https://www.kaggle.com/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/575769\" target=\"_blank\">Project preprint</a><br>\nBut perhaps  the yolo base models are trained with anisotropic data (i.e. data where reversing left-to-right sounds fine, and reversing up to down doesn’t make a lot of sense..)  Looking at the datasets in (<a href=\"https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format\" target=\"_blank\">https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format</a>, many of the datasets (e.g. <a href=\"https://docs.ultralytics.com/datasets/detect/african-wildlife/\" target=\"_blank\">African Wildlife</a>,  <a href=\"https://docs.ultralytics.com/datasets/detect/coco/#key-features\" target=\"_blank\">COCO</a>…) are camera views of natural scenes, (so there’s often a sky, or there are objects which wouldn’t normally be photographed upside down), or images which have a natural ‘vertical’: <a href=\"https://docs.ultralytics.com/datasets/detect/brain-tumor/#usage\" target=\"_blank\">brain-tumor</a>.</p>\n<ul>\n<li>(There are a few exceptions (I.e. databases, e.g <a href=\"https://docs.ultralytics.com/datasets/detect/xview/#sample-data-and-annotations\" target=\"_blank\">view</a>, [carparts-seg], (<a href=\"https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations)\" target=\"_blank\">https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations)</a>,<br>\n<a href=\"https://docs.ultralytics.com/datasets/segment/crack-seg/\" target=\"_blank\">crack-seg</a> where there is no natural vertical orientation.   Perhaps it would be helpful to pre-train with these datasets, or find more datasets that are isotropic, left-to-right and up-to-down.)</li>\n</ul>\n<p>To find this out, I implemented classes to flip yolo data and the labels.csv files.  It probably would have been easier to use ultralytics flip-left-right-fliplr, flip-up-down-flipud or albumentations.  Here’s my implementation: <a href=\"https://www.kaggle.com/code/francisganong/simple-yolo-augmentation\" target=\"_blank\">Simple Yolo Augmentation</a></p>",
  "messages": [
    {
      "id": "3199975",
      "postDate": "05/11/2025 19:16:03",
      "content": "<p>I have been investigating augmenting the YOLO data, flipping the data horizontally or vertically., and training on the result.   I see a pretty consistent result: the horizontal flips seem to generate good models; but the vertical flips hurt model performance.</p>\n<p>Why?  Maybe there’s an anisotropy in the data (i.e. the data doesn’t differ, left-to-right; but does differ top-to-bottom (by top-to-bottom, I mean the y axis, not the z axis).  This seems a little unlikely to me, given how the samples were prepared given the discussion in  the <a href=\"https://www.kaggle.com/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/575769\" target=\"_blank\">Project preprint</a><br>\nBut perhaps  the yolo base models are trained with anisotropic data (i.e. data where reversing left-to-right sounds fine, and reversing up to down doesn’t make a lot of sense..)  Looking at the datasets in (<a href=\"https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format\" target=\"_blank\">https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format</a>, many of the datasets (e.g. <a href=\"https://docs.ultralytics.com/datasets/detect/african-wildlife/\" target=\"_blank\">African Wildlife</a>,  <a href=\"https://docs.ultralytics.com/datasets/detect/coco/#key-features\" target=\"_blank\">COCO</a>…) are camera views of natural scenes, (so there’s often a sky, or there are objects which wouldn’t normally be photographed upside down), or images which have a natural ‘vertical’: <a href=\"https://docs.ultralytics.com/datasets/detect/brain-tumor/#usage\" target=\"_blank\">brain-tumor</a>.</p>\n<ul>\n<li>(There are a few exceptions (I.e. databases, e.g <a href=\"https://docs.ultralytics.com/datasets/detect/xview/#sample-data-and-annotations\" target=\"_blank\">view</a>, [carparts-seg], (<a href=\"https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations)\" target=\"_blank\">https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations)</a>,<br>\n<a href=\"https://docs.ultralytics.com/datasets/segment/crack-seg/\" target=\"_blank\">crack-seg</a> where there is no natural vertical orientation.   Perhaps it would be helpful to pre-train with these datasets, or find more datasets that are isotropic, left-to-right and up-to-down.)</li>\n</ul>\n<p>To find this out, I implemented classes to flip yolo data and the labels.csv files.  It probably would have been easier to use ultralytics flip-left-right-fliplr, flip-up-down-flipud or albumentations.  Here’s my implementation: <a href=\"https://www.kaggle.com/code/francisganong/simple-yolo-augmentation\" target=\"_blank\">Simple Yolo Augmentation</a></p>",
      "rawMarkdown": "I have been investigating augmenting the YOLO data, flipping the data horizontally or vertically., and training on the result.   I see a pretty consistent result: the horizontal flips seem to generate good models; but the vertical flips hurt model performance.\n\nWhy?  Maybe there’s an anisotropy in the data (i.e. the data doesn’t differ, left-to-right; but does differ top-to-bottom (by top-to-bottom, I mean the y axis, not the z axis).  This seems a little unlikely to me, given how the samples were prepared given the discussion in  the [Project preprint](https://www.kaggle.com/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/575769)\nBut perhaps  the yolo base models are trained with anisotropic data (i.e. data where reversing left-to-right sounds fine, and reversing up to down doesn’t make a lot of sense..)  Looking at the datasets in (https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format, many of the datasets (e.g. [African Wildlife](https://docs.ultralytics.com/datasets/detect/african-wildlife/),  [COCO](https://docs.ultralytics.com/datasets/detect/coco/#key-features)…) are camera views of natural scenes, (so there’s often a sky, or there are objects which wouldn’t normally be photographed upside down), or images which have a natural ‘vertical’: [brain-tumor](https://docs.ultralytics.com/datasets/detect/brain-tumor/#usage).\n\n- (There are a few exceptions (I.e. databases, e.g [view](https://docs.ultralytics.com/datasets/detect/xview/#sample-data-and-annotations), [carparts-seg], (https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations),\n[crack-seg] (https://docs.ultralytics.com/datasets/segment/crack-seg/) where there is no natural vertical orientation.   Perhaps it would be helpful to pre-train with these datasets, or find more datasets that are isotropic, left-to-right and up-to-down.)\n\n\nTo find this out, I implemented classes to flip yolo data and the labels.csv files.  It probably would have been easier to use ultralytics flip-left-right-fliplr, flip-up-down-flipud or albumentations.  Here’s my implementation: [Simple Yolo Augmentation] (https://www.kaggle.com/code/francisganong/simple-yolo-augmentation)",
      "votes": null
    },
    {
      "id": "3200128",
      "postDate": "05/12/2025 05:37:56",
      "content": "<p>This is very likely a fluke observation. There should be no reason why one type of a flip would work but not the other, unless the bounding box is calculated incorrectly for vertical flips.</p>",
      "rawMarkdown": "This is very likely a fluke observation. There should be no reason why one type of a flip would work but not the other, unless the bounding box is calculated incorrectly for vertical flips.",
      "votes": null
    },
    {
      "id": "3200485",
      "postDate": "05/12/2025 16:34:04",
      "content": "<p>I agree with him.</p>",
      "rawMarkdown": "I agree with him.",
      "votes": null
    },
    {
      "id": "3201207",
      "postDate": "05/13/2025 14:34:06",
      "content": "<p>I also thought the result was quite suprising.  I’ve looked at the code pretty carefully;  the handling of ‘vertical flip’ and horizontal flip are quite symmetric, so if you see anything in the code that explains the difference, I would appreciate it.</p>",
      "rawMarkdown": "I also thought the result was quite suprising.  I’ve looked at the code pretty carefully;  the handling of ‘vertical flip’ and horizontal flip are quite symmetric, so if you see anything in the code that explains the difference, I would appreciate it.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3200128,
      "author_name": "tilii7",
      "author_url": "",
      "post_date": "05/12/2025 05:37:56",
      "content": "<p>This is very likely a fluke observation. There should be no reason why one type of a flip would work but not the other, unless the bounding box is calculated incorrectly for vertical flips.</p>",
      "votes": null,
      "replies": [
        {
          "id": 3200485,
          "author_name": "junhanzangai",
          "author_url": "",
          "post_date": "05/12/2025 16:34:04",
          "content": "<p>I agree with him.</p>",
          "votes": null,
          "replies": [
            {
              "id": 3201207,
              "author_name": "francisganong",
              "author_url": "",
              "post_date": "05/13/2025 14:34:06",
              "content": "<p>I also thought the result was quite suprising.  I’ve looked at the code pretty carefully;  the handling of ‘vertical flip’ and horizontal flip are quite symmetric, so if you see anything in the code that explains the difference, I would appreciate it.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3199975": "I have been investigating augmenting the YOLO data, flipping the data horizontally or vertically., and training on the result.   I see a pretty consistent result: the horizontal flips seem to generate good models; but the vertical flips hurt model performance.\n\nWhy?  Maybe there’s an anisotropy in the data (i.e. the data doesn’t differ, left-to-right; but does differ top-to-bottom (by top-to-bottom, I mean the y axis, not the z axis).  This seems a little unlikely to me, given how the samples were prepared given the discussion in  the [Project preprint](https://www.kaggle.com/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/575769)\nBut perhaps  the yolo base models are trained with anisotropic data (i.e. data where reversing left-to-right sounds fine, and reversing up to down doesn’t make a lot of sense..)  Looking at the datasets in (https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format, many of the datasets (e.g. [African Wildlife](https://docs.ultralytics.com/datasets/detect/african-wildlife/),  [COCO](https://docs.ultralytics.com/datasets/detect/coco/#key-features)…) are camera views of natural scenes, (so there’s often a sky, or there are objects which wouldn’t normally be photographed upside down), or images which have a natural ‘vertical’: [brain-tumor](https://docs.ultralytics.com/datasets/detect/brain-tumor/#usage).\n\n- (There are a few exceptions (I.e. databases, e.g [view](https://docs.ultralytics.com/datasets/detect/xview/#sample-data-and-annotations), [carparts-seg], (https://docs.ultralytics.com/datasets/segment/carparts-seg/#sample-data-and-annotations),\n[crack-seg] (https://docs.ultralytics.com/datasets/segment/crack-seg/) where there is no natural vertical orientation.   Perhaps it would be helpful to pre-train with these datasets, or find more datasets that are isotropic, left-to-right and up-to-down.)\n\n\nTo find this out, I implemented classes to flip yolo data and the labels.csv files.  It probably would have been easier to use ultralytics flip-left-right-fliplr, flip-up-down-flipud or albumentations.  Here’s my implementation: [Simple Yolo Augmentation] (https://www.kaggle.com/code/francisganong/simple-yolo-augmentation)",
    "3200128": "This is very likely a fluke observation. There should be no reason why one type of a flip would work but not the other, unless the bounding box is calculated incorrectly for vertical flips.",
    "3200485": "I agree with him.",
    "3201207": "I also thought the result was quite suprising.  I’ve looked at the code pretty carefully;  the handling of ‘vertical flip’ and horizontal flip are quite symmetric, so if you see anything in the code that explains the difference, I would appreciate it."
  },
  "source": "meta"
}