{
  "id": 218788,
  "title": "Why could I be getting 0.048????",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/218788",
  "author_name": "",
  "post_date": "2021-02-12T05:49:02.871396800Z",
  "votes": 1,
  "comment_count": 9,
  "views": 0,
  "content": "<p>Hello Everyone,</p>\n<p>I downloaded pre-trained models like VGG16 and trained it on the provided data. I get decent validation accuracy. But, when I make the submission I only get a score of 0.048.</p>\n<p>When I checked the output of my committed code, I found that the model weights could not be downloaded. During submission, it asked to turn off the internet from where the model was getting downloaded.</p>\n<p>So, is there any way we can use pre-trained models? Can you please help me with this?</p>\n<p>Thanks.</p>",
  "messages": [
    {
      "id": "1197353",
      "postDate": "02/12/2021 05:49:02",
      "content": "<p>Hello Everyone,</p>\n<p>I downloaded pre-trained models like VGG16 and trained it on the provided data. I get decent validation accuracy. But, when I make the submission I only get a score of 0.048.</p>\n<p>When I checked the output of my committed code, I found that the model weights could not be downloaded. During submission, it asked to turn off the internet from where the model was getting downloaded.</p>\n<p>So, is there any way we can use pre-trained models? Can you please help me with this?</p>\n<p>Thanks.</p>",
      "rawMarkdown": "Hello Everyone,\n\nI downloaded pre-trained models like VGG16 and trained it on the provided data. I get decent validation accuracy. But, when I make the submission I only get a score of 0.048.\n\n\nWhen I checked the output of my committed code, I found that the model weights could not be downloaded. During submission, it asked to turn off the internet from where the model was getting downloaded.\n\nSo, is there any way we can use pre-trained models? Can you please help me with this?\n\nThanks.",
      "votes": null
    },
    {
      "id": "1197362",
      "postDate": "02/12/2021 05:55:40",
      "content": "<p>This looks like your model is predicting only label 0. Have you rescaled your images by 255 in both the inference and train pipeline. You also should not download model in inference. You should train the model and save it. If you are using tensorflow use the model.save() function to save to your model. then create the a dataset and put your saved model in their and  then add it in the notebook for inference. Also if you provide a code sample it will be helpful for debugging what is wrong </p>",
      "rawMarkdown": "This looks like your model is predicting only label 0. Have you rescaled your images by 255 in both the inference and train pipeline. You also should not download model in inference. You should train the model and save it. If you are using tensorflow use the model.save() function to save to your model. then create the a dataset and put your saved model in their and  then add it in the notebook for inference. Also if you provide a code sample it will be helpful for debugging what is wrong",
      "votes": null
    },
    {
      "id": "1197366",
      "postDate": "02/12/2021 05:57:43",
      "content": "<p>Thanks for your response <a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a>. Yes, I re-scaled. Also, I updated the statement above. The reason is model weights could not be downloaded.</p>\n<p>So, is there any way we can pre-download them before committing the notebook so that it is available during the prediction/submission?</p>",
      "rawMarkdown": "Thanks for your response @mithilsalunkhe. Yes, I re-scaled. Also, I updated the statement above. The reason is model weights could not be downloaded.\n\nSo, is there any way we can pre-download them before committing the notebook so that it is available during the prediction/submission?",
      "votes": null
    },
    {
      "id": "1197369",
      "postDate": "02/12/2021 06:06:55",
      "content": "<p>Upload the model to a kaggle dataset and add it to the notebook you are submitting and load if from tf.keras.models.load_model()</p>",
      "rawMarkdown": "Upload the model to a kaggle dataset and add it to the notebook you are submitting and load if from tf.keras.models.load_model()",
      "votes": null
    },
    {
      "id": "1197372",
      "postDate": "02/12/2021 06:11:05",
      "content": "<p>oh!! got it, just like we add Word Embeddings. Thank you so much <a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a> .</p>",
      "rawMarkdown": "oh!! got it, just like we add Word Embeddings. Thank you so much @mithilsalunkhe .",
      "votes": null
    },
    {
      "id": "1197534",
      "postDate": "02/12/2021 08:17:52",
      "content": "<p><a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a> I was able to load and train the model. But, after submissions, it says - \"executing the notebook\". Will the entire notebook be executed again - meaning will the model get trained again? </p>\n<p>Is there any way we can avoid the re-training?</p>",
      "rawMarkdown": "mithilsalunkhe I was able to load and train the model. But, after submissions, it says - \"executing the notebook\". Will the entire notebook be executed again - meaning will the model get trained again? \n\nIs there any way we can avoid the re-training?",
      "votes": null
    },
    {
      "id": "1197543",
      "postDate": "02/12/2021 08:28:14",
      "content": "<p>Save the model using model.save function this will in your train notebook. Now add it to your model dataset. Load it in the inference notebook using tf.keras.models.load_model and predict the results </p>",
      "rawMarkdown": "Save the model using model.save function this will in your train notebook. Now add it to your model dataset. Load it in the inference notebook using tf.keras.models.load_model and predict the results",
      "votes": null
    },
    {
      "id": "1197544",
      "postDate": "02/12/2021 08:29:49",
      "content": "<p>ok. Thanks!</p>",
      "rawMarkdown": "ok. Thanks!",
      "votes": null
    },
    {
      "id": "1197596",
      "postDate": "02/12/2021 09:03:46",
      "content": "<p>There are already datasets liked keras pretrained models which have all those models saved . You can directly import the dataset and use those models :)</p>",
      "rawMarkdown": "There are already datasets liked keras pretrained models which have all those models saved . You can directly import the dataset and use those models :)",
      "votes": null
    },
    {
      "id": "1198204",
      "postDate": "02/12/2021 19:42:04",
      "content": "<p>I created a link for this very purpose <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/216461\" target=\"_blank\">here</a></p>",
      "rawMarkdown": "I created a link for this very purpose [here](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/216461)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1197362,
      "author_name": "mithilsalunkhe",
      "author_url": "",
      "post_date": "02/12/2021 05:55:40",
      "content": "<p>This looks like your model is predicting only label 0. Have you rescaled your images by 255 in both the inference and train pipeline. You also should not download model in inference. You should train the model and save it. If you are using tensorflow use the model.save() function to save to your model. then create the a dataset and put your saved model in their and  then add it in the notebook for inference. Also if you provide a code sample it will be helpful for debugging what is wrong </p>",
      "votes": null,
      "replies": [
        {
          "id": 1197366,
          "author_name": "pikkupr",
          "author_url": "",
          "post_date": "02/12/2021 05:57:43",
          "content": "<p>Thanks for your response <a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a>. Yes, I re-scaled. Also, I updated the statement above. The reason is model weights could not be downloaded.</p>\n<p>So, is there any way we can pre-download them before committing the notebook so that it is available during the prediction/submission?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1197369,
          "author_name": "mithilsalunkhe",
          "author_url": "",
          "post_date": "02/12/2021 06:06:55",
          "content": "<p>Upload the model to a kaggle dataset and add it to the notebook you are submitting and load if from tf.keras.models.load_model()</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1197372,
          "author_name": "pikkupr",
          "author_url": "",
          "post_date": "02/12/2021 06:11:05",
          "content": "<p>oh!! got it, just like we add Word Embeddings. Thank you so much <a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a> .</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1197534,
          "author_name": "pikkupr",
          "author_url": "",
          "post_date": "02/12/2021 08:17:52",
          "content": "<p><a href=\"https://www.kaggle.com/mithilsalunkhe\" target=\"_blank\">@mithilsalunkhe</a> I was able to load and train the model. But, after submissions, it says - \"executing the notebook\". Will the entire notebook be executed again - meaning will the model get trained again? </p>\n<p>Is there any way we can avoid the re-training?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1197543,
          "author_name": "mithilsalunkhe",
          "author_url": "",
          "post_date": "02/12/2021 08:28:14",
          "content": "<p>Save the model using model.save function this will in your train notebook. Now add it to your model dataset. Load it in the inference notebook using tf.keras.models.load_model and predict the results </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1197544,
          "author_name": "pikkupr",
          "author_url": "",
          "post_date": "02/12/2021 08:29:49",
          "content": "<p>ok. Thanks!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1197596,
      "author_name": "accountstatus",
      "author_url": "",
      "post_date": "02/12/2021 09:03:46",
      "content": "<p>There are already datasets liked keras pretrained models which have all those models saved . You can directly import the dataset and use those models :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1198204,
      "author_name": "vickygoyal",
      "author_url": "",
      "post_date": "02/12/2021 19:42:04",
      "content": "<p>I created a link for this very purpose <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/216461\" target=\"_blank\">here</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1197353": "Hello Everyone,\n\nI downloaded pre-trained models like VGG16 and trained it on the provided data. I get decent validation accuracy. But, when I make the submission I only get a score of 0.048.\n\n\nWhen I checked the output of my committed code, I found that the model weights could not be downloaded. During submission, it asked to turn off the internet from where the model was getting downloaded.\n\nSo, is there any way we can use pre-trained models? Can you please help me with this?\n\nThanks.",
    "1197362": "This looks like your model is predicting only label 0. Have you rescaled your images by 255 in both the inference and train pipeline. You also should not download model in inference. You should train the model and save it. If you are using tensorflow use the model.save() function to save to your model. then create the a dataset and put your saved model in their and  then add it in the notebook for inference. Also if you provide a code sample it will be helpful for debugging what is wrong",
    "1197366": "Thanks for your response @mithilsalunkhe. Yes, I re-scaled. Also, I updated the statement above. The reason is model weights could not be downloaded.\n\nSo, is there any way we can pre-download them before committing the notebook so that it is available during the prediction/submission?",
    "1197369": "Upload the model to a kaggle dataset and add it to the notebook you are submitting and load if from tf.keras.models.load_model()",
    "1197372": "oh!! got it, just like we add Word Embeddings. Thank you so much @mithilsalunkhe .",
    "1197534": "mithilsalunkhe I was able to load and train the model. But, after submissions, it says - \"executing the notebook\". Will the entire notebook be executed again - meaning will the model get trained again? \n\nIs there any way we can avoid the re-training?",
    "1197543": "Save the model using model.save function this will in your train notebook. Now add it to your model dataset. Load it in the inference notebook using tf.keras.models.load_model and predict the results",
    "1197544": "ok. Thanks!",
    "1197596": "There are already datasets liked keras pretrained models which have all those models saved . You can directly import the dataset and use those models :)",
    "1198204": "I created a link for this very purpose [here](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/216461)"
  },
  "source": "meta"
}