{
  "id": 509623,
  "title": "pytorch Notebook threw exception error",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/509623",
  "author_name": "",
  "post_date": "2024-06-03T07:50:34.925374800Z",
  "votes": 1,
  "comment_count": 8,
  "views": 0,
  "content": "<p>I created a CNN model with pytorch and submitted it, but I get the error \"Notebook threw exception.\"<br>\nI would like to refer to the code of other participants, but I cannot find any notebooks that other participants have successfully submitted using test_images, so I am in a hopeless situation.<br>\nCan you give me some hints on how to solve this?</p>",
  "messages": [
    {
      "id": "2852305",
      "postDate": "06/03/2024 07:50:34",
      "content": "<p>I created a CNN model with pytorch and submitted it, but I get the error \"Notebook threw exception.\"<br>\nI would like to refer to the code of other participants, but I cannot find any notebooks that other participants have successfully submitted using test_images, so I am in a hopeless situation.<br>\nCan you give me some hints on how to solve this?</p>",
      "rawMarkdown": "I created a CNN model with pytorch and submitted it, but I get the error \"Notebook threw exception.\"\nI would like to refer to the code of other participants, but I cannot find any notebooks that other participants have successfully submitted using test_images, so I am in a hopeless situation.\nCan you give me some hints on how to solve this?",
      "votes": null
    },
    {
      "id": "2854465",
      "postDate": "06/04/2024 10:33:58",
      "content": "<p>I think you can submit it for the time being by using this code.</p>\n<pre><code> = pd.read_csv()\n[]=[int(i.()[0])  i  [].values]\nsample_study_id = [].unique()\n = pd.read_csv()\n = [[]==].reset_index(=True)\ntest_stusy = [].unique()\n = .groupby()[].first().reset_index()\n\ntest_preds = inf_func(model, ) #model's output:25*3 cls\n\nnew_df = pd.DataFrame()\ntra_df = (pd.read_csv().columns[1:])\n\ncol = []\n i  test_stusy:\n     j  tra_df:\n        col.(f)\n\nnew_df[]=col\nnew_df[] = new_df[].astype()\nnew_df[]=0\nnew_df[]=0\nnew_df[]=0\nnew_df[[,,]]=test_preds.(-1,3)\n\n\nwithout = (sample_study_id)-(test_stusy)\n = pd.DataFrame()\n\n len(without)&gt;0:\n    col = []\n     i  without:\n         j  tra_df:\n            col.(f)\n\n    []=col\n    [] = [].astype()\n    []=0.34\n    []=0.33\n    []=0.33\n    ()\n    new_df = pd.concat([new_df,],axis=0).sort_values().reset_index(=True)\n    new_df\nnew_df.to_csv(,index=False)\n</code></pre>",
      "rawMarkdown": "I think you can submit it for the time being by using this code.\n\n```\nsample = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/sample_submission.csv\")\nsample[\"study_id\"]=[int(i.split(\"_\")[0]) for i in sample[\"row_id\"].values]\nsample_study_id = sample[\"study_id\"].unique()\ntest = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/test_series_descriptions.csv\")\ntest = test[test[\"series_description\"]==\"Axial T2\"].reset_index(drop=True)\ntest_stusy = test[\"study_id\"].unique()\ntest = test.groupby(\"study_id\")[\"series_id\"].first().reset_index()\n\ntest_preds = inf_func(model, test) #model's output:25*3 cls\n\nnew_df = pd.DataFrame()\ntra_df = list(pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/train.csv\").columns[1:])\n\ncol = []\nfor i in test_stusy:\n    for j in tra_df:\n        col.append(f\"{i}_{j}\")\n        \nnew_df[\"row_id\"]=col\nnew_df[\"row_id\"] = new_df[\"row_id\"].astype(\"str\")\nnew_df[\"normal_mild\"]=0\nnew_df[\"moderate\"]=0\nnew_df[\"severe\"]=0\nnew_df[[\"normal_mild\",\"moderate\",\"severe\"]]=test_preds.reshape(-1,3)\n\n\nwithout = set(sample_study_id)-set(test_stusy)\nsample = pd.DataFrame()\n\nif len(without)>0:\n    col = []\n    for i in without:\n        for j in tra_df:\n            col.append(f\"{i}_{j}\")\n\n    sample[\"row_id\"]=col\n    sample[\"row_id\"] = sample[\"row_id\"].astype(\"str\")\n    sample[\"normal_mild\"]=0.34\n    sample[\"moderate\"]=0.33\n    sample[\"severe\"]=0.33\n    print(sample)\n    new_df = pd.concat([new_df,sample],axis=0).sort_values(\"row_id\").reset_index(drop=True)\n    new_df\nnew_df.to_csv(\"submission.csv\",index=False)\n```",
      "votes": null
    },
    {
      "id": "2857985",
      "postDate": "06/06/2024 08:08:49",
      "content": "<p>Have you tried testing your inference pipeline with some examples from the training set, this way you can check how it performs with different study_id </p>",
      "rawMarkdown": "Have you tried testing your inference pipeline with some examples from the training set, this way you can check how it performs with different study_id",
      "votes": null
    },
    {
      "id": "2859259",
      "postDate": "06/06/2024 22:26:48",
      "content": "<p>I have the same error before, then I try to make a similar submission on trainingset, Inoticed that it is not always have full {instance_number}.dcm in every series, like <code>7.dcm</code>,  <code>9.dcm</code>,  <code>10.dcm</code>… It miss  <code>8.dcm</code>, when I fix this, I can get a valid submission.</p>",
      "rawMarkdown": "I have the same error before, then I try to make a similar submission on trainingset, Inoticed that it is not always have full {instance_number}.dcm in every series, like `7.dcm`,  `9.dcm`,  `10.dcm`... It miss  `8.dcm`, when I fix this, I can get a valid submission.",
      "votes": null
    },
    {
      "id": "2859436",
      "postDate": "06/07/2024 03:28:07",
      "content": "<p>There is a starter notebook for PyTorch which is currently working: <a href=\"https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook\" target=\"_blank\">https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook</a><br>\nYou can compare and see if it fits your code.</p>",
      "rawMarkdown": "There is a starter notebook for PyTorch which is currently working: https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook\nYou can compare and see if it fits your code.",
      "votes": null
    },
    {
      "id": "2859548",
      "postDate": "06/07/2024 05:15:19",
      "content": "<p><a href=\"https://www.kaggle.com/coderrkj\" target=\"_blank\">@coderrkj</a> Thank you for letting me know! I'll give it a try🥳</p>",
      "rawMarkdown": "coderrkj Thank you for letting me know! I'll give it a try🥳",
      "votes": null
    },
    {
      "id": "2859552",
      "postDate": "06/07/2024 05:17:10",
      "content": "<p>I see, thank you!<br>\nHowever, I use 'glob' to get all the dcm images, so that method doesn't seem to work.😭</p>",
      "rawMarkdown": "I see, thank you!\nHowever, I use 'glob' to get all the dcm images, so that method doesn't seem to work.😭",
      "votes": null
    },
    {
      "id": "2859554",
      "postDate": "06/07/2024 05:18:26",
      "content": "<p><a href=\"https://www.kaggle.com/patriot\" target=\"_blank\">@patriot</a> Thanks for the sample code! I'll give it a try.</p>",
      "rawMarkdown": "patriot Thanks for the sample code! I'll give it a try.",
      "votes": null
    },
    {
      "id": "2893568",
      "postDate": "06/27/2024 21:51:43",
      "content": "<p>Were you able to identify what was causing the error? I'm facing the same problem…</p>",
      "rawMarkdown": "Were you able to identify what was causing the error? I'm facing the same problem...",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2854465,
      "author_name": "abebe9849",
      "author_url": "",
      "post_date": "06/04/2024 10:33:58",
      "content": "<p>I think you can submit it for the time being by using this code.</p>\n<pre><code> = pd.read_csv()\n[]=[int(i.()[0])  i  [].values]\nsample_study_id = [].unique()\n = pd.read_csv()\n = [[]==].reset_index(=True)\ntest_stusy = [].unique()\n = .groupby()[].first().reset_index()\n\ntest_preds = inf_func(model, ) #model's output:25*3 cls\n\nnew_df = pd.DataFrame()\ntra_df = (pd.read_csv().columns[1:])\n\ncol = []\n i  test_stusy:\n     j  tra_df:\n        col.(f)\n\nnew_df[]=col\nnew_df[] = new_df[].astype()\nnew_df[]=0\nnew_df[]=0\nnew_df[]=0\nnew_df[[,,]]=test_preds.(-1,3)\n\n\nwithout = (sample_study_id)-(test_stusy)\n = pd.DataFrame()\n\n len(without)&gt;0:\n    col = []\n     i  without:\n         j  tra_df:\n            col.(f)\n\n    []=col\n    [] = [].astype()\n    []=0.34\n    []=0.33\n    []=0.33\n    ()\n    new_df = pd.concat([new_df,],axis=0).sort_values().reset_index(=True)\n    new_df\nnew_df.to_csv(,index=False)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 2859554,
          "author_name": "tashiget",
          "author_url": "",
          "post_date": "06/07/2024 05:18:26",
          "content": "<p><a href=\"https://www.kaggle.com/patriot\" target=\"_blank\">@patriot</a> Thanks for the sample code! I'll give it a try.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2857985,
      "author_name": "samu2505",
      "author_url": "",
      "post_date": "06/06/2024 08:08:49",
      "content": "<p>Have you tried testing your inference pipeline with some examples from the training set, this way you can check how it performs with different study_id </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2859259,
      "author_name": "athrunzala",
      "author_url": "",
      "post_date": "06/06/2024 22:26:48",
      "content": "<p>I have the same error before, then I try to make a similar submission on trainingset, Inoticed that it is not always have full {instance_number}.dcm in every series, like <code>7.dcm</code>,  <code>9.dcm</code>,  <code>10.dcm</code>… It miss  <code>8.dcm</code>, when I fix this, I can get a valid submission.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2859552,
          "author_name": "tashiget",
          "author_url": "",
          "post_date": "06/07/2024 05:17:10",
          "content": "<p>I see, thank you!<br>\nHowever, I use 'glob' to get all the dcm images, so that method doesn't seem to work.😭</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2859436,
      "author_name": "coderrkj",
      "author_url": "",
      "post_date": "06/07/2024 03:28:07",
      "content": "<p>There is a starter notebook for PyTorch which is currently working: <a href=\"https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook\" target=\"_blank\">https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook</a><br>\nYou can compare and see if it fits your code.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2859548,
          "author_name": "tashiget",
          "author_url": "",
          "post_date": "06/07/2024 05:15:19",
          "content": "<p><a href=\"https://www.kaggle.com/coderrkj\" target=\"_blank\">@coderrkj</a> Thank you for letting me know! I'll give it a try🥳</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2893568,
      "author_name": "hmssantos",
      "author_url": "",
      "post_date": "06/27/2024 21:51:43",
      "content": "<p>Were you able to identify what was causing the error? I'm facing the same problem…</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2852305": "I created a CNN model with pytorch and submitted it, but I get the error \"Notebook threw exception.\"\nI would like to refer to the code of other participants, but I cannot find any notebooks that other participants have successfully submitted using test_images, so I am in a hopeless situation.\nCan you give me some hints on how to solve this?",
    "2854465": "I think you can submit it for the time being by using this code.\n\n```\nsample = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/sample_submission.csv\")\nsample[\"study_id\"]=[int(i.split(\"_\")[0]) for i in sample[\"row_id\"].values]\nsample_study_id = sample[\"study_id\"].unique()\ntest = pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/test_series_descriptions.csv\")\ntest = test[test[\"series_description\"]==\"Axial T2\"].reset_index(drop=True)\ntest_stusy = test[\"study_id\"].unique()\ntest = test.groupby(\"study_id\")[\"series_id\"].first().reset_index()\n\ntest_preds = inf_func(model, test) #model's output:25*3 cls\n\nnew_df = pd.DataFrame()\ntra_df = list(pd.read_csv(\"/kaggle/input/rsna-2024-lumbar-spine-degenerative-classification/train.csv\").columns[1:])\n\ncol = []\nfor i in test_stusy:\n    for j in tra_df:\n        col.append(f\"{i}_{j}\")\n        \nnew_df[\"row_id\"]=col\nnew_df[\"row_id\"] = new_df[\"row_id\"].astype(\"str\")\nnew_df[\"normal_mild\"]=0\nnew_df[\"moderate\"]=0\nnew_df[\"severe\"]=0\nnew_df[[\"normal_mild\",\"moderate\",\"severe\"]]=test_preds.reshape(-1,3)\n\n\nwithout = set(sample_study_id)-set(test_stusy)\nsample = pd.DataFrame()\n\nif len(without)>0:\n    col = []\n    for i in without:\n        for j in tra_df:\n            col.append(f\"{i}_{j}\")\n\n    sample[\"row_id\"]=col\n    sample[\"row_id\"] = sample[\"row_id\"].astype(\"str\")\n    sample[\"normal_mild\"]=0.34\n    sample[\"moderate\"]=0.33\n    sample[\"severe\"]=0.33\n    print(sample)\n    new_df = pd.concat([new_df,sample],axis=0).sort_values(\"row_id\").reset_index(drop=True)\n    new_df\nnew_df.to_csv(\"submission.csv\",index=False)\n```",
    "2857985": "Have you tried testing your inference pipeline with some examples from the training set, this way you can check how it performs with different study_id",
    "2859259": "I have the same error before, then I try to make a similar submission on trainingset, Inoticed that it is not always have full {instance_number}.dcm in every series, like `7.dcm`,  `9.dcm`,  `10.dcm`... It miss  `8.dcm`, when I fix this, I can get a valid submission.",
    "2859436": "There is a starter notebook for PyTorch which is currently working: https://www.kaggle.com/code/shubhamcodez/rsna-resnet-starter-notebook\nYou can compare and see if it fits your code.",
    "2859548": "coderrkj Thank you for letting me know! I'll give it a try🥳",
    "2859552": "I see, thank you!\nHowever, I use 'glob' to get all the dcm images, so that method doesn't seem to work.😭",
    "2859554": "patriot Thanks for the sample code! I'll give it a try.",
    "2893568": "Were you able to identify what was causing the error? I'm facing the same problem..."
  },
  "source": "meta"
}