{
  "id": 211599,
  "title": "keep getting Submission Scoring Error :-( ",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/211599",
  "author_name": "Yuval Navot",
  "post_date": "2021-01-15T18:38:10.220000",
  "votes": 2,
  "comment_count": 13,
  "views": 0,
  "content": "<p>Hi everyone<br>\nIm keep getting \"Submission Scoring Error\", worked fine on my local PC …<br>\nHow can I review the issues and fix? </p>\n<p>here is my code, tried ~10 version with no luck</p>\n<p><a href=\"https://www.kaggle.com/yuvalnavot/cassava-leaf-disease\" target=\"_blank\">https://www.kaggle.com/yuvalnavot/cassava-leaf-disease</a></p>\n<p>Thanks<br>\nYuval.</p>",
  "messages": [
    {
      "id": 1158998,
      "postDate": "2021-01-19T00:53:32.007Z",
      "content": "<p>What I recommend you to do is to try creating a submission df with a subset of the training path instead and check what the output csv would look like.</p>\n<p>Also, make sure to have the internet off on your submission file. </p>",
      "rawMarkdown": "What I recommend you to do is to try creating a submission df with a subset of the training path instead and check what the output csv would look like.\n\nAlso, make sure to have the internet off on your submission file. ",
      "votes": 1,
      "replies": [
        {
          "id": 1159809,
          "postDate": "2021-01-19T13:34:04.787Z",
          "content": "<p>how do I set \"Internet off\" in my submission file? <br>\ndo i need to insert special lines in my code to enable it? </p>",
          "rawMarkdown": "how do I set \"Internet off\" in my submission file? \ndo i need to insert special lines in my code to enable it? "
        },
        {
          "id": 1159940,
          "postDate": "2021-01-19T14:57:22.440Z",
          "content": "<p>In the settings on the right panel when editing the notebook, there's a toggle for internet (where you also change your accelerator into none/gpu/tpu)</p>",
          "rawMarkdown": "In the settings on the right panel when editing the notebook, there's a toggle for internet (where you also change your accelerator into none/gpu/tpu)"
        },
        {
          "id": 1159988,
          "postDate": "2021-01-19T15:43:58.867Z",
          "content": "<p>yes was set to \"none\" </p>\n<p>Thanks </p>",
          "rawMarkdown": "yes was set to \"none\" \n\nThanks \n"
        }
      ]
    },
    {
      "id": 1156953,
      "postDate": "2021-01-17T14:44:31.840Z",
      "content": "<p>One possible reason can be:<br>\nWhen you write:<br>\n<code>np.argmax(preds)</code><br>\nit works fine with 1 visible test image, but there are more than 1 images during scoring, which introduces an error.<br>\nCorrect way would be:<br>\n<code>np.argmax(preds, axis=1)</code><br>\nMany such errors are possible, try debugging using an array for multiple preds. Hope this helps</p>",
      "rawMarkdown": "One possible reason can be:\nWhen you write:\n`np.argmax(preds)`\nit works fine with 1 visible test image, but there are more than 1 images during scoring, which introduces an error.\nCorrect way would be:\n`np.argmax(preds, axis=1)`\nMany such errors are possible, try debugging using an array for multiple preds. Hope this helps",
      "votes": 1,
      "replies": [
        {
          "id": 1158960,
          "postDate": "2021-01-18T22:46:42.360Z",
          "rawMarkdown": "",
          "votes": -2,
          "isDeleted": true
        },
        {
          "id": 1159805,
          "postDate": "2021-01-19T13:31:24.230Z",
          "content": "<p>thanks Avik, with your recommendation I don't have \"submission error\" but got Zero Score… <br>\nwhat am I doing wrong here? :-( <br>\nI tried on 4 training_images and I do get correct \"sub\" DF</p>\n<h1>os.path.exists('submission.csv')</h1>\n<p>test_dir = '../input/cassava-leaf-disease-classification/test_images/'<br>\ntest_images = os.listdir(test_dir)<br>\npredictions = []</p>\n<p>for image in test_images:<br>\n    img = Image.open(test_dir + image)<br>\n    img = img.resize([img_width, img_height])<br>\n    img = np.expand_dims(img, axis=0)<br>\n    predictions.extend(model.predict(img).<strong>argmax(axis = 1</strong>))</p>\n<p>sub = pd.DataFrame({'image_id': test_images, 'label': predictions})<br>\ndisplay(sub)<br>\nsub.to_csv('submission.csv', index = False)</p>\n<p>thanks for the help <br>\nYuval. </p>",
          "rawMarkdown": "thanks Avik, with your recommendation I don't have \"submission error\" but got Zero Score... \nwhat am I doing wrong here? :-( \nI tried on 4 training_images and I do get correct \"sub\" DF\n\n# os.path.exists('submission.csv')\ntest_dir = '../input/cassava-leaf-disease-classification/test_images/'\ntest_images = os.listdir(test_dir)\npredictions = []\n\nfor image in test_images:\n    img = Image.open(test_dir + image)\n    img = img.resize([img_width, img_height])\n    img = np.expand_dims(img, axis=0)\n    predictions.extend(model.predict(img).**argmax(axis = 1**))\n\n\nsub = pd.DataFrame({'image_id': test_images, 'label': predictions})\ndisplay(sub)\nsub.to_csv('submission.csv', index = False)\n\n\n\nthanks for the help \nYuval. ",
          "votes": 1
        },
        {
          "id": 1159830,
          "postDate": "2021-01-19T13:57:35.030Z",
          "content": "<p>You can't train and test in the same kernel:<br>\nWe need internet for the training part, hence training and inference(submission) has to be done in a separate kernel.<br>\nYou can refer to available kernels to see how all this has been handled.<br>\nMeanwhile, try printing prediction values to find what's wrong, try predicting on more than 1 image to see if your prediction list is getting created properly. Train with GPU enabled. Happy learning:)</p>",
          "rawMarkdown": "You can't train and test in the same kernel:\nWe need internet for the training part, hence training and inference(submission) has to be done in a separate kernel.\nYou can refer to available kernels to see how all this has been handled.\nMeanwhile, try printing prediction values to find what's wrong, try predicting on more than 1 image to see if your prediction list is getting created properly. Train with GPU enabled. Happy learning:)",
          "votes": 1
        },
        {
          "id": 1160161,
          "postDate": "2021-01-19T17:46:05.410Z",
          "content": "<p>thanks for the help.<br>\nas you suggested,  I ran the test/check on the first 4 images from the training set<br>\nand got nice DF … <br>\n| label | image-id          |<br>\n| 4       | 23456666.jpg |<br>\n| 3       |  12345555.jpg |<br>\n….<br>\nBTW: image id should be jpg full path or only the file name?</p>",
          "rawMarkdown": "thanks for the help.\nas you suggested,  I ran the test/check on the first 4 images from the training set\nand got nice DF ... \n| label | image-id          |\n| 4       | 23456666.jpg |\n| 3       |  12345555.jpg |\n....\nBTW: image id should be jpg full path or only the file name?\n"
        },
        {
          "id": 1162711,
          "postDate": "2021-01-21T09:37:46.437Z",
          "content": "<p><a href=\"https://www.kaggle.com/albernard\" target=\"_blank\">@albernard</a> thank you very much for urge me exploring what you meant by said \"You can't train and test in the same kernel:…\"   :-)</p>\n<p>I create one notebook and run the training (with GPU), saved the model at the end and create second notebook that:</p>\n<ol>\n<li>add the model file I saved from the first (train) notebook</li>\n<li>load the model</li>\n<li>run the model predict on the testing set,</li>\n<li>save submission.csv </li>\n<li>save the notebook</li>\n<li>submitted to competition  </li>\n</ol>\n<p>Halleluiah, got score and no \"submission error\"  :-)  </p>\n<p>Big thanks!</p>\n<p>Yuval. </p>",
          "rawMarkdown": "@albernard thank you very much for urge me exploring what you meant by said \"You can't train and test in the same kernel:...\"   :-)\n\nI create one notebook and run the training (with GPU), saved the model at the end and create second notebook that:\n1. add the model file I saved from the first (train) notebook\n2. load the model\n3.  run the model predict on the testing set,\n4.  save submission.csv \n5.  save the notebook\n6.  submitted to competition  \n\nHalleluiah, got score and no \"submission error\"  :-)  \n\nBig thanks!\n\nYuval. ",
          "votes": 2
        }
      ]
    },
    {
      "id": 1154742,
      "postDate": "2021-01-15T21:10:45.780Z",
      "content": "<p>It seems your submission file is not correct. It should be only one row. You have so many duplicates rows.</p>",
      "rawMarkdown": "It seems your submission file is not correct. It should be only one row. You have so many duplicates rows.",
      "votes": 1,
      "replies": [
        {
          "id": 1156765,
          "postDate": "2021-01-17T11:50:11.197Z",
          "content": "<p>its happened even when submission.csv contain one row<br>\nupdated my notebook 0.20 </p>",
          "rawMarkdown": "its happened even when submission.csv contain one row\nupdated my notebook 0.20 "
        }
      ]
    },
    {
      "id": 1154643,
      "postDate": "2021-01-15T18:38:10.220Z",
      "content": "<p>Hi everyone<br>\nIm keep getting \"Submission Scoring Error\", worked fine on my local PC …<br>\nHow can I review the issues and fix? </p>\n<p>here is my code, tried ~10 version with no luck</p>\n<p><a href=\"https://www.kaggle.com/yuvalnavot/cassava-leaf-disease\" target=\"_blank\">https://www.kaggle.com/yuvalnavot/cassava-leaf-disease</a></p>\n<p>Thanks<br>\nYuval.</p>",
      "rawMarkdown": "Hi everyone\nIm keep getting \"Submission Scoring Error\", worked fine on my local PC …\nHow can I review the issues and fix? \n\nhere is my code, tried ~10 version with no luck\n\nhttps://www.kaggle.com/yuvalnavot/cassava-leaf-disease\n\n\nThanks\nYuval.\n",
      "votes": 2
    },
    {
      "id": 1154650,
      "postDate": "2021-01-15T18:43:22.237Z",
      "content": "<p>I am also facing this issue :( </p>",
      "rawMarkdown": "I am also facing this issue :( "
    }
  ],
  "comments": [
    {
      "id": 1158998,
      "author_name": "Jason Dolorso",
      "author_url": "",
      "post_date": "2021-01-19T00:53:32.007000",
      "content": "<p>What I recommend you to do is to try creating a submission df with a subset of the training path instead and check what the output csv would look like.</p>\n<p>Also, make sure to have the internet off on your submission file. </p>",
      "votes": 1,
      "replies": [
        {
          "id": 1159809,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-19T13:34:04.787000",
          "content": "<p>how do I set \"Internet off\" in my submission file? <br>\ndo i need to insert special lines in my code to enable it? </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1159940,
          "author_name": "Jason Dolorso",
          "author_url": "",
          "post_date": "2021-01-19T14:57:22.440000",
          "content": "<p>In the settings on the right panel when editing the notebook, there's a toggle for internet (where you also change your accelerator into none/gpu/tpu)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1159988,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-19T15:43:58.867000",
          "content": "<p>yes was set to \"none\" </p>\n<p>Thanks </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1156953,
      "author_name": "Avik",
      "author_url": "",
      "post_date": "2021-01-17T14:44:31.840000",
      "content": "<p>One possible reason can be:<br>\nWhen you write:<br>\n<code>np.argmax(preds)</code><br>\nit works fine with 1 visible test image, but there are more than 1 images during scoring, which introduces an error.<br>\nCorrect way would be:<br>\n<code>np.argmax(preds, axis=1)</code><br>\nMany such errors are possible, try debugging using an array for multiple preds. Hope this helps</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1158960,
          "author_name": "",
          "author_url": "",
          "post_date": "2021-01-18T22:46:42.360000",
          "content": "",
          "votes": -2,
          "replies": []
        },
        {
          "id": 1159805,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-19T13:31:24.230000",
          "content": "<p>thanks Avik, with your recommendation I don't have \"submission error\" but got Zero Score… <br>\nwhat am I doing wrong here? :-( <br>\nI tried on 4 training_images and I do get correct \"sub\" DF</p>\n<h1>os.path.exists('submission.csv')</h1>\n<p>test_dir = '../input/cassava-leaf-disease-classification/test_images/'<br>\ntest_images = os.listdir(test_dir)<br>\npredictions = []</p>\n<p>for image in test_images:<br>\n    img = Image.open(test_dir + image)<br>\n    img = img.resize([img_width, img_height])<br>\n    img = np.expand_dims(img, axis=0)<br>\n    predictions.extend(model.predict(img).<strong>argmax(axis = 1</strong>))</p>\n<p>sub = pd.DataFrame({'image_id': test_images, 'label': predictions})<br>\ndisplay(sub)<br>\nsub.to_csv('submission.csv', index = False)</p>\n<p>thanks for the help <br>\nYuval. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1159830,
          "author_name": "Avik",
          "author_url": "",
          "post_date": "2021-01-19T13:57:35.030000",
          "content": "<p>You can't train and test in the same kernel:<br>\nWe need internet for the training part, hence training and inference(submission) has to be done in a separate kernel.<br>\nYou can refer to available kernels to see how all this has been handled.<br>\nMeanwhile, try printing prediction values to find what's wrong, try predicting on more than 1 image to see if your prediction list is getting created properly. Train with GPU enabled. Happy learning:)</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1160161,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-19T17:46:05.410000",
          "content": "<p>thanks for the help.<br>\nas you suggested,  I ran the test/check on the first 4 images from the training set<br>\nand got nice DF … <br>\n| label | image-id          |<br>\n| 4       | 23456666.jpg |<br>\n| 3       |  12345555.jpg |<br>\n….<br>\nBTW: image id should be jpg full path or only the file name?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1162711,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-21T09:37:46.437000",
          "content": "<p><a href=\"https://www.kaggle.com/albernard\" target=\"_blank\">@albernard</a> thank you very much for urge me exploring what you meant by said \"You can't train and test in the same kernel:…\"   :-)</p>\n<p>I create one notebook and run the training (with GPU), saved the model at the end and create second notebook that:</p>\n<ol>\n<li>add the model file I saved from the first (train) notebook</li>\n<li>load the model</li>\n<li>run the model predict on the testing set,</li>\n<li>save submission.csv </li>\n<li>save the notebook</li>\n<li>submitted to competition  </li>\n</ol>\n<p>Halleluiah, got score and no \"submission error\"  :-)  </p>\n<p>Big thanks!</p>\n<p>Yuval. </p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 1154742,
      "author_name": "LeoF",
      "author_url": "",
      "post_date": "2021-01-15T21:10:45.780000",
      "content": "<p>It seems your submission file is not correct. It should be only one row. You have so many duplicates rows.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1156765,
          "author_name": "Yuval Navot",
          "author_url": "",
          "post_date": "2021-01-17T11:50:11.197000",
          "content": "<p>its happened even when submission.csv contain one row<br>\nupdated my notebook 0.20 </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1154650,
      "author_name": "Shane McQ",
      "author_url": "",
      "post_date": "2021-01-15T18:43:22.237000",
      "content": "<p>I am also facing this issue :( </p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1158998": "What I recommend you to do is to try creating a submission df with a subset of the training path instead and check what the output csv would look like.\n\nAlso, make sure to have the internet off on your submission file. ",
    "1156953": "One possible reason can be:\nWhen you write:\n`np.argmax(preds)`\nit works fine with 1 visible test image, but there are more than 1 images during scoring, which introduces an error.\nCorrect way would be:\n`np.argmax(preds, axis=1)`\nMany such errors are possible, try debugging using an array for multiple preds. Hope this helps",
    "1154742": "It seems your submission file is not correct. It should be only one row. You have so many duplicates rows.",
    "1154643": "Hi everyone\nIm keep getting \"Submission Scoring Error\", worked fine on my local PC …\nHow can I review the issues and fix? \n\nhere is my code, tried ~10 version with no luck\n\nhttps://www.kaggle.com/yuvalnavot/cassava-leaf-disease\n\n\nThanks\nYuval.\n",
    "1154650": "I am also facing this issue :( "
  }
}