{
  "id": 200889,
  "title": "Submission CSV Not Found",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/200889",
  "author_name": "Áron Széles",
  "post_date": "2020-12-02T09:54:44.391000",
  "votes": 1,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I keep getting the csv not found error when submitting the sample submission. <br>\nThis is what I wrote:</p>\n<pre><code>df = pd.read_csv('../input/cassava-leaf-disease-classification/sample_submission.csv')\ndf[\"label\"] = [3]\ndf.to_csv(\"submission.csv\", index=False)\n</code></pre>\n<p>I am in the working directory and I can see my submission.csv file. What am I doing wrong?</p>",
  "messages": [
    {
      "id": 1099359,
      "postDate": "2020-12-02T09:54:44.390Z",
      "content": "<p>I keep getting the csv not found error when submitting the sample submission. <br>\nThis is what I wrote:</p>\n<pre><code>df = pd.read_csv('../input/cassava-leaf-disease-classification/sample_submission.csv')\ndf[\"label\"] = [3]\ndf.to_csv(\"submission.csv\", index=False)\n</code></pre>\n<p>I am in the working directory and I can see my submission.csv file. What am I doing wrong?</p>",
      "rawMarkdown": "I keep getting the csv not found error when submitting the sample submission. \nThis is what I wrote:\n```\ndf = pd.read_csv('../input/cassava-leaf-disease-classification/sample_submission.csv')\ndf[\"label\"] = [3]\ndf.to_csv(\"submission.csv\", index=False)\n```\n\nI am in the working directory and I can see my submission.csv file. What am I doing wrong?",
      "votes": 1
    },
    {
      "id": 1112312,
      "postDate": "2020-12-14T13:19:36.227Z",
      "content": "<p>Be careful about using pandas to read in <code>sample_submission.csv</code>. Because such file one contains 1 image while the test dataset may have much more images… So your error should result from the huge gap of num of test images.</p>",
      "rawMarkdown": "Be careful about using pandas to read in `sample_submission.csv`. Because such file one contains 1 image while the test dataset may have much more images... So your error should result from the huge gap of num of test images."
    },
    {
      "id": 1099391,
      "postDate": "2020-12-02T10:32:16.680Z",
      "content": "<p>Don't know much about your code at point but do one thing. put about 20 images in your test set and check whether it form submission.csv file of all those images or not! if not you have to change your submission code to make it so</p>",
      "rawMarkdown": "Don't know much about your code at point but do one thing. put about 20 images in your test set and check whether it form submission.csv file of all those images or not! if not you have to change your submission code to make it so",
      "replies": [
        {
          "id": 1099431,
          "postDate": "2020-12-02T10:58:48.260Z",
          "content": "<p>I started yesterday so I basically have no code I'm just trying to run the sample submission. Which I assume should work but it doesn't, hence my question.</p>",
          "rawMarkdown": "I started yesterday so I basically have no code I'm just trying to run the sample submission. Which I assume should work but it doesn't, hence my question."
        },
        {
          "id": 1099479,
          "postDate": "2020-12-02T11:50:49.327Z",
          "content": "<p>Actually the thing is when you submit this, they replace your test file path with their own i guess and their file contain thousands of images. when they run it didn't generate required submission files,<br>\ni am pasting my code here, try to understand it that how actually submission are doing. if you didn't understand something reply here i will try to answer it.</p>\n<h2>importing librarie</h2>\n<p>from keras.preprocessing import image<br>\nimport os</p>\n<h2>load your trained model here</h2>\n<p>model = tf.keras.models.load_model('../input/your model directory', compile=False)<br>\nimport matplotlib.pyplot as plt<br>\nimport glob<br>\nimport cv2 as cv</p>\n<h2>giving path of test image directory</h2>\n<p>path=\"../input/cassava-leaf-disease-classification/test_images\"<br>\narray=[]<br>\nfor filename in os.listdir(path+'/'):<br>\n    img=(path+'/'+filename)<br>\n    img_predicitions = image.load_img(img, target_size=(300,300, 3))<br>\n    img_predicition = image.img_to_array(img_predicitions)<br>\n    img_predicition = np.expand_dims(img_predicition, axis=0)<br>\n    result = model.predict_classes(img_predicition)<br>\n    print(filename)<br>\n    array.append([filename,int(result)])<br>\ndf = pd.DataFrame(array, columns =['image_id', 'label'])<br>\nprint(df)<br>\ndf.to_csv(\"submission.csv\", sep=',', index=False)</p>",
          "rawMarkdown": "Actually the thing is when you submit this, they replace your test file path with their own i guess and their file contain thousands of images. when they run it didn't generate required submission files,\ni am pasting my code here, try to understand it that how actually submission are doing. if you didn't understand something reply here i will try to answer it.\n##importing librarie\n\nfrom keras.preprocessing import image\nimport os\n\n##load your trained model here\n\nmodel = tf.keras.models.load_model('../input/your model directory', compile=False)\nimport matplotlib.pyplot as plt\nimport glob\nimport cv2 as cv\n\n##giving path of test image directory\n\npath=\"../input/cassava-leaf-disease-classification/test_images\"\narray=[]\nfor filename in os.listdir(path+'/'):\n    img=(path+'/'+filename)\n    img_predicitions = image.load_img(img, target_size=(300,300, 3))\n    img_predicition = image.img_to_array(img_predicitions)\n    img_predicition = np.expand_dims(img_predicition, axis=0)\n    result = model.predict_classes(img_predicition)\n    print(filename)\n    array.append([filename,int(result)])\ndf = pd.DataFrame(array, columns =['image_id', 'label'])\nprint(df)\ndf.to_csv(\"submission.csv\", sep=',', index=False)\n\n",
          "votes": 1
        }
      ]
    },
    {
      "id": 1099456,
      "postDate": "2020-12-02T11:31:43.383Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 1099462,
          "postDate": "2020-12-02T11:40:04.140Z",
          "content": "<p>That's fine, I can also see my submission.csv when doing %ls</p>",
          "rawMarkdown": "That's fine, I can also see my submission.csv when doing %ls"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1112312,
      "author_name": "豆柴金鯱",
      "author_url": "",
      "post_date": "2020-12-14T13:19:36.227000",
      "content": "<p>Be careful about using pandas to read in <code>sample_submission.csv</code>. Because such file one contains 1 image while the test dataset may have much more images… So your error should result from the huge gap of num of test images.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1099391,
      "author_name": "M.Talha Arshad",
      "author_url": "",
      "post_date": "2020-12-02T10:32:16.680000",
      "content": "<p>Don't know much about your code at point but do one thing. put about 20 images in your test set and check whether it form submission.csv file of all those images or not! if not you have to change your submission code to make it so</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1099431,
          "author_name": "Áron Széles",
          "author_url": "",
          "post_date": "2020-12-02T10:58:48.260000",
          "content": "<p>I started yesterday so I basically have no code I'm just trying to run the sample submission. Which I assume should work but it doesn't, hence my question.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1099479,
          "author_name": "M.Talha Arshad",
          "author_url": "",
          "post_date": "2020-12-02T11:50:49.327000",
          "content": "<p>Actually the thing is when you submit this, they replace your test file path with their own i guess and their file contain thousands of images. when they run it didn't generate required submission files,<br>\ni am pasting my code here, try to understand it that how actually submission are doing. if you didn't understand something reply here i will try to answer it.</p>\n<h2>importing librarie</h2>\n<p>from keras.preprocessing import image<br>\nimport os</p>\n<h2>load your trained model here</h2>\n<p>model = tf.keras.models.load_model('../input/your model directory', compile=False)<br>\nimport matplotlib.pyplot as plt<br>\nimport glob<br>\nimport cv2 as cv</p>\n<h2>giving path of test image directory</h2>\n<p>path=\"../input/cassava-leaf-disease-classification/test_images\"<br>\narray=[]<br>\nfor filename in os.listdir(path+'/'):<br>\n    img=(path+'/'+filename)<br>\n    img_predicitions = image.load_img(img, target_size=(300,300, 3))<br>\n    img_predicition = image.img_to_array(img_predicitions)<br>\n    img_predicition = np.expand_dims(img_predicition, axis=0)<br>\n    result = model.predict_classes(img_predicition)<br>\n    print(filename)<br>\n    array.append([filename,int(result)])<br>\ndf = pd.DataFrame(array, columns =['image_id', 'label'])<br>\nprint(df)<br>\ndf.to_csv(\"submission.csv\", sep=',', index=False)</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1099456,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-12-02T11:31:43.383000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 1099462,
          "author_name": "Áron Széles",
          "author_url": "",
          "post_date": "2020-12-02T11:40:04.140000",
          "content": "<p>That's fine, I can also see my submission.csv when doing %ls</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1099359": "I keep getting the csv not found error when submitting the sample submission. \nThis is what I wrote:\n```\ndf = pd.read_csv('../input/cassava-leaf-disease-classification/sample_submission.csv')\ndf[\"label\"] = [3]\ndf.to_csv(\"submission.csv\", index=False)\n```\n\nI am in the working directory and I can see my submission.csv file. What am I doing wrong?",
    "1112312": "Be careful about using pandas to read in `sample_submission.csv`. Because such file one contains 1 image while the test dataset may have much more images... So your error should result from the huge gap of num of test images.",
    "1099391": "Don't know much about your code at point but do one thing. put about 20 images in your test set and check whether it form submission.csv file of all those images or not! if not you have to change your submission code to make it so",
    "1099456": ""
  }
}