{
  "id": 425834,
  "title": "What kind of TTA works for this competition?",
  "url": "/competitions/google-research-identify-contrails-reduce-global-warming/discussion/425834",
  "author_name": "william.wu",
  "post_date": "2023-07-20T15:57:12.641000",
  "votes": 14,
  "comment_count": 14,
  "views": 0,
  "content": "<p>All the TTA strategies that I know affect the position of the mask thus reducing the LB score😂</p>",
  "messages": [
    {
      "id": 2352076,
      "postDate": "2023-07-20T15:57:12.640Z",
      "content": "<p>All the TTA strategies that I know affect the position of the mask thus reducing the LB score😂</p>",
      "rawMarkdown": "All the TTA strategies that I know affect the position of the mask thus reducing the LB score😂",
      "votes": 13
    },
    {
      "id": 2356655,
      "postDate": "2023-07-24T10:00:56.077Z",
      "content": "<p>I train with flips + rotates and apply same TTA - and that improves LB a lot (0.670 to 0.683 LB for one single model)</p>",
      "rawMarkdown": "I train with flips + rotates and apply same TTA - and that improves LB a lot (0.670 to 0.683 LB for one single model)",
      "votes": 10,
      "replies": [
        {
          "id": 2357084,
          "postDate": "2023-07-24T14:37:01.943Z",
          "content": "<p>Thanks for sharing <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">@maksimovka</a> </p>",
          "rawMarkdown": "Thanks for sharing @maksimovka "
        }
      ]
    },
    {
      "id": 2356100,
      "postDate": "2023-07-23T22:07:52.573Z",
      "content": "<p>TTA has not worked for me so far with models that are trained on non-augmented data. It drops my CV by ~0.01.</p>\n<p>I tried taking the median of the 5 following augmentations (repeated no rotation 2x). </p>\n<ul>\n<li>no rotation</li>\n<li>no rotation</li>\n<li>90 rotation</li>\n<li>180 rotation</li>\n<li>270 rotation</li>\n</ul>",
      "rawMarkdown": "TTA has not worked for me so far with models that are trained on non-augmented data. It drops my CV by ~0.01.\n\nI tried taking the median of the 5 following augmentations (repeated no rotation 2x). \n- no rotation\n- no rotation\n- 90 rotation\n- 180 rotation\n- 270 rotation",
      "votes": 4
    },
    {
      "id": 2356058,
      "postDate": "2023-07-23T20:45:24.080Z",
      "content": "<p>Vertical and Horizontal flips, (90, 180, 270) rotations and transposes are more easy to apply as you only have to revert them on the predicted mask. You can also apply contrast, brightness and color changes as they don't affect the predicted mask's shape or orientation so they don't even require an inverse of them on the mask.</p>",
      "rawMarkdown": "Vertical and Horizontal flips, (90, 180, 270) rotations and transposes are more easy to apply as you only have to revert them on the predicted mask. You can also apply contrast, brightness and color changes as they don't affect the predicted mask's shape or orientation so they don't even require an inverse of them on the mask.",
      "votes": 2
    },
    {
      "id": 2356054,
      "postDate": "2023-07-23T20:37:31.840Z",
      "content": "<p>What do you mean by \"affect the position of the mask\" ? </p>",
      "rawMarkdown": "What do you mean by \"affect the position of the mask\" ? ",
      "votes": 2,
      "replies": [
        {
          "id": 2356158,
          "postDate": "2023-07-24T00:54:18.257Z",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/janmpia\" target=\"_blank\">@janmpia</a> , my thought was that if we apply the tta to the image such as 90 rotation then the predicted mask will also be rotated for 90°. We cannot simply average the prediction on the raw with the predictions on these augmented images. As <a href=\"https://www.kaggle.com/edomingo\" target=\"_blank\">@edomingo</a> pointed out, I can apply deaugmentation on the predictions. Thanks all, let me try:)</p>",
          "rawMarkdown": "Hi @janmpia , my thought was that if we apply the tta to the image such as 90 rotation then the predicted mask will also be rotated for 90°. We cannot simply average the prediction on the raw with the predictions on these augmented images. As @edomingo pointed out, I can apply deaugmentation on the predictions. Thanks all, let me try:)",
          "votes": 1
        }
      ]
    },
    {
      "id": 2355248,
      "postDate": "2023-07-23T08:01:28.303Z",
      "content": "<p>I used TTA to submit the result, the LB score is zero, why?</p>",
      "rawMarkdown": "I used TTA to submit the result, the LB score is zero, why?",
      "replies": [
        {
          "id": 2356051,
          "postDate": "2023-07-23T20:36:34.227Z",
          "content": "<p>You probably implemented it the wrong way, <br>\nit shouldn't give the best score but a least not a 0 if you model is training correctely, I suggest you troubleshoot it but in any case TTA didn't work for me either (didn't give 0 tho)</p>",
          "rawMarkdown": "You probably implemented it the wrong way, \nit shouldn't give the best score but a least not a 0 if you model is training correctely, I suggest you troubleshoot it but in any case TTA didn't work for me either (didn't give 0 tho)",
          "replies": [
            {
              "id": 2356162,
              "postDate": "2023-07-24T01:20:07.230Z",
              "content": "<p>I tried deleting the memory space for TTA's output in time, and now it works, I think it may be a memory overflow problem. TTA works for me, making LB go from 0.681-&gt;0.685.</p>",
              "rawMarkdown": "I tried deleting the memory space for TTA's output in time, and now it works, I think it may be a memory overflow problem. TTA works for me, making LB go from 0.681->0.685.",
              "votes": 1
            }
          ]
        },
        {
          "id": 2356057,
          "postDate": "2023-07-23T20:41:02.827Z",
          "content": "<p>TTA is more difficult to apply correctly than DA, for TTA you should use transformations that are easy to revert if they are changing the shape or orientation of the image, as you then have to apply the inverse of them (in the proper order) to the resultant mask. And you have to do it multiple times with different transformations for every test sample and then merge all of them also in a proper way having only a single resultant mask with values at 0 or 1. So try to check step by step with some examples and plots that every step is correct :).</p>",
          "rawMarkdown": "TTA is more difficult to apply correctly than DA, for TTA you should use transformations that are easy to revert if they are changing the shape or orientation of the image, as you then have to apply the inverse of them (in the proper order) to the resultant mask. And you have to do it multiple times with different transformations for every test sample and then merge all of them also in a proper way having only a single resultant mask with values at 0 or 1. So try to check step by step with some examples and plots that every step is correct :).",
          "votes": 1,
          "replies": [
            {
              "id": 2356163,
              "postDate": "2023-07-24T01:24:46.803Z",
              "content": "<p>Thanks for your explanation, now it is work for me, but only used rotate 180 in my test.</p>",
              "rawMarkdown": "Thanks for your explanation, now it is work for me, but only used rotate 180 in my test.",
              "votes": 1
            },
            {
              "id": 2356183,
              "postDate": "2023-07-24T02:15:50.243Z",
              "content": "<p>Thanks for sharing, you improve LB from 0.681 -&gt; 0.685 by adding 180 rotation! That's impressive</p>",
              "rawMarkdown": "Thanks for sharing, you improve LB from 0.681 -> 0.685 by adding 180 rotation! That's impressive"
            },
            {
              "id": 2356299,
              "postDate": "2023-07-24T05:00:20.423Z",
              "content": "<p>guess just a 3 step raw, HF and VF should be fine to average ? or contrast but saw contrast or CLAHE not working that well :| </p>",
              "rawMarkdown": "guess just a 3 step raw, HF and VF should be fine to average ? or contrast but saw contrast or CLAHE not working that well :| "
            },
            {
              "id": 2356415,
              "postDate": "2023-07-24T07:29:39.907Z",
              "content": "<p>rotate180 doesn't work for me, but hflip works for CV. CV 0.657 -&gt; 0.660, but LB 676 -&gt; 0.669</p>",
              "rawMarkdown": "rotate180 doesn't work for me, but hflip works for CV. CV 0.657 -> 0.660, but LB 676 -> 0.669"
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2356655,
      "author_name": "Kostiantyn Maksymov",
      "author_url": "",
      "post_date": "2023-07-24T10:00:56.077000",
      "content": "<p>I train with flips + rotates and apply same TTA - and that improves LB a lot (0.670 to 0.683 LB for one single model)</p>",
      "votes": 10,
      "replies": [
        {
          "id": 2357084,
          "author_name": "william.wu",
          "author_url": "",
          "post_date": "2023-07-24T14:37:01.943000",
          "content": "<p>Thanks for sharing <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">@maksimovka</a> </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2356100,
      "author_name": "Bartley",
      "author_url": "",
      "post_date": "2023-07-23T22:07:52.573000",
      "content": "<p>TTA has not worked for me so far with models that are trained on non-augmented data. It drops my CV by ~0.01.</p>\n<p>I tried taking the median of the 5 following augmentations (repeated no rotation 2x). </p>\n<ul>\n<li>no rotation</li>\n<li>no rotation</li>\n<li>90 rotation</li>\n<li>180 rotation</li>\n<li>270 rotation</li>\n</ul>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 2356058,
      "author_name": "Enric Domingo",
      "author_url": "",
      "post_date": "2023-07-23T20:45:24.080000",
      "content": "<p>Vertical and Horizontal flips, (90, 180, 270) rotations and transposes are more easy to apply as you only have to revert them on the predicted mask. You can also apply contrast, brightness and color changes as they don't affect the predicted mask's shape or orientation so they don't even require an inverse of them on the mask.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 2356054,
      "author_name": "JEANMPIA",
      "author_url": "",
      "post_date": "2023-07-23T20:37:31.840000",
      "content": "<p>What do you mean by \"affect the position of the mask\" ? </p>",
      "votes": 2,
      "replies": [
        {
          "id": 2356158,
          "author_name": "william.wu",
          "author_url": "",
          "post_date": "2023-07-24T00:54:18.257000",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/janmpia\" target=\"_blank\">@janmpia</a> , my thought was that if we apply the tta to the image such as 90 rotation then the predicted mask will also be rotated for 90°. We cannot simply average the prediction on the raw with the predictions on these augmented images. As <a href=\"https://www.kaggle.com/edomingo\" target=\"_blank\">@edomingo</a> pointed out, I can apply deaugmentation on the predictions. Thanks all, let me try:)</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2355248,
      "author_name": "mss_Lee",
      "author_url": "",
      "post_date": "2023-07-23T08:01:28.303000",
      "content": "<p>I used TTA to submit the result, the LB score is zero, why?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2356051,
          "author_name": "JEANMPIA",
          "author_url": "",
          "post_date": "2023-07-23T20:36:34.227000",
          "content": "<p>You probably implemented it the wrong way, <br>\nit shouldn't give the best score but a least not a 0 if you model is training correctely, I suggest you troubleshoot it but in any case TTA didn't work for me either (didn't give 0 tho)</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2356162,
              "author_name": "mss_Lee",
              "author_url": "",
              "post_date": "2023-07-24T01:20:07.230000",
              "content": "<p>I tried deleting the memory space for TTA's output in time, and now it works, I think it may be a memory overflow problem. TTA works for me, making LB go from 0.681-&gt;0.685.</p>",
              "votes": 1,
              "replies": []
            }
          ]
        },
        {
          "id": 2356057,
          "author_name": "Enric Domingo",
          "author_url": "",
          "post_date": "2023-07-23T20:41:02.827000",
          "content": "<p>TTA is more difficult to apply correctly than DA, for TTA you should use transformations that are easy to revert if they are changing the shape or orientation of the image, as you then have to apply the inverse of them (in the proper order) to the resultant mask. And you have to do it multiple times with different transformations for every test sample and then merge all of them also in a proper way having only a single resultant mask with values at 0 or 1. So try to check step by step with some examples and plots that every step is correct :).</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2356163,
              "author_name": "mss_Lee",
              "author_url": "",
              "post_date": "2023-07-24T01:24:46.803000",
              "content": "<p>Thanks for your explanation, now it is work for me, but only used rotate 180 in my test.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2356183,
              "author_name": "william.wu",
              "author_url": "",
              "post_date": "2023-07-24T02:15:50.243000",
              "content": "<p>Thanks for sharing, you improve LB from 0.681 -&gt; 0.685 by adding 180 rotation! That's impressive</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2356299,
              "author_name": "Gaurav Rawat",
              "author_url": "",
              "post_date": "2023-07-24T05:00:20.423000",
              "content": "<p>guess just a 3 step raw, HF and VF should be fine to average ? or contrast but saw contrast or CLAHE not working that well :| </p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2356415,
              "author_name": "william.wu",
              "author_url": "",
              "post_date": "2023-07-24T07:29:39.907000",
              "content": "<p>rotate180 doesn't work for me, but hflip works for CV. CV 0.657 -&gt; 0.660, but LB 676 -&gt; 0.669</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2352076": "All the TTA strategies that I know affect the position of the mask thus reducing the LB score😂",
    "2356655": "I train with flips + rotates and apply same TTA - and that improves LB a lot (0.670 to 0.683 LB for one single model)",
    "2356100": "TTA has not worked for me so far with models that are trained on non-augmented data. It drops my CV by ~0.01.\n\nI tried taking the median of the 5 following augmentations (repeated no rotation 2x). \n- no rotation\n- no rotation\n- 90 rotation\n- 180 rotation\n- 270 rotation",
    "2356058": "Vertical and Horizontal flips, (90, 180, 270) rotations and transposes are more easy to apply as you only have to revert them on the predicted mask. You can also apply contrast, brightness and color changes as they don't affect the predicted mask's shape or orientation so they don't even require an inverse of them on the mask.",
    "2356054": "What do you mean by \"affect the position of the mask\" ? ",
    "2355248": "I used TTA to submit the result, the LB score is zero, why?"
  }
}