{
  "id": 220614,
  "title": "[TTA] Single Model Inference - Public lb 0.905",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/220614",
  "author_name": "Heroseo",
  "post_date": "2021-02-19T01:16:02.189000",
  "votes": 14,
  "comment_count": 12,
  "views": 0,
  "content": "<h1>Intro</h1>\n<p>I would like to share a model that achieved 0.905 in public lb in the end of the competition.<br>\nThis model really overfits the public lb.<br>\n(If I have the opportunity to write a detailed review of the competition later…)</p>\n<h1>TTA - RandomCrop</h1>\n<p>I used randomCrop for TTA.<br>\nCompared to private lb, there was an increase in both public lb and private lb.<br>\nThis method was also effective for vision transformers such as DeiT.<br>\nIt worked for most of my models.<br>\n(This method also gave a specific model a boosting +0.007 in public lb.)</p>\n<pre><code>AL.Compose([\n    AL.RandomCrop(CFG.crop_448, CFG.crop_448, p=0.5),\n    AL.Resize(CFG.size_512, CFG.size_512),\n    AL.Normalize(\n        mean=[0.485, 0.456, 0.406],\n        std=[0.229, 0.224, 0.225],\n    ),\n    ToTensorV2(),\n])\n</code></pre>\n<p>I have 2 models that got 0.905 in public lb</p>\n<ul>\n<li>The model1  got <code>0.902(NO TTA)</code> / <code>0.905(TTA)</code> in public lb.</li>\n<li>The model2  got <code>0.901(NO TTA)</code> / <code>0.905(TTA)</code> in public lb.</li>\n</ul>\n<p>And I shared a notebook with TTA that uses my datasets.</p>\n<ul>\n<li>Cassava Single Model public lb0.905</li>\n</ul>\n<p><a href=\"https://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601\" target=\"_blank\">https://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601</a></p>\n<p>p.s. I don't know the exact reason, but the score falls by 0.905 to 0.904. However, I think that 0.904 in public lb is enough to share the method so I share a my notebook.</p>\n<h1>End</h1>\n<p>For now, I share this shortly. Thank you for organizing a fun competition and I hope you all have good results.</p>\n<p>Thank you!</p>",
  "messages": [
    {
      "id": 1209619,
      "postDate": "2021-02-19T01:16:02.190Z",
      "content": "<h1>Intro</h1>\n<p>I would like to share a model that achieved 0.905 in public lb in the end of the competition.<br>\nThis model really overfits the public lb.<br>\n(If I have the opportunity to write a detailed review of the competition later…)</p>\n<h1>TTA - RandomCrop</h1>\n<p>I used randomCrop for TTA.<br>\nCompared to private lb, there was an increase in both public lb and private lb.<br>\nThis method was also effective for vision transformers such as DeiT.<br>\nIt worked for most of my models.<br>\n(This method also gave a specific model a boosting +0.007 in public lb.)</p>\n<pre><code>AL.Compose([\n    AL.RandomCrop(CFG.crop_448, CFG.crop_448, p=0.5),\n    AL.Resize(CFG.size_512, CFG.size_512),\n    AL.Normalize(\n        mean=[0.485, 0.456, 0.406],\n        std=[0.229, 0.224, 0.225],\n    ),\n    ToTensorV2(),\n])\n</code></pre>\n<p>I have 2 models that got 0.905 in public lb</p>\n<ul>\n<li>The model1  got <code>0.902(NO TTA)</code> / <code>0.905(TTA)</code> in public lb.</li>\n<li>The model2  got <code>0.901(NO TTA)</code> / <code>0.905(TTA)</code> in public lb.</li>\n</ul>\n<p>And I shared a notebook with TTA that uses my datasets.</p>\n<ul>\n<li>Cassava Single Model public lb0.905</li>\n</ul>\n<p><a href=\"https://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601\" target=\"_blank\">https://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601</a></p>\n<p>p.s. I don't know the exact reason, but the score falls by 0.905 to 0.904. However, I think that 0.904 in public lb is enough to share the method so I share a my notebook.</p>\n<h1>End</h1>\n<p>For now, I share this shortly. Thank you for organizing a fun competition and I hope you all have good results.</p>\n<p>Thank you!</p>",
      "rawMarkdown": "# Intro\nI would like to share a model that achieved 0.905 in public lb in the end of the competition.\nThis model really overfits the public lb.\n(If I have the opportunity to write a detailed review of the competition later...)\n\n# TTA - RandomCrop\nI used randomCrop for TTA.\nCompared to private lb, there was an increase in both public lb and private lb.\nThis method was also effective for vision transformers such as DeiT.\nIt worked for most of my models.\n(This method also gave a specific model a boosting +0.007 in public lb.)\n\n```\nAL.Compose([\n    AL.RandomCrop(CFG.crop_448, CFG.crop_448, p=0.5),\n    AL.Resize(CFG.size_512, CFG.size_512),\n    AL.Normalize(\n        mean=[0.485, 0.456, 0.406],\n        std=[0.229, 0.224, 0.225],\n    ),\n    ToTensorV2(),\n])\n```\n\nI have 2 models that got 0.905 in public lb\n- The model1  got `0.902(NO TTA)` / `0.905(TTA)` in public lb.\n- The model2  got `0.901(NO TTA)` / `0.905(TTA)` in public lb.\n\nAnd I shared a notebook with TTA that uses my datasets.\n- Cassava Single Model public lb0.905\n\nhttps://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601\n\np.s. I don't know the exact reason, but the score falls by 0.905 to 0.904. However, I think that 0.904 in public lb is enough to share the method so I share a my notebook.\n\n\n# End\nFor now, I share this shortly. Thank you for organizing a fun competition and I hope you all have good results.\n\nThank you!",
      "votes": 14
    },
    {
      "id": 1209649,
      "postDate": "2021-02-19T01:52:37.050Z",
      "content": "<p>Thank you !</p>",
      "rawMarkdown": "Thank you !",
      "votes": 1,
      "replies": [
        {
          "id": 1209700,
          "postDate": "2021-02-19T02:35:02.413Z",
          "content": "<p>welcome! <a href=\"https://www.kaggle.com/hungkhoi\" target=\"_blank\">@hungkhoi</a> </p>",
          "rawMarkdown": "welcome! @hungkhoi ",
          "votes": 1
        }
      ]
    },
    {
      "id": 1209632,
      "postDate": "2021-02-19T01:28:15.757Z",
      "content": "<p>Thanks for sharing. May I ask any reasons why you use randomcrop of 448 and then resize to 512? This way you enlarge image from 448 to 512.</p>\n<p>Shouldn’t you resize to 512 and random crop to smaller area? I guess because you randomcrop at probability of 0.5?</p>",
      "rawMarkdown": "Thanks for sharing. May I ask any reasons why you use randomcrop of 448 and then resize to 512? This way you enlarge image from 448 to 512.\n\nShouldn’t you resize to 512 and random crop to smaller area? I guess because you randomcrop at probability of 0.5?\n\n",
      "votes": 1,
      "replies": [
        {
          "id": 1209639,
          "postDate": "2021-02-19T01:33:33.813Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 1209698,
          "postDate": "2021-02-19T02:34:24.977Z",
          "content": "<p>This is an try and errors result. <a href=\"https://www.kaggle.com/tom88jerry\" target=\"_blank\">@tom88jerry</a>. </p>",
          "rawMarkdown": "This is an try and errors result. @tom88jerry. "
        },
        {
          "id": 1210006,
          "postDate": "2021-02-19T06:45:30.130Z",
          "content": "<p>Thank you for you answer 😀</p>",
          "rawMarkdown": "Thank you for you answer 😀",
          "votes": 1
        },
        {
          "id": 1210896,
          "postDate": "2021-02-19T19:45:32.673Z",
          "content": "<p>I used a similar TTA (center crop 384x384 -&gt; resize 512x512) that helped for both EffNet and especially DeiT. My idea was to zoom/close-up objects on image, that's why I did crop-&gt;resize instead of just crop or resize-&gt;crop.<br>\nHere is my solution: <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/220788\" target=\"_blank\">https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/220788</a></p>",
          "rawMarkdown": "I used a similar TTA (center crop 384x384 -> resize 512x512) that helped for both EffNet and especially DeiT. My idea was to zoom/close-up objects on image, that's why I did crop->resize instead of just crop or resize->crop.\nHere is my solution: https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/220788",
          "votes": 1
        },
        {
          "id": 1210902,
          "postDate": "2021-02-19T19:49:57.707Z",
          "content": "<p><a href=\"https://www.kaggle.com/sparakhin\" target=\"_blank\">@sparakhin</a> Thank you for the answer and congrats for your gold :)</p>",
          "rawMarkdown": "@sparakhin Thank you for the answer and congrats for your gold :)"
        }
      ]
    },
    {
      "id": 1209628,
      "postDate": "2021-02-19T01:26:26.747Z",
      "content": "<p>Thank you for sharing! Been a wild journey following your notebooks! Couldn't be done without your help. Thank you for helping out the community and making people new to kaggle(like me) a great experience!</p>",
      "rawMarkdown": "Thank you for sharing! Been a wild journey following your notebooks! Couldn't be done without your help. Thank you for helping out the community and making people new to kaggle(like me) a great experience!",
      "votes": 1,
      "replies": [
        {
          "id": 1209635,
          "postDate": "2021-02-19T01:30:45.540Z",
          "content": "<p>I agree. Many good notebooks from <a href=\"https://www.kaggle.com/piantic\" target=\"_blank\">@piantic</a>. </p>",
          "rawMarkdown": "I agree. Many good notebooks from @piantic. ",
          "votes": 1
        },
        {
          "id": 1209694,
          "postDate": "2021-02-19T02:33:36.160Z",
          "content": "<p>Thank you! <a href=\"https://www.kaggle.com/andyjianzhou\" target=\"_blank\">@andyjianzhou</a>  <a href=\"https://www.kaggle.com/tom88jerry\" target=\"_blank\">@tom88jerry</a> </p>",
          "rawMarkdown": "Thank you! @andyjianzhou  @tom88jerry ",
          "votes": 1
        },
        {
          "id": 1210886,
          "postDate": "2021-02-19T19:41:18.923Z",
          "content": "<p>+1<br>\nthank you <a href=\"https://www.kaggle.com/piantic\" target=\"_blank\">@piantic</a> for your notebooks!</p>",
          "rawMarkdown": "+1\nthank you @piantic for your notebooks!",
          "votes": 1
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1209649,
      "author_name": "HungNT",
      "author_url": "",
      "post_date": "2021-02-19T01:52:37.050000",
      "content": "<p>Thank you !</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1209700,
          "author_name": "Heroseo",
          "author_url": "",
          "post_date": "2021-02-19T02:35:02.413000",
          "content": "<p>welcome! <a href=\"https://www.kaggle.com/hungkhoi\" target=\"_blank\">@hungkhoi</a> </p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1209632,
      "author_name": "SHih Chieh Lai",
      "author_url": "",
      "post_date": "2021-02-19T01:28:15.757000",
      "content": "<p>Thanks for sharing. May I ask any reasons why you use randomcrop of 448 and then resize to 512? This way you enlarge image from 448 to 512.</p>\n<p>Shouldn’t you resize to 512 and random crop to smaller area? I guess because you randomcrop at probability of 0.5?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1209639,
          "author_name": "",
          "author_url": "",
          "post_date": "2021-02-19T01:33:33.813000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1209698,
          "author_name": "Heroseo",
          "author_url": "",
          "post_date": "2021-02-19T02:34:24.977000",
          "content": "<p>This is an try and errors result. <a href=\"https://www.kaggle.com/tom88jerry\" target=\"_blank\">@tom88jerry</a>. </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1210006,
          "author_name": "SHih Chieh Lai",
          "author_url": "",
          "post_date": "2021-02-19T06:45:30.130000",
          "content": "<p>Thank you for you answer 😀</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1210896,
          "author_name": "Serhii Parakhin",
          "author_url": "",
          "post_date": "2021-02-19T19:45:32.673000",
          "content": "<p>I used a similar TTA (center crop 384x384 -&gt; resize 512x512) that helped for both EffNet and especially DeiT. My idea was to zoom/close-up objects on image, that's why I did crop-&gt;resize instead of just crop or resize-&gt;crop.<br>\nHere is my solution: <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/220788\" target=\"_blank\">https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/220788</a></p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1210902,
          "author_name": "SHih Chieh Lai",
          "author_url": "",
          "post_date": "2021-02-19T19:49:57.707000",
          "content": "<p><a href=\"https://www.kaggle.com/sparakhin\" target=\"_blank\">@sparakhin</a> Thank you for the answer and congrats for your gold :)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1209628,
      "author_name": "Andy Jian Zhou",
      "author_url": "",
      "post_date": "2021-02-19T01:26:26.747000",
      "content": "<p>Thank you for sharing! Been a wild journey following your notebooks! Couldn't be done without your help. Thank you for helping out the community and making people new to kaggle(like me) a great experience!</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1209635,
          "author_name": "SHih Chieh Lai",
          "author_url": "",
          "post_date": "2021-02-19T01:30:45.540000",
          "content": "<p>I agree. Many good notebooks from <a href=\"https://www.kaggle.com/piantic\" target=\"_blank\">@piantic</a>. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1209694,
          "author_name": "Heroseo",
          "author_url": "",
          "post_date": "2021-02-19T02:33:36.160000",
          "content": "<p>Thank you! <a href=\"https://www.kaggle.com/andyjianzhou\" target=\"_blank\">@andyjianzhou</a>  <a href=\"https://www.kaggle.com/tom88jerry\" target=\"_blank\">@tom88jerry</a> </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1210886,
          "author_name": "Serhii Parakhin",
          "author_url": "",
          "post_date": "2021-02-19T19:41:18.923000",
          "content": "<p>+1<br>\nthank you <a href=\"https://www.kaggle.com/piantic\" target=\"_blank\">@piantic</a> for your notebooks!</p>",
          "votes": 1,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1209619": "# Intro\nI would like to share a model that achieved 0.905 in public lb in the end of the competition.\nThis model really overfits the public lb.\n(If I have the opportunity to write a detailed review of the competition later...)\n\n# TTA - RandomCrop\nI used randomCrop for TTA.\nCompared to private lb, there was an increase in both public lb and private lb.\nThis method was also effective for vision transformers such as DeiT.\nIt worked for most of my models.\n(This method also gave a specific model a boosting +0.007 in public lb.)\n\n```\nAL.Compose([\n    AL.RandomCrop(CFG.crop_448, CFG.crop_448, p=0.5),\n    AL.Resize(CFG.size_512, CFG.size_512),\n    AL.Normalize(\n        mean=[0.485, 0.456, 0.406],\n        std=[0.229, 0.224, 0.225],\n    ),\n    ToTensorV2(),\n])\n```\n\nI have 2 models that got 0.905 in public lb\n- The model1  got `0.902(NO TTA)` / `0.905(TTA)` in public lb.\n- The model2  got `0.901(NO TTA)` / `0.905(TTA)` in public lb.\n\nAnd I shared a notebook with TTA that uses my datasets.\n- Cassava Single Model public lb0.905\n\nhttps://www.kaggle.com/piantic/cassava-single-model-public-lb-0-905?scriptVersionId=54709601\n\np.s. I don't know the exact reason, but the score falls by 0.905 to 0.904. However, I think that 0.904 in public lb is enough to share the method so I share a my notebook.\n\n\n# End\nFor now, I share this shortly. Thank you for organizing a fun competition and I hope you all have good results.\n\nThank you!",
    "1209649": "Thank you !",
    "1209632": "Thanks for sharing. May I ask any reasons why you use randomcrop of 448 and then resize to 512? This way you enlarge image from 448 to 512.\n\nShouldn’t you resize to 512 and random crop to smaller area? I guess because you randomcrop at probability of 0.5?\n\n",
    "1209628": "Thank you for sharing! Been a wild journey following your notebooks! Couldn't be done without your help. Thank you for helping out the community and making people new to kaggle(like me) a great experience!"
  }
}