{
  "id": 273169,
  "title": "My model's accuracy doesn't change over 24 epochs",
  "url": "/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/discussion/273169",
  "author_name": "",
  "post_date": "2021-09-19T15:41:40.878016600Z",
  "votes": 3,
  "comment_count": 10,
  "views": 0,
  "content": "<p>Hi all,<br>\n   I trained my model 10 epoch and then 14 epoch. Though training loss decrease a little over time, my accuracy didn't change on both the training set and validation set as in this image:</p>\n<p><img src=\"https://i.postimg.cc/jdZXrhR4/Screenshot-from-2021-09-19-22-26-19.png\" alt=\"image\"></p>\n<p>Is my loss function wrong? My loss function was copied from Yaroslav Isaienkov's notebook, you can see it as bellow:</p>\n<blockquote>\n  <p>class LossMeter:</p>\n</blockquote>\n<pre><code>def __init__(self):\n    self.avg = 0\n    self.n = 0\n\ndef update(self, val):\n    self.n += 1\n    # incremental update\n    self.avg = val / self.n + (self.n - 1) / self.n * self.avg\n</code></pre>\n<p>Thanks for your time!</p>",
  "messages": [
    {
      "id": "1517436",
      "postDate": "09/19/2021 15:41:40",
      "content": "<p>Hi all,<br>\n   I trained my model 10 epoch and then 14 epoch. Though training loss decrease a little over time, my accuracy didn't change on both the training set and validation set as in this image:</p>\n<p><img src=\"https://i.postimg.cc/jdZXrhR4/Screenshot-from-2021-09-19-22-26-19.png\" alt=\"image\"></p>\n<p>Is my loss function wrong? My loss function was copied from Yaroslav Isaienkov's notebook, you can see it as bellow:</p>\n<blockquote>\n  <p>class LossMeter:</p>\n</blockquote>\n<pre><code>def __init__(self):\n    self.avg = 0\n    self.n = 0\n\ndef update(self, val):\n    self.n += 1\n    # incremental update\n    self.avg = val / self.n + (self.n - 1) / self.n * self.avg\n</code></pre>\n<p>Thanks for your time!</p>",
      "rawMarkdown": "Hi all,\n   I trained my model 10 epoch and then 14 epoch. Though training loss decrease a little over time, my accuracy didn't change on both the training set and validation set as in this image:\n\n![image](https://i.postimg.cc/jdZXrhR4/Screenshot-from-2021-09-19-22-26-19.png)\n\n   Is my loss function wrong? My loss function was copied from Yaroslav Isaienkov's notebook, you can see it as bellow:\n\n> class LossMeter:\n\n    def __init__(self):\n        self.avg = 0\n        self.n = 0\n\n    def update(self, val):\n        self.n += 1\n        # incremental update\n        self.avg = val / self.n + (self.n - 1) / self.n * self.avg\nThanks for your time!",
      "votes": null
    },
    {
      "id": "1517682",
      "postDate": "09/20/2021 01:04:23",
      "content": "<p>Can you please provide your entire cell where you are outputting the values, as well as the link to the notebook from where you copied the loss function? Thanks.</p>",
      "rawMarkdown": "Can you please provide your entire cell where you are outputting the values, as well as the link to the notebook from where you copied the loss function? Thanks.",
      "votes": null
    },
    {
      "id": "1517733",
      "postDate": "09/20/2021 03:07:52",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/vipran\" target=\"_blank\">@vipran</a>, I can't comment much without seeing all of your code, but know that it's almost common consensus to not have the models learn anything in this competition. So your observations might be normal and actually match with mine. </p>",
      "rawMarkdown": "Hey @vipran, I can't comment much without seeing all of your code, but know that it's almost common consensus to not have the models learn anything in this competition. So your observations might be normal and actually match with mine.",
      "votes": null
    },
    {
      "id": "1517844",
      "postDate": "09/20/2021 05:57:19",
      "content": "<p>Thank <a href=\"https://www.kaggle.com/anubhavchhabra\" target=\"_blank\">@anubhavchhabra</a> you can see my notebook <a href=\"https://www.kaggle.com/vipran/this-is-not-clone-one\" target=\"_blank\">here</a>. And <a href=\"https://www.kaggle.com/ihelon/brain-tumor-eda-with-animations-and-modeling\" target=\"_blank\">here</a> is the notebook that I copied from</p>",
      "rawMarkdown": "Thank @anubhavchhabra you can see my notebook [here](https://www.kaggle.com/vipran/this-is-not-clone-one). And [here](https://www.kaggle.com/ihelon/brain-tumor-eda-with-animations-and-modeling) is the notebook that I copied from",
      "votes": null
    },
    {
      "id": "1517845",
      "postDate": "09/20/2021 05:59:22",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/sauravmaheshkar\" target=\"_blank\">@sauravmaheshkar</a>, you can see my entire notebook <a href=\"https://www.kaggle.com/vipran/this-is-not-clone-one\" target=\"_blank\">here</a></p>",
      "rawMarkdown": "Hi @sauravmaheshkar, you can see my entire notebook [here](https://www.kaggle.com/vipran/this-is-not-clone-one)",
      "votes": null
    },
    {
      "id": "1517861",
      "postDate": "09/20/2021 06:24:40",
      "content": "<p>I had a look. Your code looks okay and there's nothing wrong with it. My codebase looks similar and my metrics are similar too. Try running submissions with different seeds, that might help. But I don't have a robust training pipeline as well.</p>",
      "rawMarkdown": "I had a look. Your code looks okay and there's nothing wrong with it. My codebase looks similar and my metrics are similar too. Try running submissions with different seeds, that might help. But I don't have a robust training pipeline as well.",
      "votes": null
    },
    {
      "id": "1517919",
      "postDate": "09/20/2021 08:05:16",
      "content": "<p>Thank you. I'll try it. Hope for a better result.</p>",
      "rawMarkdown": "Thank you. I'll try it. Hope for a better result.",
      "votes": null
    },
    {
      "id": "1518238",
      "postDate": "09/20/2021 14:06:45",
      "content": "<p>It happened to me also when I tried to train a model from scratch, then I decided to use pre-trained models(trained on imagenet) and that worked well.</p>",
      "rawMarkdown": "It happened to me also when I tried to train a model from scratch, then I decided to use pre-trained models(trained on imagenet) and that worked well.",
      "votes": null
    },
    {
      "id": "1518469",
      "postDate": "09/20/2021 16:56:12",
      "content": "<p>Could you please tell me how to avoid overfitting when use pretrained model. I started using Efficient pretrained but I cant handle its overfitting</p>",
      "rawMarkdown": "Could you please tell me how to avoid overfitting when use pretrained model. I started using Efficient pretrained but I cant handle its overfitting",
      "votes": null
    },
    {
      "id": "1518509",
      "postDate": "09/20/2021 17:42:42",
      "content": "<p>I tried to fix a couple of top Conv layers then train the remaining ones and if they overfit then try to add the closest fixed layer to trainable and then run the process again…until it gives a reasonable loss and if that model works I tried to run it using different Seeds to see if it was a lucky run or not.</p>",
      "rawMarkdown": "I tried to fix a couple of top Conv layers then train the remaining ones and if they overfit then try to add the closest fixed layer to trainable and then run the process again...until it gives a reasonable loss and if that model works I tried to run it using different Seeds to see if it was a lucky run or not.",
      "votes": null
    },
    {
      "id": "1518512",
      "postDate": "09/20/2021 17:47:07",
      "content": "<p>Thank you. I'll try it</p>",
      "rawMarkdown": "Thank you. I'll try it",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1517682,
      "author_name": "anubhavchhabra",
      "author_url": "",
      "post_date": "09/20/2021 01:04:23",
      "content": "<p>Can you please provide your entire cell where you are outputting the values, as well as the link to the notebook from where you copied the loss function? Thanks.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1517844,
          "author_name": "vipran",
          "author_url": "",
          "post_date": "09/20/2021 05:57:19",
          "content": "<p>Thank <a href=\"https://www.kaggle.com/anubhavchhabra\" target=\"_blank\">@anubhavchhabra</a> you can see my notebook <a href=\"https://www.kaggle.com/vipran/this-is-not-clone-one\" target=\"_blank\">here</a>. And <a href=\"https://www.kaggle.com/ihelon/brain-tumor-eda-with-animations-and-modeling\" target=\"_blank\">here</a> is the notebook that I copied from</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1517733,
      "author_name": "sauravmaheshkar",
      "author_url": "",
      "post_date": "09/20/2021 03:07:52",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/vipran\" target=\"_blank\">@vipran</a>, I can't comment much without seeing all of your code, but know that it's almost common consensus to not have the models learn anything in this competition. So your observations might be normal and actually match with mine. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1517845,
          "author_name": "vipran",
          "author_url": "",
          "post_date": "09/20/2021 05:59:22",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/sauravmaheshkar\" target=\"_blank\">@sauravmaheshkar</a>, you can see my entire notebook <a href=\"https://www.kaggle.com/vipran/this-is-not-clone-one\" target=\"_blank\">here</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1517861,
          "author_name": "sauravmaheshkar",
          "author_url": "",
          "post_date": "09/20/2021 06:24:40",
          "content": "<p>I had a look. Your code looks okay and there's nothing wrong with it. My codebase looks similar and my metrics are similar too. Try running submissions with different seeds, that might help. But I don't have a robust training pipeline as well.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1517919,
          "author_name": "vipran",
          "author_url": "",
          "post_date": "09/20/2021 08:05:16",
          "content": "<p>Thank you. I'll try it. Hope for a better result.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1518238,
      "author_name": "susnato",
      "author_url": "",
      "post_date": "09/20/2021 14:06:45",
      "content": "<p>It happened to me also when I tried to train a model from scratch, then I decided to use pre-trained models(trained on imagenet) and that worked well.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1518469,
          "author_name": "vipran",
          "author_url": "",
          "post_date": "09/20/2021 16:56:12",
          "content": "<p>Could you please tell me how to avoid overfitting when use pretrained model. I started using Efficient pretrained but I cant handle its overfitting</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1518509,
          "author_name": "susnato",
          "author_url": "",
          "post_date": "09/20/2021 17:42:42",
          "content": "<p>I tried to fix a couple of top Conv layers then train the remaining ones and if they overfit then try to add the closest fixed layer to trainable and then run the process again…until it gives a reasonable loss and if that model works I tried to run it using different Seeds to see if it was a lucky run or not.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1518512,
          "author_name": "vipran",
          "author_url": "",
          "post_date": "09/20/2021 17:47:07",
          "content": "<p>Thank you. I'll try it</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1517436": "Hi all,\n   I trained my model 10 epoch and then 14 epoch. Though training loss decrease a little over time, my accuracy didn't change on both the training set and validation set as in this image:\n\n![image](https://i.postimg.cc/jdZXrhR4/Screenshot-from-2021-09-19-22-26-19.png)\n\n   Is my loss function wrong? My loss function was copied from Yaroslav Isaienkov's notebook, you can see it as bellow:\n\n> class LossMeter:\n\n    def __init__(self):\n        self.avg = 0\n        self.n = 0\n\n    def update(self, val):\n        self.n += 1\n        # incremental update\n        self.avg = val / self.n + (self.n - 1) / self.n * self.avg\nThanks for your time!",
    "1517682": "Can you please provide your entire cell where you are outputting the values, as well as the link to the notebook from where you copied the loss function? Thanks.",
    "1517733": "Hey @vipran, I can't comment much without seeing all of your code, but know that it's almost common consensus to not have the models learn anything in this competition. So your observations might be normal and actually match with mine.",
    "1517844": "Thank @anubhavchhabra you can see my notebook [here](https://www.kaggle.com/vipran/this-is-not-clone-one). And [here](https://www.kaggle.com/ihelon/brain-tumor-eda-with-animations-and-modeling) is the notebook that I copied from",
    "1517845": "Hi @sauravmaheshkar, you can see my entire notebook [here](https://www.kaggle.com/vipran/this-is-not-clone-one)",
    "1517861": "I had a look. Your code looks okay and there's nothing wrong with it. My codebase looks similar and my metrics are similar too. Try running submissions with different seeds, that might help. But I don't have a robust training pipeline as well.",
    "1517919": "Thank you. I'll try it. Hope for a better result.",
    "1518238": "It happened to me also when I tried to train a model from scratch, then I decided to use pre-trained models(trained on imagenet) and that worked well.",
    "1518469": "Could you please tell me how to avoid overfitting when use pretrained model. I started using Efficient pretrained but I cant handle its overfitting",
    "1518509": "I tried to fix a couple of top Conv layers then train the remaining ones and if they overfit then try to add the closest fixed layer to trainable and then run the process again...until it gives a reasonable loss and if that model works I tried to run it using different Seeds to see if it was a lucky run or not.",
    "1518512": "Thank you. I'll try it"
  },
  "source": "meta"
}