{
  "id": 198816,
  "title": "submission csv not found",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/198816",
  "author_name": "",
  "post_date": "2020-11-23T06:13:28.347267300Z",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>import tensorflow as tf<br>\nimport numpy as np<br>\nimport os<br>\nimport pandas as pd<br>\nfrom keras.engine.saving import save_model<br>\nfrom keras.preprocessing import image<br>\nmodel=tf.keras.models.load_model('../input/training-den169/leaf1.h5')<br>\nimport glob<br>\ntest = os.listdir('/kaggle/input/cassava-leaf-disease-classification/test_images/')<br>\nfor img in glob.glob(\"../input/cassava-leaf-disease-classification/test_images/*.jpg\"):<br>\nimg_predicitions=image.load_img(img,target_size=(224,224,3))<br>\nimg_predicition=image.img_to_array(img_predicitions)<br>\nimg_predicition=np.expand_dims(img_predicition,axis=0)</p>\n<pre><code>result=model.predict_classes(img_predicition)\n\nprint(img, result)\nsubmission = pd.DataFrame({'image_id': test, 'label': result})\nsubmission.to_csv('submission.csv', index=False )\nprint(submission)\n</code></pre>",
  "messages": [
    {
      "id": "1087884",
      "postDate": "11/23/2020 06:13:28",
      "content": "<p>import tensorflow as tf<br>\nimport numpy as np<br>\nimport os<br>\nimport pandas as pd<br>\nfrom keras.engine.saving import save_model<br>\nfrom keras.preprocessing import image<br>\nmodel=tf.keras.models.load_model('../input/training-den169/leaf1.h5')<br>\nimport glob<br>\ntest = os.listdir('/kaggle/input/cassava-leaf-disease-classification/test_images/')<br>\nfor img in glob.glob(\"../input/cassava-leaf-disease-classification/test_images/*.jpg\"):<br>\nimg_predicitions=image.load_img(img,target_size=(224,224,3))<br>\nimg_predicition=image.img_to_array(img_predicitions)<br>\nimg_predicition=np.expand_dims(img_predicition,axis=0)</p>\n<pre><code>result=model.predict_classes(img_predicition)\n\nprint(img, result)\nsubmission = pd.DataFrame({'image_id': test, 'label': result})\nsubmission.to_csv('submission.csv', index=False )\nprint(submission)\n</code></pre>",
      "rawMarkdown": "import tensorflow as tf\nimport numpy as np\nimport os\nimport pandas as pd\nfrom keras.engine.saving import save_model\nfrom keras.preprocessing import image\nmodel=tf.keras.models.load_model('../input/training-den169/leaf1.h5')\nimport glob\ntest = os.listdir('/kaggle/input/cassava-leaf-disease-classification/test_images/')\nfor img in glob.glob(\"../input/cassava-leaf-disease-classification/test_images/*.jpg\"):\nimg_predicitions=image.load_img(img,target_size=(224,224,3))\nimg_predicition=image.img_to_array(img_predicitions)\nimg_predicition=np.expand_dims(img_predicition,axis=0)\n\n    result=model.predict_classes(img_predicition)\n\n    print(img, result)\n    submission = pd.DataFrame({'image_id': test, 'label': result})\n    submission.to_csv('submission.csv', index=False )\n    print(submission)",
      "votes": null
    },
    {
      "id": "1087886",
      "postDate": "11/23/2020 06:14:12",
      "content": "<p>code on my notebook. what can be the issue?</p>",
      "rawMarkdown": "code on my notebook. what can be the issue?",
      "votes": null
    },
    {
      "id": "1088536",
      "postDate": "11/23/2020 17:49:00",
      "content": "<p>Formatting makes your indenting not totally clear.</p>\n<p>Either you are getting a predication one image at a time so your result submission only has one image</p>\n<p>or</p>\n<p>You are building an array of all the images. That will use too much memory.</p>\n<p>It's working in test, because test only has one image.</p>\n<p>Substitute \"train\" data for \"test\" data and see where the problem is.</p>\n<p>-Rich</p>",
      "rawMarkdown": "Formatting makes your indenting not totally clear.\n\nEither you are getting a predication one image at a time so your result submission only has one image\n\nor\n\nYou are building an array of all the images. That will use too much memory.\n\nIt's working in test, because test only has one image.\n\nSubstitute \"train\" data for \"test\" data and see where the problem is.\n\n-Rich",
      "votes": null
    },
    {
      "id": "1088779",
      "postDate": "11/23/2020 23:58:15",
      "content": "<p>thank you! thing worked.<br>\nwhen i test image and load from directory they came in editor number wise like 1  2 3 4 ….. not by the order they are placed in folder.<br>\ni am curious that when organizer replace test folder with their own and generate csv is it possible that coloumn image_id of generated csv and the one they used to compare for scoring are change?</p>",
      "rawMarkdown": "thank you! thing worked.\nwhen i test image and load from directory they came in editor number wise like 1  2 3 4 ..... not by the order they are placed in folder.\ni am curious that when organizer replace test folder with their own and generate csv is it possible that coloumn image_id of generated csv and the one they used to compare for scoring are change?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1087886,
      "author_name": "mtalhaarshad",
      "author_url": "",
      "post_date": "11/23/2020 06:14:12",
      "content": "<p>code on my notebook. what can be the issue?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1088536,
      "author_name": "richardepstein",
      "author_url": "",
      "post_date": "11/23/2020 17:49:00",
      "content": "<p>Formatting makes your indenting not totally clear.</p>\n<p>Either you are getting a predication one image at a time so your result submission only has one image</p>\n<p>or</p>\n<p>You are building an array of all the images. That will use too much memory.</p>\n<p>It's working in test, because test only has one image.</p>\n<p>Substitute \"train\" data for \"test\" data and see where the problem is.</p>\n<p>-Rich</p>",
      "votes": null,
      "replies": [
        {
          "id": 1088779,
          "author_name": "mtalhaarshad",
          "author_url": "",
          "post_date": "11/23/2020 23:58:15",
          "content": "<p>thank you! thing worked.<br>\nwhen i test image and load from directory they came in editor number wise like 1  2 3 4 ….. not by the order they are placed in folder.<br>\ni am curious that when organizer replace test folder with their own and generate csv is it possible that coloumn image_id of generated csv and the one they used to compare for scoring are change?</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1087884": "import tensorflow as tf\nimport numpy as np\nimport os\nimport pandas as pd\nfrom keras.engine.saving import save_model\nfrom keras.preprocessing import image\nmodel=tf.keras.models.load_model('../input/training-den169/leaf1.h5')\nimport glob\ntest = os.listdir('/kaggle/input/cassava-leaf-disease-classification/test_images/')\nfor img in glob.glob(\"../input/cassava-leaf-disease-classification/test_images/*.jpg\"):\nimg_predicitions=image.load_img(img,target_size=(224,224,3))\nimg_predicition=image.img_to_array(img_predicitions)\nimg_predicition=np.expand_dims(img_predicition,axis=0)\n\n    result=model.predict_classes(img_predicition)\n\n    print(img, result)\n    submission = pd.DataFrame({'image_id': test, 'label': result})\n    submission.to_csv('submission.csv', index=False )\n    print(submission)",
    "1087886": "code on my notebook. what can be the issue?",
    "1088536": "Formatting makes your indenting not totally clear.\n\nEither you are getting a predication one image at a time so your result submission only has one image\n\nor\n\nYou are building an array of all the images. That will use too much memory.\n\nIt's working in test, because test only has one image.\n\nSubstitute \"train\" data for \"test\" data and see where the problem is.\n\n-Rich",
    "1088779": "thank you! thing worked.\nwhen i test image and load from directory they came in editor number wise like 1  2 3 4 ..... not by the order they are placed in folder.\ni am curious that when organizer replace test folder with their own and generate csv is it possible that coloumn image_id of generated csv and the one they used to compare for scoring are change?"
  },
  "source": "meta"
}