{
  "id": 240088,
  "title": "Uncommon topic: Best single model (for rotations)",
  "url": "/competitions/bms-molecular-translation/discussion/240088",
  "author_name": "",
  "post_date": "2021-05-18T14:27:32.750278800Z",
  "votes": 5,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Today I quickly threw together a rotation detector training script using 300x300 images and <code>timm</code>'s <code>efficientnet_b3</code>. I randomly rotate images into one of 4 possible orientations (equal probability) and try to detect it. I use vanilla cross entropy loss.</p>\n<p>It's currently about 50% through the first epoch and plateauing out at about 97% validation accuracy. From a cursory glance at 200 test images I get the feeling that (after h &gt; w correction) less than 1% of them are rotated. So my detector is probably more trouble than it's worth.</p>\n<p>Before I go down this rabbit hole, wondering if anyone else has tried this yet.</p>\n<p><strong>EDIT</strong></p>\n<p>On inspecting images with aspect ratio 1 (tip off from <a href=\"https://www.kaggle.com/nofreewill\" target=\"_blank\">@nofreewill</a> on some other discussion topic) , I found 42/100 rotated. Might be worth applying a rotation detector after all.</p>",
  "messages": [
    {
      "id": "1313376",
      "postDate": "05/18/2021 14:27:32",
      "content": "<p>Today I quickly threw together a rotation detector training script using 300x300 images and <code>timm</code>'s <code>efficientnet_b3</code>. I randomly rotate images into one of 4 possible orientations (equal probability) and try to detect it. I use vanilla cross entropy loss.</p>\n<p>It's currently about 50% through the first epoch and plateauing out at about 97% validation accuracy. From a cursory glance at 200 test images I get the feeling that (after h &gt; w correction) less than 1% of them are rotated. So my detector is probably more trouble than it's worth.</p>\n<p>Before I go down this rabbit hole, wondering if anyone else has tried this yet.</p>\n<p><strong>EDIT</strong></p>\n<p>On inspecting images with aspect ratio 1 (tip off from <a href=\"https://www.kaggle.com/nofreewill\" target=\"_blank\">@nofreewill</a> on some other discussion topic) , I found 42/100 rotated. Might be worth applying a rotation detector after all.</p>",
      "rawMarkdown": "Today I quickly threw together a rotation detector training script using 300x300 images and `timm`'s `efficientnet_b3`. I randomly rotate images into one of 4 possible orientations (equal probability) and try to detect it. I use vanilla cross entropy loss.\n\nIt's currently about 50% through the first epoch and plateauing out at about 97% validation accuracy. From a cursory glance at 200 test images I get the feeling that (after h > w correction) less than 1% of them are rotated. So my detector is probably more trouble than it's worth.\n\nBefore I go down this rabbit hole, wondering if anyone else has tried this yet.\n\n**EDIT**\n\nOn inspecting images with aspect ratio 1 (tip off from @nofreewill on some other discussion topic) , I found 42/100 rotated. Might be worth applying a rotation detector after all.",
      "votes": null
    },
    {
      "id": "1313478",
      "postDate": "05/18/2021 15:22:03",
      "content": "<p>Just wanted to point out: <br>\nSome of the train images which have same side lengths (e.g. 192x192) are rotated. So you should exclude them in the rotation training data. Not sure about others though. Maybe somebody else knows more.<br>\nThere are no training images which have higher height then width, so no point using this as initial way to check for rotation.</p>\n<p>Maybe some part of your missing 3% is due to those molecules that are <a href=\"https://www.kaggle.com/c/bms-molecular-translation/discussion/231190#1304058\" target=\"_blank\">symmetrical</a>. As you check for all possible rotations that makes it impossible to classify correctly in some instances - as the molecules look correct.</p>",
      "rawMarkdown": "Just wanted to point out: \nSome of the train images which have same side lengths (e.g. 192x192) are rotated. So you should exclude them in the rotation training data. Not sure about others though. Maybe somebody else knows more.\nThere are no training images which have higher height then width, so no point using this as initial way to check for rotation.\n\nMaybe some part of your missing 3% is due to those molecules that are [symmetrical](https://www.kaggle.com/c/bms-molecular-translation/discussion/231190#1304058). As you check for all possible rotations that makes it impossible to classify correctly in some instances - as the molecules look correct.",
      "votes": null
    },
    {
      "id": "1313511",
      "postDate": "05/18/2021 15:37:02",
      "content": "<p>Ah very good point, and if the letters of the main atoms have some degree of rotational symmetry it might be impossible to disambiguate.</p>",
      "rawMarkdown": "Ah very good point, and if the letters of the main atoms have some degree of rotational symmetry it might be impossible to disambiguate.",
      "votes": null
    },
    {
      "id": "1313523",
      "postDate": "05/18/2021 15:41:18",
      "content": "<p>I'm going on a different route, but when I tried it, my model went up a little above 98% after some epochs.<br>\nNote that in training data, we only have images rotated clockwise. It seems to me that only if width and height are about the same.<br>\nSo one could focus purely on those images. If not at training time, but at test time I would suggest.</p>\n<p>I made an embarrassingly simple CNN to do my experiments, with a minimal area of view that is enough to cover about x2 the area of the letters, and maxpooling the last layer's output.</p>",
      "rawMarkdown": "I'm going on a different route, but when I tried it, my model went up a little above 98% after some epochs.\nNote that in training data, we only have images rotated clockwise. It seems to me that only if width and height are about the same.\nSo one could focus purely on those images. If not at training time, but at test time I would suggest.\n\nI made an embarrassingly simple CNN to do my experiments, with a minimal area of view that is enough to cover about x2 the area of the letters, and maxpooling the last layer's output.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1313478,
      "author_name": "cepheidq",
      "author_url": "",
      "post_date": "05/18/2021 15:22:03",
      "content": "<p>Just wanted to point out: <br>\nSome of the train images which have same side lengths (e.g. 192x192) are rotated. So you should exclude them in the rotation training data. Not sure about others though. Maybe somebody else knows more.<br>\nThere are no training images which have higher height then width, so no point using this as initial way to check for rotation.</p>\n<p>Maybe some part of your missing 3% is due to those molecules that are <a href=\"https://www.kaggle.com/c/bms-molecular-translation/discussion/231190#1304058\" target=\"_blank\">symmetrical</a>. As you check for all possible rotations that makes it impossible to classify correctly in some instances - as the molecules look correct.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1313511,
          "author_name": "alexandersoare",
          "author_url": "",
          "post_date": "05/18/2021 15:37:02",
          "content": "<p>Ah very good point, and if the letters of the main atoms have some degree of rotational symmetry it might be impossible to disambiguate.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1313523,
      "author_name": "nofreewill",
      "author_url": "",
      "post_date": "05/18/2021 15:41:18",
      "content": "<p>I'm going on a different route, but when I tried it, my model went up a little above 98% after some epochs.<br>\nNote that in training data, we only have images rotated clockwise. It seems to me that only if width and height are about the same.<br>\nSo one could focus purely on those images. If not at training time, but at test time I would suggest.</p>\n<p>I made an embarrassingly simple CNN to do my experiments, with a minimal area of view that is enough to cover about x2 the area of the letters, and maxpooling the last layer's output.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1313376": "Today I quickly threw together a rotation detector training script using 300x300 images and `timm`'s `efficientnet_b3`. I randomly rotate images into one of 4 possible orientations (equal probability) and try to detect it. I use vanilla cross entropy loss.\n\nIt's currently about 50% through the first epoch and plateauing out at about 97% validation accuracy. From a cursory glance at 200 test images I get the feeling that (after h > w correction) less than 1% of them are rotated. So my detector is probably more trouble than it's worth.\n\nBefore I go down this rabbit hole, wondering if anyone else has tried this yet.\n\n**EDIT**\n\nOn inspecting images with aspect ratio 1 (tip off from @nofreewill on some other discussion topic) , I found 42/100 rotated. Might be worth applying a rotation detector after all.",
    "1313478": "Just wanted to point out: \nSome of the train images which have same side lengths (e.g. 192x192) are rotated. So you should exclude them in the rotation training data. Not sure about others though. Maybe somebody else knows more.\nThere are no training images which have higher height then width, so no point using this as initial way to check for rotation.\n\nMaybe some part of your missing 3% is due to those molecules that are [symmetrical](https://www.kaggle.com/c/bms-molecular-translation/discussion/231190#1304058). As you check for all possible rotations that makes it impossible to classify correctly in some instances - as the molecules look correct.",
    "1313511": "Ah very good point, and if the letters of the main atoms have some degree of rotational symmetry it might be impossible to disambiguate.",
    "1313523": "I'm going on a different route, but when I tried it, my model went up a little above 98% after some epochs.\nNote that in training data, we only have images rotated clockwise. It seems to me that only if width and height are about the same.\nSo one could focus purely on those images. If not at training time, but at test time I would suggest.\n\nI made an embarrassingly simple CNN to do my experiments, with a minimal area of view that is enough to cover about x2 the area of the letters, and maxpooling the last layer's output."
  },
  "source": "meta"
}