{
  "id": 369757,
  "title": "Submission fails",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/369757",
  "author_name": "Vovinsa",
  "post_date": "2022-12-01T09:50:35.324000",
  "votes": 0,
  "comment_count": 10,
  "views": 0,
  "content": "<p>I start the submission notebook and have this error:<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F2f912cd8a99e22076246349aacc2d7b2%2FScreenshot%202022-12-01%20at%2012.48.10.png?generation=1669888150288667&amp;alt=media\" alt=\"\"><br>\nMy submission code: <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F83c75e824d3067fd2397f3573a13a61f%2FScreenshot%202022-12-01%20at%2012.50.17.png?generation=1669888232611542&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": 2051322,
      "postDate": "2022-12-01T10:41:17.803Z",
      "content": "<p>I took my notebook private while I was trying to figure it out but I see that you already started to use my code.</p>\n<p>I believe I have figured this out and will share the fix with the next iteration of the notebook.</p>",
      "rawMarkdown": "I took my notebook private while I was trying to figure it out but I see that you already started to use my code.\n\nI believe I have figured this out and will share the fix with the next iteration of the notebook.",
      "votes": 1,
      "replies": [
        {
          "id": 2051329,
          "postDate": "2022-12-01T10:46:11.413Z",
          "content": "<p>Yes, I've tried to use your code for submission part. Thanks for help, I'll check your notebook later!</p>",
          "rawMarkdown": "Yes, I've tried to use your code for submission part. Thanks for help, I'll check your notebook later!\n"
        }
      ]
    },
    {
      "id": 2052224,
      "postDate": "2022-12-02T02:52:26.203Z",
      "content": "<p>I am facing this same issue of \"threw exception\". Any solution?</p>",
      "rawMarkdown": "I am facing this same issue of \"threw exception\". Any solution?",
      "replies": [
        {
          "id": 2052226,
          "postDate": "2022-12-02T02:57:38.457Z",
          "content": "<p>It will depend on your situation. Essentially, you need to think of scenarios where your code runs on the four images in the local test set but might explode when running on the true competition test set which is much larger.</p>\n<p>In my case (where the code above was copied from) there were images in the test set my code couldn't parse. I got lucky (or \"unlucky\") on the four images in the local test set as my code could parse them, but then in test an error was being thrown.</p>\n<p>But there can be many other reasons for this happening. Maybe you are infering with too big of a batch size and getting an out of memory error? The set of things that could be going wrong is really infinite and you have to analyze the situation in the context of your particular code.</p>",
          "rawMarkdown": "It will depend on your situation. Essentially, you need to think of scenarios where your code runs on the four images in the local test set but might explode when running on the true competition test set which is much larger.\n\nIn my case (where the code above was copied from) there were images in the test set my code couldn't parse. I got lucky (or \"unlucky\") on the four images in the local test set as my code could parse them, but then in test an error was being thrown.\n\nBut there can be many other reasons for this happening. Maybe you are infering with too big of a batch size and getting an out of memory error? The set of things that could be going wrong is really infinite and you have to analyze the situation in the context of your particular code.",
          "votes": 2
        },
        {
          "id": 2052229,
          "postDate": "2022-12-02T03:03:05.650Z",
          "content": "<p>Okay, thank you. I will try to check for parsing errors or maybe add a limit on file size to read? Idk, why no one has opened a discussion over it (if they have faced &amp; fixed the issue). </p>",
          "rawMarkdown": "Okay, thank you. I will try to check for parsing errors or maybe add a limit on file size to read? Idk, why no one has opened a discussion over it (if they have faced & fixed the issue). ",
          "votes": 1
        },
        {
          "id": 2052234,
          "postDate": "2022-12-02T03:08:05.267Z",
          "content": "<p>Because it all depends on the code that you are using, the error is very generic. You might get the error for many reasons, depending on the code that you are using.</p>\n<p>Are you getting this error with the code above? If so, I hope to have a working version available very soon, just testing it now whether it works.</p>",
          "rawMarkdown": "Because it all depends on the code that you are using, the error is very generic. You might get the error for many reasons, depending on the code that you are using.\n\nAre you getting this error with the code above? If so, I hope to have a working version available very soon, just testing it now whether it works.",
          "votes": 1
        },
        {
          "id": 2052253,
          "postDate": "2022-12-02T03:32:08.750Z",
          "content": "<p>No, I have my own code. </p>\n<p>I am doing like this </p>\n<pre><code>test_csv = pd.read_csv()\nog_sub = pd.read_csv().head()\ntestfiles = glob.glob()\n\n fpath  tqdm(testfiles):\n    fsplits = fpath.split()\n    patient_id = fsplits[-]\n    image_id = fsplits[-].split()[]\n    npath = \n    prediction_id = (test_csv.loc[test_csv.image_id == (image_id)].prediction_id.values[]).strip()\n    predictions = \n    :\n         read &amp; predict files      \n    :\n         \n\n\n     newdf = pd.DataFrame([[prediction_id, predictions]], columns=[,])\n     g_sub = pd.concat([newdf, og_sub])\n\n     KeyboardInterrupt:\n        \n\n     Exception  e:\n        (e)\n        \n\n    :\n        :\n            os.remove(npath)\n        :\n            \n\nog_sub = og_sub.groupby().mean()  \nog_sub = og_sub.sort_index()\nog_sub.to_csv(, index=)\n</code></pre>",
          "rawMarkdown": "No, I have my own code. \n\nI am doing like this \n\n```python\ntest_csv = pd.read_csv(\"/kaggle/input/rsna-breast-cancer-detection/test.csv\")\nog_sub = pd.read_csv(\"/kaggle/input/rsna-breast-cancer-detection/sample_submission.csv\").head(0)\ntestfiles = glob.glob(\"/kaggle/input/rsna-breast-cancer-detection/test_images/*/*.dcm\")\n\nfor fpath in tqdm(testfiles):\n    fsplits = fpath.split('/')\n    patient_id = fsplits[-2]\n    image_id = fsplits[-1].split('.')[0]\n    npath = f\"./tmp.jpg\"\n    prediction_id = str(test_csv.loc[test_csv.image_id == int(image_id)].prediction_id.values[0]).strip()\n    predictions = 0.00\n    try:\n         read & predict files      \n    except:\n         pass\n\n    \n     newdf = pd.DataFrame([[prediction_id, predictions]], columns=['prediction_id','cancer'])\n     g_sub = pd.concat([newdf, og_sub])\n         \n    except KeyboardInterrupt:\n        break\n\n    except Exception as e:\n        print(e)\n        pass\n    \n    finally:\n        try:\n            os.remove(npath)\n        except:\n            pass\n\nog_sub = og_sub.groupby('prediction_id').mean()  #dummy aggregation method\nog_sub = og_sub.sort_index()\nog_sub.to_csv(\"submission.csv\", index=True)\n   \n```"
        },
        {
          "id": 2052258,
          "postDate": "2022-12-02T03:33:39.613Z",
          "content": "<p>I have also just added a new check in my \"read part\". To ignore files above 1.30GB</p>\n<pre><code> ():\n\n\n    max_sz = ** \n\n    :\n        sz = os.path.getsize(filepath)\n    :\n        sz = max_sz + \n\n     (sz &gt; max_sz):\n         \n\n     \n</code></pre>",
          "rawMarkdown": "I have also just added a new check in my \"read part\". To ignore files above 1.30GB\n\n```python\ndef is_huge_fsize(filepath):\n#     max_sz = 1180**3 # 1.53gb\n#     max_sz = 1090**3 # 1.20gb\n    max_sz = 1122**3 # 1.30gb\n#     max_sz = 1147**3 # 1.40gb\n    try:\n        sz = os.path.getsize(filepath)\n    except:\n        sz = max_sz + 1\n        \n    if (sz > max_sz):\n        return True\n    \n    return False\n\n```"
        },
        {
          "id": 2052469,
          "postDate": "2022-12-02T08:14:59.153Z",
          "content": "<p>I am using other notebook, where I just load weights of my model (I don't train) and test it on a test part, and create submission, and it fails. I can make my submission notebook public, and u could check it</p>",
          "rawMarkdown": "I am using other notebook, where I just load weights of my model (I don't train) and test it on a test part, and create submission, and it fails. I can make my submission notebook public, and u could check it"
        },
        {
          "id": 2052833,
          "postDate": "2022-12-02T14:43:25.997Z",
          "content": "<p>Now, I am getting \"notebook timeout\" :( </p>",
          "rawMarkdown": "Now, I am getting \"notebook timeout\" :( "
        }
      ]
    },
    {
      "id": 2051253,
      "postDate": "2022-12-01T09:50:35.323Z",
      "content": "<p>I start the submission notebook and have this error:<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F2f912cd8a99e22076246349aacc2d7b2%2FScreenshot%202022-12-01%20at%2012.48.10.png?generation=1669888150288667&amp;alt=media\" alt=\"\"><br>\nMy submission code: <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F83c75e824d3067fd2397f3573a13a61f%2FScreenshot%202022-12-01%20at%2012.50.17.png?generation=1669888232611542&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "I start the submission notebook and have this error:![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F2f912cd8a99e22076246349aacc2d7b2%2FScreenshot%202022-12-01%20at%2012.48.10.png?generation=1669888150288667&alt=media)\nMy submission code: ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F83c75e824d3067fd2397f3573a13a61f%2FScreenshot%202022-12-01%20at%2012.50.17.png?generation=1669888232611542&alt=media)"
    }
  ],
  "comments": [
    {
      "id": 2051322,
      "author_name": "Radek Osmulski",
      "author_url": "",
      "post_date": "2022-12-01T10:41:17.803000",
      "content": "<p>I took my notebook private while I was trying to figure it out but I see that you already started to use my code.</p>\n<p>I believe I have figured this out and will share the fix with the next iteration of the notebook.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2051329,
          "author_name": "Vovinsa",
          "author_url": "",
          "post_date": "2022-12-01T10:46:11.413000",
          "content": "<p>Yes, I've tried to use your code for submission part. Thanks for help, I'll check your notebook later!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2052224,
      "author_name": "Hey24sheep",
      "author_url": "",
      "post_date": "2022-12-02T02:52:26.203000",
      "content": "<p>I am facing this same issue of \"threw exception\". Any solution?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2052226,
          "author_name": "Radek Osmulski",
          "author_url": "",
          "post_date": "2022-12-02T02:57:38.457000",
          "content": "<p>It will depend on your situation. Essentially, you need to think of scenarios where your code runs on the four images in the local test set but might explode when running on the true competition test set which is much larger.</p>\n<p>In my case (where the code above was copied from) there were images in the test set my code couldn't parse. I got lucky (or \"unlucky\") on the four images in the local test set as my code could parse them, but then in test an error was being thrown.</p>\n<p>But there can be many other reasons for this happening. Maybe you are infering with too big of a batch size and getting an out of memory error? The set of things that could be going wrong is really infinite and you have to analyze the situation in the context of your particular code.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 2052229,
          "author_name": "Hey24sheep",
          "author_url": "",
          "post_date": "2022-12-02T03:03:05.650000",
          "content": "<p>Okay, thank you. I will try to check for parsing errors or maybe add a limit on file size to read? Idk, why no one has opened a discussion over it (if they have faced &amp; fixed the issue). </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 2052234,
          "author_name": "Radek Osmulski",
          "author_url": "",
          "post_date": "2022-12-02T03:08:05.267000",
          "content": "<p>Because it all depends on the code that you are using, the error is very generic. You might get the error for many reasons, depending on the code that you are using.</p>\n<p>Are you getting this error with the code above? If so, I hope to have a working version available very soon, just testing it now whether it works.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 2052253,
          "author_name": "Hey24sheep",
          "author_url": "",
          "post_date": "2022-12-02T03:32:08.750000",
          "content": "<p>No, I have my own code. </p>\n<p>I am doing like this </p>\n<pre><code>test_csv = pd.read_csv()\nog_sub = pd.read_csv().head()\ntestfiles = glob.glob()\n\n fpath  tqdm(testfiles):\n    fsplits = fpath.split()\n    patient_id = fsplits[-]\n    image_id = fsplits[-].split()[]\n    npath = \n    prediction_id = (test_csv.loc[test_csv.image_id == (image_id)].prediction_id.values[]).strip()\n    predictions = \n    :\n         read &amp; predict files      \n    :\n         \n\n\n     newdf = pd.DataFrame([[prediction_id, predictions]], columns=[,])\n     g_sub = pd.concat([newdf, og_sub])\n\n     KeyboardInterrupt:\n        \n\n     Exception  e:\n        (e)\n        \n\n    :\n        :\n            os.remove(npath)\n        :\n            \n\nog_sub = og_sub.groupby().mean()  \nog_sub = og_sub.sort_index()\nog_sub.to_csv(, index=)\n</code></pre>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2052258,
          "author_name": "Hey24sheep",
          "author_url": "",
          "post_date": "2022-12-02T03:33:39.613000",
          "content": "<p>I have also just added a new check in my \"read part\". To ignore files above 1.30GB</p>\n<pre><code> ():\n\n\n    max_sz = ** \n\n    :\n        sz = os.path.getsize(filepath)\n    :\n        sz = max_sz + \n\n     (sz &gt; max_sz):\n         \n\n     \n</code></pre>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2052469,
          "author_name": "Vovinsa",
          "author_url": "",
          "post_date": "2022-12-02T08:14:59.153000",
          "content": "<p>I am using other notebook, where I just load weights of my model (I don't train) and test it on a test part, and create submission, and it fails. I can make my submission notebook public, and u could check it</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2052833,
          "author_name": "Hey24sheep",
          "author_url": "",
          "post_date": "2022-12-02T14:43:25.997000",
          "content": "<p>Now, I am getting \"notebook timeout\" :( </p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2051322": "I took my notebook private while I was trying to figure it out but I see that you already started to use my code.\n\nI believe I have figured this out and will share the fix with the next iteration of the notebook.",
    "2052224": "I am facing this same issue of \"threw exception\". Any solution?",
    "2051253": "I start the submission notebook and have this error:![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F2f912cd8a99e22076246349aacc2d7b2%2FScreenshot%202022-12-01%20at%2012.48.10.png?generation=1669888150288667&alt=media)\nMy submission code: ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5014620%2F83c75e824d3067fd2397f3573a13a61f%2FScreenshot%202022-12-01%20at%2012.50.17.png?generation=1669888232611542&alt=media)"
  }
}