{
  "id": 242454,
  "title": "3rd place solution",
  "url": "/competitions/plant-pathology-2021-fgvc8/writeups/luminide-3rd-place-solution",
  "author_name": "",
  "post_date": "2021-05-31T16:05:37.057Z",
  "votes": 29,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Our method isn't that different from those published in the top scoring notebooks. Let me list a few things that I believe contributed to our solution placing in the top three.</p>\n<p><strong>1 Trained on both fgvc7 and fgvc8 data</strong>. Interestingly, adding fgvc7 data seemed to contribute more than its fair share. Leaving 2000 images out of fgvc8 data didn't seem to make much difference. However, leaving out fgvc7 data (with the number of images in the same ballpark) led to a big drop in the leaderboard score. This was true even after <a href=\"https://www.kaggle.com/c/plant-pathology-2021-fgvc8/discussion/234332\" target=\"_blank\">the leak</a> was fixed, though less glaring.</p>\n<p><strong>2 Usage of soft labels</strong>. Like many others observed, the labels in the training set are very noisy. The label \"complex\" is especially problematic. It looks like \"complex\" could mean too many diseases or an unidentified disease. As we were using cross entropy as the loss function, it didn't make much sense to use hard labels that are often wrong. To soften the labels, we used this simple approach:</p>\n<pre><code>training_loop:\n    train_for_one_epoch()\n    labels = gamma*predictions + (1 - gamma)*labels\n</code></pre>\n<p>We considered <code>gamma</code> as a hyperparameter and tuned it to minimize validation error.</p>\n<p><strong>3 Automated hyperparameter tuning</strong>. Tuned using a new protocol being developed by <a href=\"https://luminide.com/\" target=\"_blank\">Luminide</a>.</p>\n<p><strong>4 Scaling the probabilities</strong>. We left out the \"healthy\" label while training. During inference, all the images that came out negative for all the diseases were deemed healthy. Validation showed that this method overestimated the proportion of healthy leaves. To compensate, we multiplied the logistic outputs with 1.3 before rounding them to get the predictions (this is pretty much equivalent to setting the threshold to 0.4).</p>\n<p>We used pretrained weights from <a href=\"https://www.kaggle.com/rwightman\" target=\"_blank\">@rwightman</a>'s excellent <a href=\"https://github.com/rwightman/pytorch-image-models\" target=\"_blank\">timm</a> library. The final submission averaged predictions from resnet50 and seresnext50.</p>",
  "messages": [
    {
      "id": "1327214",
      "postDate": "05/29/2021 04:35:10",
      "content": "<p>Our method isn't that different from those published in the top scoring notebooks. Let me list a few things that I believe contributed to our solution placing in the top three.</p>\n<p><strong>1 Trained on both fgvc7 and fgvc8 data</strong>. Interestingly, adding fgvc7 data seemed to contribute more than its fair share. Leaving 2000 images out of fgvc8 data didn't seem to make much difference. However, leaving out fgvc7 data (with the number of images in the same ballpark) led to a big drop in the leaderboard score. This was true even after <a href=\"https://www.kaggle.com/c/plant-pathology-2021-fgvc8/discussion/234332\" target=\"_blank\">the leak</a> was fixed, though less glaring.</p>\n<p><strong>2 Usage of soft labels</strong>. Like many others observed, the labels in the training set are very noisy. The label \"complex\" is especially problematic. It looks like \"complex\" could mean too many diseases or an unidentified disease. As we were using cross entropy as the loss function, it didn't make much sense to use hard labels that are often wrong. To soften the labels, we used this simple approach:</p>\n<pre><code>training_loop:\n    train_for_one_epoch()\n    labels = gamma*predictions + (1 - gamma)*labels\n</code></pre>\n<p>We considered <code>gamma</code> as a hyperparameter and tuned it to minimize validation error.</p>\n<p><strong>3 Automated hyperparameter tuning</strong>. Tuned using a new protocol being developed by <a href=\"https://luminide.com/\" target=\"_blank\">Luminide</a>.</p>\n<p><strong>4 Scaling the probabilities</strong>. We left out the \"healthy\" label while training. During inference, all the images that came out negative for all the diseases were deemed healthy. Validation showed that this method overestimated the proportion of healthy leaves. To compensate, we multiplied the logistic outputs with 1.3 before rounding them to get the predictions (this is pretty much equivalent to setting the threshold to 0.4).</p>\n<p>We used pretrained weights from <a href=\"https://www.kaggle.com/rwightman\" target=\"_blank\">@rwightman</a>'s excellent <a href=\"https://github.com/rwightman/pytorch-image-models\" target=\"_blank\">timm</a> library. The final submission averaged predictions from resnet50 and seresnext50.</p>",
      "rawMarkdown": "Our method isn't that different from those published in the top scoring notebooks. Let me list a few things that I believe contributed to our solution placing in the top three.\n\n**1 Trained on both fgvc7 and fgvc8 data**. Interestingly, adding fgvc7 data seemed to contribute more than its fair share. Leaving 2000 images out of fgvc8 data didn't seem to make much difference. However, leaving out fgvc7 data (with the number of images in the same ballpark) led to a big drop in the leaderboard score. This was true even after [the leak](https://www.kaggle.com/c/plant-pathology-2021-fgvc8/discussion/234332) was fixed, though less glaring.\n\n**2 Usage of soft labels**. Like many others observed, the labels in the training set are very noisy. The label \"complex\" is especially problematic. It looks like \"complex\" could mean too many diseases or an unidentified disease. As we were using cross entropy as the loss function, it didn't make much sense to use hard labels that are often wrong. To soften the labels, we used this simple approach:\n\n```\ntraining_loop:\n    train_for_one_epoch()\n    labels = gamma*predictions + (1 - gamma)*labels\n```\n\nWe considered `gamma` as a hyperparameter and tuned it to minimize validation error.\n\n**3 Automated hyperparameter tuning**. Tuned using a new protocol being developed by [Luminide](https://luminide.com/).\n\n**4 Scaling the probabilities**. We left out the \"healthy\" label while training. During inference, all the images that came out negative for all the diseases were deemed healthy. Validation showed that this method overestimated the proportion of healthy leaves. To compensate, we multiplied the logistic outputs with 1.3 before rounding them to get the predictions (this is pretty much equivalent to setting the threshold to 0.4).\n\nWe used pretrained weights from @rwightman's excellent [timm](https://github.com/rwightman/pytorch-image-models) library. The final submission averaged predictions from resnet50 and seresnext50.",
      "votes": null
    },
    {
      "id": "1327294",
      "postDate": "05/29/2021 06:23:34",
      "content": "<p>Congratulations and thanks for sharing your approach, simple yet effective!</p>",
      "rawMarkdown": "Congratulations and thanks for sharing your approach, simple yet effective!",
      "votes": null
    },
    {
      "id": "1327318",
      "postDate": "05/29/2021 07:01:49",
      "content": "<p>Thanks for sharing your solution!</p>",
      "rawMarkdown": "Thanks for sharing your solution!",
      "votes": null
    },
    {
      "id": "1328459",
      "postDate": "05/30/2021 09:22:32",
      "content": "<p>Congratulations and thanks for your sharing.<br>\nAnd what size images were used?</p>",
      "rawMarkdown": "Congratulations and thanks for your sharing.\nAnd what size images were used?",
      "votes": null
    },
    {
      "id": "1330141",
      "postDate": "05/31/2021 16:01:37",
      "content": "<p>Resized to 432x432 and then cropped to 384x384.</p>",
      "rawMarkdown": "Resized to 432x432 and then cropped to 384x384.",
      "votes": null
    },
    {
      "id": "1339093",
      "postDate": "06/07/2021 03:18:41",
      "content": "<p>Congratulations and thanks for your solution.<br>\nAnd the labels of fgvc7 and fgvc8 are different. What is your strategy and how do you use the labels of fgvc7.</p>",
      "rawMarkdown": "Congratulations and thanks for your solution.\nAnd the labels of fgvc7 and fgvc8 are different. What is your strategy and how do you use the labels of fgvc7.",
      "votes": null
    },
    {
      "id": "1340247",
      "postDate": "06/07/2021 18:19:25",
      "content": "<p>Oh, they aren't very different. We replaced the label \"multiple_diseases\" with \"complex\".</p>",
      "rawMarkdown": "Oh, they aren't very different. We replaced the label \"multiple_diseases\" with \"complex\".",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1327294,
      "author_name": "ashish2001",
      "author_url": "",
      "post_date": "05/29/2021 06:23:34",
      "content": "<p>Congratulations and thanks for sharing your approach, simple yet effective!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1327318,
      "author_name": "atamazian",
      "author_url": "",
      "post_date": "05/29/2021 07:01:49",
      "content": "<p>Thanks for sharing your solution!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1328459,
      "author_name": "alekseyeliseev",
      "author_url": "",
      "post_date": "05/30/2021 09:22:32",
      "content": "<p>Congratulations and thanks for your sharing.<br>\nAnd what size images were used?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1330141,
          "author_name": "anlthms",
          "author_url": "",
          "post_date": "05/31/2021 16:01:37",
          "content": "<p>Resized to 432x432 and then cropped to 384x384.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1339093,
      "author_name": "h030162",
      "author_url": "",
      "post_date": "06/07/2021 03:18:41",
      "content": "<p>Congratulations and thanks for your solution.<br>\nAnd the labels of fgvc7 and fgvc8 are different. What is your strategy and how do you use the labels of fgvc7.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1340247,
          "author_name": "anlthms",
          "author_url": "",
          "post_date": "06/07/2021 18:19:25",
          "content": "<p>Oh, they aren't very different. We replaced the label \"multiple_diseases\" with \"complex\".</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1327214": "Our method isn't that different from those published in the top scoring notebooks. Let me list a few things that I believe contributed to our solution placing in the top three.\n\n**1 Trained on both fgvc7 and fgvc8 data**. Interestingly, adding fgvc7 data seemed to contribute more than its fair share. Leaving 2000 images out of fgvc8 data didn't seem to make much difference. However, leaving out fgvc7 data (with the number of images in the same ballpark) led to a big drop in the leaderboard score. This was true even after [the leak](https://www.kaggle.com/c/plant-pathology-2021-fgvc8/discussion/234332) was fixed, though less glaring.\n\n**2 Usage of soft labels**. Like many others observed, the labels in the training set are very noisy. The label \"complex\" is especially problematic. It looks like \"complex\" could mean too many diseases or an unidentified disease. As we were using cross entropy as the loss function, it didn't make much sense to use hard labels that are often wrong. To soften the labels, we used this simple approach:\n\n```\ntraining_loop:\n    train_for_one_epoch()\n    labels = gamma*predictions + (1 - gamma)*labels\n```\n\nWe considered `gamma` as a hyperparameter and tuned it to minimize validation error.\n\n**3 Automated hyperparameter tuning**. Tuned using a new protocol being developed by [Luminide](https://luminide.com/).\n\n**4 Scaling the probabilities**. We left out the \"healthy\" label while training. During inference, all the images that came out negative for all the diseases were deemed healthy. Validation showed that this method overestimated the proportion of healthy leaves. To compensate, we multiplied the logistic outputs with 1.3 before rounding them to get the predictions (this is pretty much equivalent to setting the threshold to 0.4).\n\nWe used pretrained weights from @rwightman's excellent [timm](https://github.com/rwightman/pytorch-image-models) library. The final submission averaged predictions from resnet50 and seresnext50.",
    "1327294": "Congratulations and thanks for sharing your approach, simple yet effective!",
    "1327318": "Thanks for sharing your solution!",
    "1328459": "Congratulations and thanks for your sharing.\nAnd what size images were used?",
    "1330141": "Resized to 432x432 and then cropped to 384x384.",
    "1339093": "Congratulations and thanks for your solution.\nAnd the labels of fgvc7 and fgvc8 are different. What is your strategy and how do you use the labels of fgvc7.",
    "1340247": "Oh, they aren't very different. We replaced the label \"multiple_diseases\" with \"complex\"."
  },
  "source": "meta"
}