{
  "id": 461279,
  "title": "Rise 'Notebook Threw Exception'",
  "url": "/competitions/blood-vessel-segmentation/discussion/461279",
  "author_name": "xbxbxb",
  "post_date": "2023-12-13T14:20:24.730000",
  "votes": 1,
  "comment_count": 27,
  "views": 0,
  "content": "<p>Has anyone had this problem? 'Notebook Threw Exception', I've searched high and low but I can't seem to find anyone else experiencing the same problem as I am!<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F134d169d401752146f2fc40df58e22f6%2FD02E9C5C-48E1-4071-AED1-EA3A05A821A0.png?generation=1702477222861975&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": 2565832,
      "postDate": "2023-12-18T09:52:27.830Z",
      "content": "<p>Click on your failed submission name and select logs (not exps :)). It will show you where the exception happened.<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F349155%2F3541ae9f807d8d09757af67bcb978d66%2FKaggleLog.PNG?generation=1702893125876047&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Click on your failed submission name and select logs (not exps :)). It will show you where the exception happened.![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F349155%2F3541ae9f807d8d09757af67bcb978d66%2FKaggleLog.PNG?generation=1702893125876047&alt=media)\n",
      "votes": 1,
      "replies": [
        {
          "id": 2565871,
          "postDate": "2023-12-18T10:13:45.080Z",
          "content": "<p>i thought this log is only for dummy test data. there is no log for hidden test data</p>",
          "rawMarkdown": "i thought this log is only for dummy test data. there is no log for hidden test data",
          "votes": 2
        },
        {
          "id": 2565881,
          "postDate": "2023-12-18T10:21:09.673Z",
          "content": "<p>yeah, but my notebook has successed. I think I should check for other causes.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F78bd4f251b71504341cbd9c8c57249ae%2FB084EAEF-35B2-4bb4-8D00-A3AEA04F9DC3.png?generation=1702894867286228&amp;alt=media\" alt=\"\"></p>",
          "rawMarkdown": "yeah, but my notebook has successed. I think I should check for other causes.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F78bd4f251b71504341cbd9c8c57249ae%2FB084EAEF-35B2-4bb4-8D00-A3AEA04F9DC3.png?generation=1702894867286228&alt=media)"
        }
      ]
    },
    {
      "id": 2560366,
      "postDate": "2023-12-13T14:20:24.730Z",
      "content": "<p>Has anyone had this problem? 'Notebook Threw Exception', I've searched high and low but I can't seem to find anyone else experiencing the same problem as I am!<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F134d169d401752146f2fc40df58e22f6%2FD02E9C5C-48E1-4071-AED1-EA3A05A821A0.png?generation=1702477222861975&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Has anyone had this problem? 'Notebook Threw Exception', I've searched high and low but I can't seem to find anyone else experiencing the same problem as I am!\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F134d169d401752146f2fc40df58e22f6%2FD02E9C5C-48E1-4071-AED1-EA3A05A821A0.png?generation=1702477222861975&alt=media)",
      "votes": 1
    },
    {
      "id": 2570615,
      "postDate": "2023-12-22T12:06:45.897Z",
      "content": "<p>I finally got a legal submission.  It scored 0 (very primitive model) but it's a start.  It turned out that my code that converted between image filenames and ids depended on the slice number being 4 digits, left filled with 0s, which is correct for the train data and the dummy test set, but not necessarily for the actual hidden test set.  When I revised that code to accept slice numbers of different lengths it finally worked.  I still don't know for sure that that change fixed my code or something else in my mods was responsible.</p>",
      "rawMarkdown": "I finally got a legal submission.  It scored 0 (very primitive model) but it's a start.  It turned out that my code that converted between image filenames and ids depended on the slice number being 4 digits, left filled with 0s, which is correct for the train data and the dummy test set, but not necessarily for the actual hidden test set.  When I revised that code to accept slice numbers of different lengths it finally worked.  I still don't know for sure that that change fixed my code or something else in my mods was responsible.",
      "replies": [
        {
          "id": 2571228,
          "postDate": "2023-12-23T03:05:06.290Z",
          "content": "<p>Yes, with everyone's help, I also submitted a legal file. It scored 0.007, I tried removing small objects, I set min_size 30, then I tried 10, they all scored 0.007, but 10 seemed to take more time to calculate the score, but I'm not sure if 0.007 is the correct score for my model, I trained on kidney_1 and 3, verified with kidney_2,  I think the scored was 0.5, not sure if I'm doing it right, although the output doesn't look much like the corresponding label when I check the output in 3D format, but looking at some of the slices in isolation I can see that there are some nice results!</p>",
          "rawMarkdown": "Yes, with everyone's help, I also submitted a legal file. It scored 0.007, I tried removing small objects, I set min_size 30, then I tried 10, they all scored 0.007, but 10 seemed to take more time to calculate the score, but I'm not sure if 0.007 is the correct score for my model, I trained on kidney_1 and 3, verified with kidney_2,  I think the scored was 0.5, not sure if I'm doing it right, although the output doesn't look much like the corresponding label when I check the output in 3D format, but looking at some of the slices in isolation I can see that there are some nice results!"
        },
        {
          "id": 2571229,
          "postDate": "2023-12-23T03:10:50.790Z",
          "content": "<p>I'm not sure I'm understanding you correctly, but as I understand it, the id should be the 'kidney name + the four digits id' many people do in this format, and I do in this way get a higher score.</p>",
          "rawMarkdown": "I'm not sure I'm understanding you correctly, but as I understand it, the id should be the 'kidney name + the four digits id' many people do in this format, and I do in this way get a higher score."
        }
      ]
    },
    {
      "id": 2566167,
      "postDate": "2023-12-18T14:19:51.877Z",
      "content": "<p>Looking at your notebook link provided - you seem to be doing train and inference all in the one notebook. <br>\nWhen you submit, the notebook is run again in a separate environment with the test data replaced - so not necessarily kidney_5 and kidney_6.<br>\nTwo things could be a problem - <br>\n1) not sure all the train data is available in the separate environment - probably but if exception is very soon then maybe not<br>\n2) you have code specifically for test/kidney_5/images and test/kidney_6/images - <br>\n<code>cv2.imread('/kaggle/input/blood-vessel-segmentation/test/kidney_5/images/0000.tif')</code><br>\nthese test folders may not exist in the separate test environment. Quick fix may be to just comment these out.</p>\n<p>Also you can split your work into 2 notebooks - one for train and save your model checkpoints and another for inference and load the saved checkpoints for your model and put in code to cater for whether it is a submit rerun e.g. </p>\n<p><code>if os.getenv('KAGGLE_IS_COMPETITION_RERUN'):</code> </p>\n<p>The other possibility is out of memory OOM.  Since you are loading all of train and all of test, then 2 notebooks could help. </p>",
      "rawMarkdown": "Looking at your notebook link provided - you seem to be doing train and inference all in the one notebook. \nWhen you submit, the notebook is run again in a separate environment with the test data replaced - so not necessarily kidney_5 and kidney_6.\nTwo things could be a problem - \n1) not sure all the train data is available in the separate environment - probably but if exception is very soon then maybe not\n2) you have code specifically for test/kidney_5/images and test/kidney_6/images - \n`cv2.imread('/kaggle/input/blood-vessel-segmentation/test/kidney_5/images/0000.tif')`\nthese test folders may not exist in the separate test environment. Quick fix may be to just comment these out.\n\nAlso you can split your work into 2 notebooks - one for train and save your model checkpoints and another for inference and load the saved checkpoints for your model and put in code to cater for whether it is a submit rerun e.g. \n\n`if os.getenv('KAGGLE_IS_COMPETITION_RERUN'):` \n\nThe other possibility is out of memory OOM.  Since you are loading all of train and all of test, then 2 notebooks could help. \n",
      "replies": [
        {
          "id": 2566390,
          "postDate": "2023-12-18T17:53:38.777Z",
          "content": "<p>Hi. My case, I've send a dummy submission that predicts '1 0' for all the  samples in test/kidney_5 and test/kidney_6 and it worked. 0 score but submission succes. Is only when I use my own predictions when I don't stop getting:</p>\n<p>Submission Scoring Error<br>\nYour notebook generated a submission file with incorrect format. Some examples causing this are: wrong number of rows or columns, empty values, an incorrect data type for a value, or invalid submission values from what is expected.</p>\n<p>\"… or invalid submission values from what is expected.\" That's the last thing I can't check. Someone knows what submission values are spected? This may be an OOM when scoring cause too many FP? Thanks.</p>",
          "rawMarkdown": "Hi. My case, I've send a dummy submission that predicts '1 0' for all the  samples in test/kidney_5 and test/kidney_6 and it worked. 0 score but submission succes. Is only when I use my own predictions when I don't stop getting:\n\nSubmission Scoring Error\nYour notebook generated a submission file with incorrect format. Some examples causing this are: wrong number of rows or columns, empty values, an incorrect data type for a value, or invalid submission values from what is expected.\n\n\"... or invalid submission values from what is expected.\" That's the last thing I can't check. Someone knows what submission values are spected? This may be an OOM when scoring cause too many FP? Thanks.",
          "replies": [
            {
              "id": 2566538,
              "postDate": "2023-12-18T23:53:01.220Z",
              "content": "<p>Yeah, Thanks for the advice. I think it'll work.I'll try to change my code.</p>",
              "rawMarkdown": "Yeah, Thanks for the advice. I think it'll work.I'll try to change my code.",
              "votes": 1
            },
            {
              "id": 2566738,
              "postDate": "2023-12-19T05:45:58.610Z",
              "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> - there was a fix for scoring OOM in <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456761\" target=\"_blank\">Fixing the metric computation code</a> which seems to have resolved most issues <br>\nand a discussion on <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456033\" target=\"_blank\">Solving a lot of the Submission Scoring Errors</a> by removing small objects, not sure if this will help you.</p>\n<p>What you may want to do is run your inference code on whatever you are using for validation - e.g. kidney 1, 2 or 3 to create a submission (instead of test/kidney_5/6) and then use one of the public inference notebooks and do the same thing.  You can then compare how your submission looks to what another inference produces.   </p>",
              "rawMarkdown": "@sacuscreed - there was a fix for scoring OOM in [Fixing the metric computation code](https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456761) which seems to have resolved most issues \nand a discussion on [Solving a lot of the Submission Scoring Errors](https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456033) by removing small objects, not sure if this will help you.\n\nWhat you may want to do is run your inference code on whatever you are using for validation - e.g. kidney 1, 2 or 3 to create a submission (instead of test/kidney_5/6) and then use one of the public inference notebooks and do the same thing.  You can then compare how your submission looks to what another inference produces.   ",
              "votes": 1
            },
            {
              "id": 2568203,
              "postDate": "2023-12-20T10:27:31.187Z",
              "content": "<p>Thanks, already solved. I'm still thinking that my model was not good enough because I've only changed it when the scores started to work.</p>",
              "rawMarkdown": "Thanks, already solved. I'm still thinking that my model was not good enough because I've only changed it when the scores started to work.",
              "votes": 1
            },
            {
              "id": 2568885,
              "postDate": "2023-12-21T00:02:08.747Z",
              "content": "<p>I saw the notebook you published, and I solved the problem just the same, but did you get good results using the 2d method?</p>",
              "rawMarkdown": "I saw the notebook you published, and I solved the problem just the same, but did you get good results using the 2d method?"
            },
            {
              "id": 2569953,
              "postDate": "2023-12-21T17:50:49.080Z",
              "content": "<p>Yes, as I say there. Unkown tricks a part, I think that the data goes from n2 initially sparsed labels to n3 even more sparsed on 3D space. Toguether with the need of more memory, the 2D approach has acces to much more information while training. It's a 90% intuition argument, but I think that's the problem.</p>",
              "rawMarkdown": "Yes, as I say there. Unkown tricks a part, I think that the data goes from n2 initially sparsed labels to n3 even more sparsed on 3D space. Toguether with the need of more memory, the 2D approach has acces to much more information while training. It's a 90% intuition argument, but I think that's the problem."
            }
          ]
        }
      ]
    },
    {
      "id": 2560373,
      "postDate": "2023-12-13T14:29:54.173Z",
      "content": "<p>here's my notebook <a href=\"https://www.kaggle.com/code/athrunzala/2d-method/notebook\" target=\"_blank\">https://www.kaggle.com/code/athrunzala/2d-method/notebook</a></p>",
      "rawMarkdown": "here's my notebook https://www.kaggle.com/code/athrunzala/2d-method/notebook",
      "replies": [
        {
          "id": 2565346,
          "postDate": "2023-12-18T00:42:07.530Z",
          "content": "<p>I've just started submitting and have the same problem.  One question I have is whether 'Notebook Threw Exception' refers specifically to my notebook Python code, or whether it may also include errors encountered when Kaggle runs the metric calculation code.</p>",
          "rawMarkdown": "I've just started submitting and have the same problem.  One question I have is whether 'Notebook Threw Exception' refers specifically to my notebook Python code, or whether it may also include errors encountered when Kaggle runs the metric calculation code.",
          "votes": 1,
          "replies": [
            {
              "id": 2565406,
              "postDate": "2023-12-18T02:49:46.477Z",
              "content": "<p>\"…Kaggle runs the metric calculation code. …\"</p>\n<p>this will be notified as \"scoring error\" instead</p>",
              "rawMarkdown": "\"...Kaggle runs the metric calculation code. ...\"\n\nthis will be notified as \"scoring error\" instead",
              "votes": 2
            },
            {
              "id": 2565408,
              "postDate": "2023-12-18T02:53:41.953Z",
              "content": "<p>what you should do when doing code development:</p>\n<ol>\n<li>be ready to burn some gpu hours</li>\n<li>you should run your model on train images, about 1000 (for train kidney x) + 500 (for train another kidney x) </li>\n<li>optional: you can enlarge the input train images (e.g. by padding) e.g. 10% if when think the hidden test is at most 10 % larger. WARNING : remeber to disable this debug code in submit!!!!<br>\n4.monitor cpu, gpu  ram usage  (use the dashboard or code)</li>\n<li>make sure no memory leak, etc</li>\n<li>as a final step, put \"try\" \"except\" statment</li>\n</ol>\n<p>in summary, large large scale test in code development. not just the 3 test images.</p>",
              "rawMarkdown": "what you should do when doing code development:\n\n1. be ready to burn some gpu hours\n2. you should run your model on train images, about 1000 (for train kidney x) + 500 (for train another kidney x) \n3. optional: you can enlarge the input train images (e.g. by padding) e.g. 10% if when think the hidden test is at most 10 % larger. WARNING : remeber to disable this debug code in submit!!!!\n4.monitor cpu, gpu  ram usage  (use the dashboard or code)\n5. make sure no memory leak, etc\n6. as a final step, put \"try\" \"except\" statment\n\nin summary, large large scale test in code development. not just the 3 test images.",
              "votes": 2
            },
            {
              "id": 2565430,
              "postDate": "2023-12-18T04:10:57.577Z",
              "content": "<p>I don't quite understand what you mean by enlarging the images, do you mean that the test images might be more than just the ones in the folder? All I can see here is the 'Notebook Threw Exception' error, I can't tell if the cause of the error is my notebook or the notebook used for the test, it seems to take a long time for me to make a commit, it takes about one minute for him to do it, but I'm not sure if it's my notebook or the notebook I'm using for the test. He takes about an hour to make a commit. </p>",
              "rawMarkdown": "I don't quite understand what you mean by enlarging the images, do you mean that the test images might be more than just the ones in the folder? All I can see here is the 'Notebook Threw Exception' error, I can't tell if the cause of the error is my notebook or the notebook used for the test, it seems to take a long time for me to make a commit, it takes about one minute for him to do it, but I'm not sure if it's my notebook or the notebook I'm using for the test. He takes about an hour to make a commit. "
            },
            {
              "id": 2565433,
              "postDate": "2023-12-18T04:12:57.633Z",
              "content": "<p>And in the beginning, when I saved the csv file with pandas, I didn't set 'index=False', but it gave me a score of 0.002, and the time for commit was about 1 hour, which makes me wonder!</p>",
              "rawMarkdown": "And in the beginning, when I saved the csv file with pandas, I didn't set 'index=False', but it gave me a score of 0.002, and the time for commit was about 1 hour, which makes me wonder!"
            },
            {
              "id": 2565436,
              "postDate": "2023-12-18T04:16:52.767Z",
              "content": "<p>Thanks for the suggestions.  I am already testing my models on my own machine on a copy of all the train images (with kidneys renumbered), so far with no errors or anomalies detected, and no excessive memory use.  But I haven't yet tried enlarging or otherwise altering the images.</p>",
              "rawMarkdown": "Thanks for the suggestions.  I am already testing my models on my own machine on a copy of all the train images (with kidneys renumbered), so far with no errors or anomalies detected, and no excessive memory use.  But I haven't yet tried enlarging or otherwise altering the images.",
              "votes": 1
            },
            {
              "id": 2565437,
              "postDate": "2023-12-18T04:17:47.090Z",
              "content": "<p>Thanks, that is useful to know.</p>",
              "rawMarkdown": "Thanks, that is useful to know.",
              "votes": 1
            },
            {
              "id": 2565461,
              "postDate": "2023-12-18T04:34:12.653Z",
              "content": "<p>you cannot just test on local machine. the ram on kaggle notebook is much smaller. u only have 30 gb to play with</p>",
              "rawMarkdown": "you cannot just test on local machine. the ram on kaggle notebook is much smaller. u only have 30 gb to play with",
              "votes": 1
            },
            {
              "id": 2565524,
              "postDate": "2023-12-18T05:19:47.677Z",
              "content": "<p>Does my notebook run again when kaggle runs the test, is that why my notebook runs for an hour?</p>",
              "rawMarkdown": "Does my notebook run again when kaggle runs the test, is that why my notebook runs for an hour?"
            },
            {
              "id": 2565529,
              "postDate": "2023-12-18T05:33:40.507Z",
              "content": "<p>this is what happens after you click the submit buttom:</p>\n<ol>\n<li>a virtual machine is created</li>\n<li>the test image fold is replace with hidden test images (1500 of them)</li>\n<li>your notebook is run.</li>\n<li>server eval is run. it will read in a file called \"submission.csv\"</li>\n</ol>",
              "rawMarkdown": "this is what happens after you click the submit buttom:\n\n1. a virtual machine is created\n2. the test image fold is replace with hidden test images (1500 of them)\n3. your notebook is run.\n4. server eval is run. it will read in a file called \"submission.csv\"",
              "votes": 1
            },
            {
              "id": 2565541,
              "postDate": "2023-12-18T05:48:13.850Z",
              "content": "<p>Yes, now that I know that my own code is failing, not the scoring code (yet), I will run a big test in the online environment.</p>",
              "rawMarkdown": "Yes, now that I know that my own code is failing, not the scoring code (yet), I will run a big test in the online environment.",
              "votes": 1
            },
            {
              "id": 2565770,
              "postDate": "2023-12-18T09:33:54.413Z",
              "rawMarkdown": "",
              "isDeleted": true
            },
            {
              "id": 2565869,
              "postDate": "2023-12-18T10:13:24.187Z",
              "content": "<p>emmm… Language is a barrier😭  After your reminder, I understand the whole process of submission, I have been misunderstanding the content of the test set before, I thought there are only six images in the test set. Ah, that's why there's a 3D solution, thanks for your patience!</p>",
              "rawMarkdown": "emmm... Language is a barrier😭  After your reminder, I understand the whole process of submission, I have been misunderstanding the content of the test set before, I thought there are only six images in the test set. Ah, that's why there's a 3D solution, thanks for your patience!"
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2565832,
      "author_name": "DennisSakva",
      "author_url": "",
      "post_date": "2023-12-18T09:52:27.830000",
      "content": "<p>Click on your failed submission name and select logs (not exps :)). It will show you where the exception happened.<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F349155%2F3541ae9f807d8d09757af67bcb978d66%2FKaggleLog.PNG?generation=1702893125876047&amp;alt=media\" alt=\"\"></p>",
      "votes": 1,
      "replies": [
        {
          "id": 2565871,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2023-12-18T10:13:45.080000",
          "content": "<p>i thought this log is only for dummy test data. there is no log for hidden test data</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 2565881,
          "author_name": "xbxbxb",
          "author_url": "",
          "post_date": "2023-12-18T10:21:09.673000",
          "content": "<p>yeah, but my notebook has successed. I think I should check for other causes.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F78bd4f251b71504341cbd9c8c57249ae%2FB084EAEF-35B2-4bb4-8D00-A3AEA04F9DC3.png?generation=1702894867286228&amp;alt=media\" alt=\"\"></p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2570615,
      "author_name": "David J. Slate",
      "author_url": "",
      "post_date": "2023-12-22T12:06:45.897000",
      "content": "<p>I finally got a legal submission.  It scored 0 (very primitive model) but it's a start.  It turned out that my code that converted between image filenames and ids depended on the slice number being 4 digits, left filled with 0s, which is correct for the train data and the dummy test set, but not necessarily for the actual hidden test set.  When I revised that code to accept slice numbers of different lengths it finally worked.  I still don't know for sure that that change fixed my code or something else in my mods was responsible.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2571228,
          "author_name": "xbxbxb",
          "author_url": "",
          "post_date": "2023-12-23T03:05:06.290000",
          "content": "<p>Yes, with everyone's help, I also submitted a legal file. It scored 0.007, I tried removing small objects, I set min_size 30, then I tried 10, they all scored 0.007, but 10 seemed to take more time to calculate the score, but I'm not sure if 0.007 is the correct score for my model, I trained on kidney_1 and 3, verified with kidney_2,  I think the scored was 0.5, not sure if I'm doing it right, although the output doesn't look much like the corresponding label when I check the output in 3D format, but looking at some of the slices in isolation I can see that there are some nice results!</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2571229,
          "author_name": "xbxbxb",
          "author_url": "",
          "post_date": "2023-12-23T03:10:50.790000",
          "content": "<p>I'm not sure I'm understanding you correctly, but as I understand it, the id should be the 'kidney name + the four digits id' many people do in this format, and I do in this way get a higher score.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2566167,
      "author_name": "something4kag",
      "author_url": "",
      "post_date": "2023-12-18T14:19:51.877000",
      "content": "<p>Looking at your notebook link provided - you seem to be doing train and inference all in the one notebook. <br>\nWhen you submit, the notebook is run again in a separate environment with the test data replaced - so not necessarily kidney_5 and kidney_6.<br>\nTwo things could be a problem - <br>\n1) not sure all the train data is available in the separate environment - probably but if exception is very soon then maybe not<br>\n2) you have code specifically for test/kidney_5/images and test/kidney_6/images - <br>\n<code>cv2.imread('/kaggle/input/blood-vessel-segmentation/test/kidney_5/images/0000.tif')</code><br>\nthese test folders may not exist in the separate test environment. Quick fix may be to just comment these out.</p>\n<p>Also you can split your work into 2 notebooks - one for train and save your model checkpoints and another for inference and load the saved checkpoints for your model and put in code to cater for whether it is a submit rerun e.g. </p>\n<p><code>if os.getenv('KAGGLE_IS_COMPETITION_RERUN'):</code> </p>\n<p>The other possibility is out of memory OOM.  Since you are loading all of train and all of test, then 2 notebooks could help. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 2566390,
          "author_name": "Ángel Jacinto Sánchez Ruiz",
          "author_url": "",
          "post_date": "2023-12-18T17:53:38.777000",
          "content": "<p>Hi. My case, I've send a dummy submission that predicts '1 0' for all the  samples in test/kidney_5 and test/kidney_6 and it worked. 0 score but submission succes. Is only when I use my own predictions when I don't stop getting:</p>\n<p>Submission Scoring Error<br>\nYour notebook generated a submission file with incorrect format. Some examples causing this are: wrong number of rows or columns, empty values, an incorrect data type for a value, or invalid submission values from what is expected.</p>\n<p>\"… or invalid submission values from what is expected.\" That's the last thing I can't check. Someone knows what submission values are spected? This may be an OOM when scoring cause too many FP? Thanks.</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2566538,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-18T23:53:01.220000",
              "content": "<p>Yeah, Thanks for the advice. I think it'll work.I'll try to change my code.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2566738,
              "author_name": "something4kag",
              "author_url": "",
              "post_date": "2023-12-19T05:45:58.610000",
              "content": "<p><a href=\"https://www.kaggle.com/sacuscreed\" target=\"_blank\">@sacuscreed</a> - there was a fix for scoring OOM in <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456761\" target=\"_blank\">Fixing the metric computation code</a> which seems to have resolved most issues <br>\nand a discussion on <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456033\" target=\"_blank\">Solving a lot of the Submission Scoring Errors</a> by removing small objects, not sure if this will help you.</p>\n<p>What you may want to do is run your inference code on whatever you are using for validation - e.g. kidney 1, 2 or 3 to create a submission (instead of test/kidney_5/6) and then use one of the public inference notebooks and do the same thing.  You can then compare how your submission looks to what another inference produces.   </p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2568203,
              "author_name": "Ángel Jacinto Sánchez Ruiz",
              "author_url": "",
              "post_date": "2023-12-20T10:27:31.187000",
              "content": "<p>Thanks, already solved. I'm still thinking that my model was not good enough because I've only changed it when the scores started to work.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2568885,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-21T00:02:08.747000",
              "content": "<p>I saw the notebook you published, and I solved the problem just the same, but did you get good results using the 2d method?</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2569953,
              "author_name": "Ángel Jacinto Sánchez Ruiz",
              "author_url": "",
              "post_date": "2023-12-21T17:50:49.080000",
              "content": "<p>Yes, as I say there. Unkown tricks a part, I think that the data goes from n2 initially sparsed labels to n3 even more sparsed on 3D space. Toguether with the need of more memory, the 2D approach has acces to much more information while training. It's a 90% intuition argument, but I think that's the problem.</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2560373,
      "author_name": "xbxbxb",
      "author_url": "",
      "post_date": "2023-12-13T14:29:54.173000",
      "content": "<p>here's my notebook <a href=\"https://www.kaggle.com/code/athrunzala/2d-method/notebook\" target=\"_blank\">https://www.kaggle.com/code/athrunzala/2d-method/notebook</a></p>",
      "votes": 0,
      "replies": [
        {
          "id": 2565346,
          "author_name": "David J. Slate",
          "author_url": "",
          "post_date": "2023-12-18T00:42:07.530000",
          "content": "<p>I've just started submitting and have the same problem.  One question I have is whether 'Notebook Threw Exception' refers specifically to my notebook Python code, or whether it may also include errors encountered when Kaggle runs the metric calculation code.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2565406,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-18T02:49:46.477000",
              "content": "<p>\"…Kaggle runs the metric calculation code. …\"</p>\n<p>this will be notified as \"scoring error\" instead</p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 2565408,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-18T02:53:41.953000",
              "content": "<p>what you should do when doing code development:</p>\n<ol>\n<li>be ready to burn some gpu hours</li>\n<li>you should run your model on train images, about 1000 (for train kidney x) + 500 (for train another kidney x) </li>\n<li>optional: you can enlarge the input train images (e.g. by padding) e.g. 10% if when think the hidden test is at most 10 % larger. WARNING : remeber to disable this debug code in submit!!!!<br>\n4.monitor cpu, gpu  ram usage  (use the dashboard or code)</li>\n<li>make sure no memory leak, etc</li>\n<li>as a final step, put \"try\" \"except\" statment</li>\n</ol>\n<p>in summary, large large scale test in code development. not just the 3 test images.</p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 2565430,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-18T04:10:57.577000",
              "content": "<p>I don't quite understand what you mean by enlarging the images, do you mean that the test images might be more than just the ones in the folder? All I can see here is the 'Notebook Threw Exception' error, I can't tell if the cause of the error is my notebook or the notebook used for the test, it seems to take a long time for me to make a commit, it takes about one minute for him to do it, but I'm not sure if it's my notebook or the notebook I'm using for the test. He takes about an hour to make a commit. </p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2565433,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-18T04:12:57.633000",
              "content": "<p>And in the beginning, when I saved the csv file with pandas, I didn't set 'index=False', but it gave me a score of 0.002, and the time for commit was about 1 hour, which makes me wonder!</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2565436,
              "author_name": "David J. Slate",
              "author_url": "",
              "post_date": "2023-12-18T04:16:52.767000",
              "content": "<p>Thanks for the suggestions.  I am already testing my models on my own machine on a copy of all the train images (with kidneys renumbered), so far with no errors or anomalies detected, and no excessive memory use.  But I haven't yet tried enlarging or otherwise altering the images.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2565437,
              "author_name": "David J. Slate",
              "author_url": "",
              "post_date": "2023-12-18T04:17:47.090000",
              "content": "<p>Thanks, that is useful to know.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2565461,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-18T04:34:12.653000",
              "content": "<p>you cannot just test on local machine. the ram on kaggle notebook is much smaller. u only have 30 gb to play with</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2565524,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-18T05:19:47.677000",
              "content": "<p>Does my notebook run again when kaggle runs the test, is that why my notebook runs for an hour?</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2565529,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-18T05:33:40.507000",
              "content": "<p>this is what happens after you click the submit buttom:</p>\n<ol>\n<li>a virtual machine is created</li>\n<li>the test image fold is replace with hidden test images (1500 of them)</li>\n<li>your notebook is run.</li>\n<li>server eval is run. it will read in a file called \"submission.csv\"</li>\n</ol>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2565541,
              "author_name": "David J. Slate",
              "author_url": "",
              "post_date": "2023-12-18T05:48:13.850000",
              "content": "<p>Yes, now that I know that my own code is failing, not the scoring code (yet), I will run a big test in the online environment.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2565770,
              "author_name": "",
              "author_url": "",
              "post_date": "2023-12-18T09:33:54.413000",
              "content": "",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2565869,
              "author_name": "xbxbxb",
              "author_url": "",
              "post_date": "2023-12-18T10:13:24.187000",
              "content": "<p>emmm… Language is a barrier😭  After your reminder, I understand the whole process of submission, I have been misunderstanding the content of the test set before, I thought there are only six images in the test set. Ah, that's why there's a 3D solution, thanks for your patience!</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2565832": "Click on your failed submission name and select logs (not exps :)). It will show you where the exception happened.![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F349155%2F3541ae9f807d8d09757af67bcb978d66%2FKaggleLog.PNG?generation=1702893125876047&alt=media)\n",
    "2560366": "Has anyone had this problem? 'Notebook Threw Exception', I've searched high and low but I can't seem to find anyone else experiencing the same problem as I am!\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F13372717%2F134d169d401752146f2fc40df58e22f6%2FD02E9C5C-48E1-4071-AED1-EA3A05A821A0.png?generation=1702477222861975&alt=media)",
    "2570615": "I finally got a legal submission.  It scored 0 (very primitive model) but it's a start.  It turned out that my code that converted between image filenames and ids depended on the slice number being 4 digits, left filled with 0s, which is correct for the train data and the dummy test set, but not necessarily for the actual hidden test set.  When I revised that code to accept slice numbers of different lengths it finally worked.  I still don't know for sure that that change fixed my code or something else in my mods was responsible.",
    "2566167": "Looking at your notebook link provided - you seem to be doing train and inference all in the one notebook. \nWhen you submit, the notebook is run again in a separate environment with the test data replaced - so not necessarily kidney_5 and kidney_6.\nTwo things could be a problem - \n1) not sure all the train data is available in the separate environment - probably but if exception is very soon then maybe not\n2) you have code specifically for test/kidney_5/images and test/kidney_6/images - \n`cv2.imread('/kaggle/input/blood-vessel-segmentation/test/kidney_5/images/0000.tif')`\nthese test folders may not exist in the separate test environment. Quick fix may be to just comment these out.\n\nAlso you can split your work into 2 notebooks - one for train and save your model checkpoints and another for inference and load the saved checkpoints for your model and put in code to cater for whether it is a submit rerun e.g. \n\n`if os.getenv('KAGGLE_IS_COMPETITION_RERUN'):` \n\nThe other possibility is out of memory OOM.  Since you are loading all of train and all of test, then 2 notebooks could help. \n",
    "2560373": "here's my notebook https://www.kaggle.com/code/athrunzala/2d-method/notebook"
  }
}