{
  "id": 214325,
  "title": "What is wrong with this ? ",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/214325",
  "author_name": "",
  "post_date": "2021-01-26T07:48:57.396664500Z",
  "votes": 2,
  "comment_count": 6,
  "views": 0,
  "content": "<p>TEST_DIR = '../input/cassava-leaf-disease-classification/test_images/'<br>\ntest_images = os.listdir(TEST_DIR)<br>\npredictions = []<br>\nimport statistics <br>\nfrom statistics import mode <br>\npred = []<br>\nfrom scipy import stats<br>\nfor image in test_images:<br>\n    img = Image.open(TEST_DIR + image)<br>\n    img = img.resize(size)<br>\n    img = np.expand_dims(img, axis=0)<br>\n    for model in models:<br>\n        predictions.append(model.predict(img).argmax(axis = 1))<br>\n    pred.extend(stats.mode(predictions)[0][0])</p>\n<p>I am trying to predict the data using my models with folds. But when I submit, I am getting submission csv not found. Please advice :) </p>",
  "messages": [
    {
      "id": "1170426",
      "postDate": "01/26/2021 07:48:57",
      "content": "<p>TEST_DIR = '../input/cassava-leaf-disease-classification/test_images/'<br>\ntest_images = os.listdir(TEST_DIR)<br>\npredictions = []<br>\nimport statistics <br>\nfrom statistics import mode <br>\npred = []<br>\nfrom scipy import stats<br>\nfor image in test_images:<br>\n    img = Image.open(TEST_DIR + image)<br>\n    img = img.resize(size)<br>\n    img = np.expand_dims(img, axis=0)<br>\n    for model in models:<br>\n        predictions.append(model.predict(img).argmax(axis = 1))<br>\n    pred.extend(stats.mode(predictions)[0][0])</p>\n<p>I am trying to predict the data using my models with folds. But when I submit, I am getting submission csv not found. Please advice :) </p>",
      "rawMarkdown": "TEST_DIR = '../input/cassava-leaf-disease-classification/test_images/'\ntest_images = os.listdir(TEST_DIR)\npredictions = []\nimport statistics \nfrom statistics import mode \npred = []\nfrom scipy import stats\nfor image in test_images:\n    img = Image.open(TEST_DIR + image)\n    img = img.resize(size)\n    img = np.expand_dims(img, axis=0)\n    for model in models:\n        predictions.append(model.predict(img).argmax(axis = 1))\n    pred.extend(stats.mode(predictions)[0][0])\n\nI am trying to predict the data using my models with folds. But when I submit, I am getting submission csv not found. Please advice :)",
      "votes": null
    },
    {
      "id": "1170430",
      "postDate": "01/26/2021 07:55:27",
      "content": "<p><a href=\"https://www.kaggle.com/mosrihari\" target=\"_blank\">@mosrihari</a> do you save your predictions to submission.csv?<br>\nsee here in detail: <a href=\"https://www.kaggle.com/code-competition-debugging\" target=\"_blank\">https://www.kaggle.com/code-competition-debugging</a></p>",
      "rawMarkdown": "mosrihari do you save your predictions to submission.csv?\nsee here in detail: https://www.kaggle.com/code-competition-debugging",
      "votes": null
    },
    {
      "id": "1170496",
      "postDate": "01/26/2021 08:49:35",
      "content": "<p>yes <a href=\"https://www.kaggle.com/kentaronakanishi\" target=\"_blank\">@kentaronakanishi</a> </p>",
      "rawMarkdown": "yes @kentaronakanishi",
      "votes": null
    },
    {
      "id": "1170794",
      "postDate": "01/26/2021 12:50:38",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/mosrihari\" target=\"_blank\">@mosrihari</a> Make something generic for submission, As per my knowledge the image id mentioned in the submission file will get replaced with the private dataset image ID,s at runtime .</p>\n<p>Below is a example for basic submission code</p>\n<p>submission = pd.DataFrame(columns=['image_id','label'])<br>\nfor image_name in os.listdir(PARENT_DIR + '/test_images'):<br>\n    image_path = os.path.join(PARENT_DIR + '/test_images', image_name)<br>\n    image = tf.keras.preprocessing.image.load_img(image_path)<br>\n    resized_image = image.resize((IMAGE_SIZE, IMAGE_SIZE))<br>\n    numpied_image = np.expand_dims(resized_image, 0)<br>\n    tensored_image = tf.cast(numpied_image, tf.float32)<br>\n    submission = submission.append(pd.DataFrame({'image_id': image_name,<br>\n                                                 'label': model.predict_classes(tensored_image)}))</p>",
      "rawMarkdown": "Hi @mosrihari Make something generic for submission, As per my knowledge the image id mentioned in the submission file will get replaced with the private dataset image ID,s at runtime .\n\nBelow is a example for basic submission code\n\nsubmission = pd.DataFrame(columns=['image_id','label'])\nfor image_name in os.listdir(PARENT_DIR + '/test_images'):\n    image_path = os.path.join(PARENT_DIR + '/test_images', image_name)\n    image = tf.keras.preprocessing.image.load_img(image_path)\n    resized_image = image.resize((IMAGE_SIZE, IMAGE_SIZE))\n    numpied_image = np.expand_dims(resized_image, 0)\n    tensored_image = tf.cast(numpied_image, tf.float32)\n    submission = submission.append(pd.DataFrame({'image_id': image_name,\n                                                 'label': model.predict_classes(tensored_image)}))",
      "votes": null
    },
    {
      "id": "1171641",
      "postDate": "01/27/2021 02:25:33",
      "content": "<p>Thank you so much <a href=\"https://www.kaggle.com/ssarkar445\" target=\"_blank\">@ssarkar445</a> .. It is working :) </p>",
      "rawMarkdown": "Thank you so much @ssarkar445 .. It is working :)",
      "votes": null
    },
    {
      "id": "1171642",
      "postDate": "01/27/2021 02:25:33",
      "content": "<p>Thank you so much <a href=\"https://www.kaggle.com/ssarkar445\" target=\"_blank\">@ssarkar445</a> .. It is working :) </p>",
      "rawMarkdown": "Thank you so much @ssarkar445 .. It is working :)",
      "votes": null
    },
    {
      "id": "1174810",
      "postDate": "01/28/2021 18:06:50",
      "content": "<p>I do not see any DataFrame created here. <br>\nYou need to create a DataFrame and fill it up the Results along with file names <br>\nthen you need to save that DataFrame</p>\n<p>After that submit the Notebook i hope it would work</p>",
      "rawMarkdown": "I do not see any DataFrame created here. \nYou need to create a DataFrame and fill it up the Results along with file names \nthen you need to save that DataFrame\n\nAfter that submit the Notebook i hope it would work",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1170430,
      "author_name": "kentaronakanishi",
      "author_url": "",
      "post_date": "01/26/2021 07:55:27",
      "content": "<p><a href=\"https://www.kaggle.com/mosrihari\" target=\"_blank\">@mosrihari</a> do you save your predictions to submission.csv?<br>\nsee here in detail: <a href=\"https://www.kaggle.com/code-competition-debugging\" target=\"_blank\">https://www.kaggle.com/code-competition-debugging</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1170496,
          "author_name": "mosrihari",
          "author_url": "",
          "post_date": "01/26/2021 08:49:35",
          "content": "<p>yes <a href=\"https://www.kaggle.com/kentaronakanishi\" target=\"_blank\">@kentaronakanishi</a> </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1170794,
      "author_name": "ssarkar445",
      "author_url": "",
      "post_date": "01/26/2021 12:50:38",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/mosrihari\" target=\"_blank\">@mosrihari</a> Make something generic for submission, As per my knowledge the image id mentioned in the submission file will get replaced with the private dataset image ID,s at runtime .</p>\n<p>Below is a example for basic submission code</p>\n<p>submission = pd.DataFrame(columns=['image_id','label'])<br>\nfor image_name in os.listdir(PARENT_DIR + '/test_images'):<br>\n    image_path = os.path.join(PARENT_DIR + '/test_images', image_name)<br>\n    image = tf.keras.preprocessing.image.load_img(image_path)<br>\n    resized_image = image.resize((IMAGE_SIZE, IMAGE_SIZE))<br>\n    numpied_image = np.expand_dims(resized_image, 0)<br>\n    tensored_image = tf.cast(numpied_image, tf.float32)<br>\n    submission = submission.append(pd.DataFrame({'image_id': image_name,<br>\n                                                 'label': model.predict_classes(tensored_image)}))</p>",
      "votes": null,
      "replies": [
        {
          "id": 1171641,
          "author_name": "mosrihari",
          "author_url": "",
          "post_date": "01/27/2021 02:25:33",
          "content": "<p>Thank you so much <a href=\"https://www.kaggle.com/ssarkar445\" target=\"_blank\">@ssarkar445</a> .. It is working :) </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1171642,
          "author_name": "mosrihari",
          "author_url": "",
          "post_date": "01/27/2021 02:25:33",
          "content": "<p>Thank you so much <a href=\"https://www.kaggle.com/ssarkar445\" target=\"_blank\">@ssarkar445</a> .. It is working :) </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1174810,
      "author_name": "ayannareda",
      "author_url": "",
      "post_date": "01/28/2021 18:06:50",
      "content": "<p>I do not see any DataFrame created here. <br>\nYou need to create a DataFrame and fill it up the Results along with file names <br>\nthen you need to save that DataFrame</p>\n<p>After that submit the Notebook i hope it would work</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1170426": "TEST_DIR = '../input/cassava-leaf-disease-classification/test_images/'\ntest_images = os.listdir(TEST_DIR)\npredictions = []\nimport statistics \nfrom statistics import mode \npred = []\nfrom scipy import stats\nfor image in test_images:\n    img = Image.open(TEST_DIR + image)\n    img = img.resize(size)\n    img = np.expand_dims(img, axis=0)\n    for model in models:\n        predictions.append(model.predict(img).argmax(axis = 1))\n    pred.extend(stats.mode(predictions)[0][0])\n\nI am trying to predict the data using my models with folds. But when I submit, I am getting submission csv not found. Please advice :)",
    "1170430": "mosrihari do you save your predictions to submission.csv?\nsee here in detail: https://www.kaggle.com/code-competition-debugging",
    "1170496": "yes @kentaronakanishi",
    "1170794": "Hi @mosrihari Make something generic for submission, As per my knowledge the image id mentioned in the submission file will get replaced with the private dataset image ID,s at runtime .\n\nBelow is a example for basic submission code\n\nsubmission = pd.DataFrame(columns=['image_id','label'])\nfor image_name in os.listdir(PARENT_DIR + '/test_images'):\n    image_path = os.path.join(PARENT_DIR + '/test_images', image_name)\n    image = tf.keras.preprocessing.image.load_img(image_path)\n    resized_image = image.resize((IMAGE_SIZE, IMAGE_SIZE))\n    numpied_image = np.expand_dims(resized_image, 0)\n    tensored_image = tf.cast(numpied_image, tf.float32)\n    submission = submission.append(pd.DataFrame({'image_id': image_name,\n                                                 'label': model.predict_classes(tensored_image)}))",
    "1171641": "Thank you so much @ssarkar445 .. It is working :)",
    "1171642": "Thank you so much @ssarkar445 .. It is working :)",
    "1174810": "I do not see any DataFrame created here. \nYou need to create a DataFrame and fill it up the Results along with file names \nthen you need to save that DataFrame\n\nAfter that submit the Notebook i hope it would work"
  },
  "source": "meta"
}