{
  "id": 461213,
  "title": "anyone has good results with 3d segmentation net?",
  "url": "/competitions/blood-vessel-segmentation/discussion/461213",
  "author_name": "hengck23",
  "post_date": "2023-12-13T06:39:43.448000",
  "votes": 26,
  "comment_count": 44,
  "views": 0,
  "content": "<p>i tried convolution like 3d cnn unet or 3d transformer unetr and variants.<br>\ni also tried 2.5d unets and 2d/3d hybrids.</p>\n<p>While performances (surface dice) for 2d, 2.5d, 3d and hybrids are comparable in local validations, the performance for public lb is considerable worse for non 2d model.</p>\n<p>e.g. </p>\n<ul>\n<li>2d model: easily achieved lb 0.82 and above</li>\n<li>2d, 2.5d, 3d and hybrids model: only up to lb 0.75</li>\n</ul>\n<p>2d, 2.5d, 3d and hybrids models: 0.88 to 0.90 local cv</p>\n<hr>\n<p>it not sure what is the problems, could be:</p>\n<ul>\n<li>not enough train data/augmentation for 3d</li>\n<li>not enough resolution/context for 3d</li>\n<li>network not deep enough</li>\n</ul>\n<p>it takes too much time and compute to do experiment for 3d. hence if you have results/observations to share, it would be of great help to pin point the problem.</p>",
  "messages": [
    {
      "id": 2559935,
      "postDate": "2023-12-13T06:39:43.450Z",
      "content": "<p>i tried convolution like 3d cnn unet or 3d transformer unetr and variants.<br>\ni also tried 2.5d unets and 2d/3d hybrids.</p>\n<p>While performances (surface dice) for 2d, 2.5d, 3d and hybrids are comparable in local validations, the performance for public lb is considerable worse for non 2d model.</p>\n<p>e.g. </p>\n<ul>\n<li>2d model: easily achieved lb 0.82 and above</li>\n<li>2d, 2.5d, 3d and hybrids model: only up to lb 0.75</li>\n</ul>\n<p>2d, 2.5d, 3d and hybrids models: 0.88 to 0.90 local cv</p>\n<hr>\n<p>it not sure what is the problems, could be:</p>\n<ul>\n<li>not enough train data/augmentation for 3d</li>\n<li>not enough resolution/context for 3d</li>\n<li>network not deep enough</li>\n</ul>\n<p>it takes too much time and compute to do experiment for 3d. hence if you have results/observations to share, it would be of great help to pin point the problem.</p>",
      "rawMarkdown": "i tried convolution like 3d cnn unet or 3d transformer unetr and variants.\ni also tried 2.5d unets and 2d/3d hybrids.\n\nWhile performances (surface dice) for 2d, 2.5d, 3d and hybrids are comparable in local validations, the performance for public lb is considerable worse for non 2d model.\n\ne.g. \n- 2d model: easily achieved lb 0.82 and above\n- 2d, 2.5d, 3d and hybrids model: only up to lb 0.75\n\n2d, 2.5d, 3d and hybrids models: 0.88 to 0.90 local cv\n\n---\n\nit not sure what is the problems, could be:\n- not enough train data/augmentation for 3d\n- not enough resolution/context for 3d\n- network not deep enough\n\nit takes too much time and compute to do experiment for 3d. hence if you have results/observations to share, it would be of great help to pin point the problem.",
      "votes": 26
    },
    {
      "id": 2567803,
      "postDate": "2023-12-20T01:27:57.357Z",
      "content": "<p>My current 3D based LB is 0.77, with a local CV of 0.885-0.90.  Patch size is (64, 256, 256),   I'm trying out more data augmentation to see if it can be improved. Have you made any breakthroughs so far?</p>",
      "rawMarkdown": "My current 3D based LB is 0.77, with a local CV of 0.885-0.90.  Patch size is (64, 256, 256),   I'm trying out more data augmentation to see if it can be improved. Have you made any breakthroughs so far?",
      "votes": 4,
      "replies": [
        {
          "id": 2567833,
          "postDate": "2023-12-20T02:40:11.610Z",
          "content": "<p>My 3D score is 0.76, and the CV is 0.91. It's still not as high as the 2D score. Is your 0.87 score also from a 2D method, or is it 2.5D?</p>",
          "rawMarkdown": "My 3D score is 0.76, and the CV is 0.91. It's still not as high as the 2D score. Is your 0.87 score also from a 2D method, or is it 2.5D?\n",
          "replies": [
            {
              "id": 2567838,
              "postDate": "2023-12-20T03:05:16.663Z",
              "content": "<p>i separate the vessel into different sizes. for the smallest vessels, 1 to 2 pixel in diameters, 3d is much better. but there is a catch. 3d prediction is better than annotation, generating in some fp ( we know pprediction is correct because it grow from larger annotated vessel)</p>\n<p>i don't think 3d alone can beat 2d. there is a limit in improvement etc if u use more data, better algorith etc. the gap between 2d and 3d baseline is too much.</p>\n<p>but a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results</p>",
              "rawMarkdown": "i separate the vessel into different sizes. for the smallest vessels, 1 to 2 pixel in diameters, 3d is much better. but there is a catch. 3d prediction is better than annotation, generating in some fp ( we know pprediction is correct because it grow from larger annotated vessel)\n\n i don't think 3d alone can beat 2d. there is a limit in improvement etc if u use more data, better algorith etc. the gap between 2d and 3d baseline is too much.\n\nbut a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results"
            },
            {
              "id": 2568925,
              "postDate": "2023-12-21T00:57:58.980Z",
              "content": "<p>0.87 LB is based on 2D, but I guess I  overfitted the public  LB,  different training seeds can cause significant fluctuations.<br>\nAs <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  said,  a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results.</p>",
              "rawMarkdown": "0.87 LB is based on 2D, but I guess I  overfitted the public  LB,  different training seeds can cause significant fluctuations.\nAs @hengck23  said,  a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results.",
              "votes": 6
            },
            {
              "id": 2627968,
              "postDate": "2024-01-31T02:32:13.647Z",
              "content": "<p>Did you validate later?</p>",
              "rawMarkdown": "Did you validate later?"
            }
          ]
        },
        {
          "id": 2569822,
          "postDate": "2023-12-21T15:26:46.713Z",
          "content": "<p>Did you run into any issues with memory when doing this? </p>",
          "rawMarkdown": "Did you run into any issues with memory when doing this? ",
          "votes": 1,
          "replies": [
            {
              "id": 2579975,
              "postDate": "2023-12-30T13:39:23.100Z",
              "content": "<p>During inference, I had issues with a patch of 15 images since the model is too big for the available vRAM. That's another reason to prefer 2D models or small 2.5D models (maybe a patch of 3 to 5?).</p>",
              "rawMarkdown": "During inference, I had issues with a patch of 15 images since the model is too big for the available vRAM. That's another reason to prefer 2D models or small 2.5D models (maybe a patch of 3 to 5?)."
            }
          ]
        }
      ]
    },
    {
      "id": 2562157,
      "postDate": "2023-12-15T06:46:19.040Z",
      "content": "<p>I just started experimenting with 2.5D.<br>\nfor the same model (same encoder-decoder) and hyperparamters:</p>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>CV(kidney_3_dense)</th>\n<th>LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>2D</td>\n<td>0.868</td>\n<td>0.843</td>\n</tr>\n<tr>\n<td>2.5D</td>\n<td>0.878</td>\n<td>0.816</td>\n</tr>\n</tbody>\n</table>",
      "rawMarkdown": "I just started experimenting with 2.5D.\nfor the same model (same encoder-decoder) and hyperparamters:\n| Model |  CV(kidney_3_dense)| LB\n| --- | --- |\n| 2D | 0.868 | 0.843\n| 2.5D | 0.878 | 0.816\n",
      "votes": 4,
      "replies": [
        {
          "id": 2562587,
          "postDate": "2023-12-15T14:37:12.197Z",
          "content": "<p>are you using multiview? you use 3D voxel to 2D slice or directly 2D slice</p>",
          "rawMarkdown": "are you using multiview? you use 3D voxel to 2D slice or directly 2D slice",
          "replies": [
            {
              "id": 2562674,
              "postDate": "2023-12-15T15:47:31.663Z",
              "content": "<p>single view training and 2d slices directly.</p>",
              "rawMarkdown": "single view training and 2d slices directly.",
              "votes": 1
            },
            {
              "id": 2563458,
              "postDate": "2023-12-16T09:50:48.520Z",
              "content": "<p>What model do you use ?</p>",
              "rawMarkdown": "What model do you use ?",
              "votes": 1
            }
          ]
        }
      ]
    },
    {
      "id": 2594751,
      "postDate": "2024-01-10T03:55:36.490Z",
      "content": "<p>have a pure 3d Unet network, currently at 0.87<br>\nI think the main problem is small block sizes as input, as you will miss context beyond the block. I found a way around that.</p>",
      "rawMarkdown": " have a pure 3d Unet network, currently at 0.87\n\nI think the main problem is small block sizes as input, as you will miss context beyond the block. I found a way around that.",
      "votes": 1,
      "replies": [
        {
          "id": 2594768,
          "postDate": "2024-01-10T04:09:04.120Z",
          "content": "<p>thanks. my largest block size is 256x256x64. i wonder is that large enough?</p>",
          "rawMarkdown": "thanks. my largest block size is 256x256x64. i wonder is that large enough?",
          "replies": [
            {
              "id": 2594836,
              "postDate": "2024-01-10T04:51:48.813Z",
              "content": "<p>My input block size is now 320x320x320 hehe. I just increased it today from 240x240x240 (which scored the .87) to see if it performs better. Obviously these blocks are too big to train with, so you have to do something smart with it like dilated convolution or pooling early in your model, but I see definite reduction in (large) false positives.</p>",
              "rawMarkdown": "My input block size is now 320x320x320 hehe. I just increased it today from 240x240x240 (which scored the .87) to see if it performs better. Obviously these blocks are too big to train with, so you have to do something smart with it like dilated convolution or pooling early in your model, but I see definite reduction in (large) false positives.",
              "votes": 4
            },
            {
              "id": 2594932,
              "postDate": "2024-01-10T06:25:52.800Z",
              "content": "<p>thanks. for your information my 2d unet can achieve 0.865 and i think it can be higher.</p>",
              "rawMarkdown": "thanks. for your information my 2d unet can achieve 0.865 and i think it can be higher.",
              "votes": 1
            },
            {
              "id": 2601026,
              "postDate": "2024-01-14T04:31:13.173Z",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> <br>\nhow long does your 3d  Unet network takes for submission?<br>\nis your model for at 0.87 trained using kideney1 only?</p>\n<p>I am considering the advantage of using 3d against 2d. It seems that 2d can reach the same performance of 3d. (i confirm a single 2d alone can get  0.87+)</p>",
              "rawMarkdown": "@limitz \nhow long does your 3d  Unet network takes for submission?\nis your model for at 0.87 trained using kideney1 only?\n\nI am considering the advantage of using 3d against 2d. It seems that 2d can reach the same performance of 3d. (i confirm a single 2d alone can get  0.87+)"
            },
            {
              "id": 2601622,
              "postDate": "2024-01-14T15:02:45.273Z",
              "content": "<p>Thanks for your great work. I'm just new here and miss a lot of information. Can you briefly list some key points of LB 0.865? I only have 0.77 for a single 2d unet.😥</p>",
              "rawMarkdown": "Thanks for your great work. I'm just new here and miss a lot of information. Can you briefly list some key points of LB 0.865? I only have 0.77 for a single 2d unet.😥"
            },
            {
              "id": 2601668,
              "postDate": "2024-01-14T15:52:08.857Z",
              "content": "<p>Hey <a href=\"https://www.kaggle.com/zznznb\" target=\"_blank\">@zznznb</a>,<br>\nWhat you are looking for is actually all listed there: <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456118\" target=\"_blank\">https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456118</a> (but you kinda have to read everything)</p>\n<p>On top of getting the answers you are looking for, you might learn a thing or two :)</p>",
              "rawMarkdown": "Hey @zznznb,\nWhat you are looking for is actually all listed there: https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456118 (but you kinda have to read everything)\n\nOn top of getting the answers you are looking for, you might learn a thing or two :)"
            },
            {
              "id": 2602021,
              "postDate": "2024-01-14T20:33:49.243Z",
              "content": "<p>Hey <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> <br>\nFor me, the complete submission process takes about 7-8 hours on a P100. Locally I have inference code that uses four GPUs and does kidney_2 in 45 minutes. My model is trained on kidney 1 and kidney 3.</p>\n<p>It is interesting to see 2d reaching the same performance, I did not expect that when I chose to go with a 3d model. My hope is of course that I can still squeeze some more performance out of the 3d model :)</p>\n<p>Worth noting maybe is that the complete unet is trained end to end without using any pretrained weights or SSL pretraining or something. I am usually seeing a nice performance after a few hours of training, but to reach 0.87 a training on a 4 GPU machine takes me about 2 days.  </p>",
              "rawMarkdown": "Hey @hengck23 \nFor me, the complete submission process takes about 7-8 hours on a P100. Locally I have inference code that uses four GPUs and does kidney_2 in 45 minutes. My model is trained on kidney 1 and kidney 3.\n\nIt is interesting to see 2d reaching the same performance, I did not expect that when I chose to go with a 3d model. My hope is of course that I can still squeeze some more performance out of the 3d model :)\n\nWorth noting maybe is that the complete unet is trained end to end without using any pretrained weights or SSL pretraining or something. I am usually seeing a nice performance after a few hours of training, but to reach 0.87 a training on a 4 GPU machine takes me about 2 days.  ",
              "votes": 2
            },
            {
              "id": 2602060,
              "postDate": "2024-01-14T21:18:12.240Z",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> </p>\n<p>thanks for your reply<br>\n\"7-8 hours on a P100.\" this seems long. you can use tensort to accelerate.<br>\n(there is a trick: for private submission, you just need to submit kidney6. but you have the ask the competition host if this is \"against\" the rule)</p>\n<p>\"reach 0.87 a training on a 4 GPU machine takes me about 2 days.\" this means that your good lb score comes from low fp (which is consistent with my unet 2d)</p>\n<hr>\n<p>SSL, if effective, should improve results</p>\n<hr>\n<p>now the top score goes to lb0.890. ensmble has a gain of about 0.010, meaning their 3d/2d models are in the 0.880 range</p>",
              "rawMarkdown": "@limitz \n\nthanks for your reply\n\"7-8 hours on a P100.\" this seems long. you can use tensort to accelerate.\n(there is a trick: for private submission, you just need to submit kidney6. but you have the ask the competition host if this is \"against\" the rule)\n\n\"reach 0.87 a training on a 4 GPU machine takes me about 2 days.\" this means that your good lb score comes from low fp (which is consistent with my unet 2d)\n\n\n---\n\nSSL, if effective, should improve results\n\n---\nnow the top score goes to lb0.890. ensmble has a gain of about 0.010, meaning their 3d/2d models are in the 0.880 range\n\n",
              "votes": 1
            },
            {
              "id": 2602095,
              "postDate": "2024-01-14T22:23:09.977Z",
              "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> Thanks for the info, but what do you mean with the private submission trick exactly? I know that the public submissions use kidney_5 and the private ones only use kidney_6, which should be half the size, right? I don't see how I could change anything in the code to take advantage of that, if the kidney_5 folder is empty, it will simply skip it… or am I missing something?</p>",
              "rawMarkdown": "@hengck23 Thanks for the info, but what do you mean with the private submission trick exactly? I know that the public submissions use kidney_5 and the private ones only use kidney_6, which should be half the size, right? I don't see how I could change anything in the code to take advantage of that, if the kidney_5 folder is empty, it will simply skip it... or am I missing something?"
            },
            {
              "id": 2602157,
              "postDate": "2024-01-14T23:45:25.393Z",
              "content": "<p>I'm always reading… Another user suggested on a thread to intentionally skip kidney_5 to spend al 10h inference limit on kidney_6 since is the one decides it all.</p>",
              "rawMarkdown": "I'm always reading... Another user suggested on a thread to intentionally skip kidney_5 to spend al 10h inference limit on kidney_6 since is the one decides it all."
            },
            {
              "id": 2602193,
              "postDate": "2024-01-15T00:52:58.267Z",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> </p>\n<p>public submission #we somtimes use this to speed up parameter testing on public data</p>\n<pre><code>id    rle\nkid_   xxx\nkid_   xxx\n...\n\nkid_   \nkid_  \n</code></pre>\n<p>WARNING!!!!! please seek competition host permission. it is not against the rule but against the \"spirit\" of the time limitation of the competition. host reserve the rights to award prize or not.</p>\n<p>private submission</p>\n<pre><code>id    rle\nkid_       \nkid_     \n...\n\nkid_  xxx\nkid_ xxx\n</code></pre>",
              "rawMarkdown": "@limitz \n\npublic submission #we somtimes use this to speed up parameter testing on public data\n```\nid    rle\nkidney_5_001   xxx\nkidney_5_002   xxx\n...\n\nkidney_6_001  1 1\nkidney_6_002 1 1\n\n```\nWARNING!!!!! please seek competition host permission. it is not against the rule but against the \"spirit\" of the time limitation of the competition. host reserve the rights to award prize or not.\n\nprivate submission\n```\nid    rle\nkidney_5_001   1  1  \nkidney_5_002   1  1\n...\n\nkidney_6_001  xxx\nkidney_6_002 xxx\n\n```",
              "votes": 1
            }
          ]
        }
      ]
    },
    {
      "id": 2587283,
      "postDate": "2024-01-04T16:49:27.390Z",
      "content": "<p>0.626 public LB trained 5 epochs on kidney_1 and with a bit buggy inference. That starts to work.</p>",
      "rawMarkdown": "0.626 public LB trained 5 epochs on kidney_1 and with a bit buggy inference. That starts to work.",
      "votes": 1,
      "replies": [
        {
          "id": 2587505,
          "postDate": "2024-01-04T19:38:34.093Z",
          "content": "<p>0.73 after debugging inference.</p>",
          "rawMarkdown": "0.73 after debugging inference.",
          "votes": 1
        }
      ]
    },
    {
      "id": 2565244,
      "postDate": "2023-12-17T20:17:02.897Z",
      "content": "<p>I have public score of 0.811 with 3D so far. Far from ideal yet, but still got several ideas to test.</p>",
      "rawMarkdown": "I have public score of 0.811 with 3D so far. Far from ideal yet, but still got several ideas to test.",
      "votes": 2
    },
    {
      "id": 2562651,
      "postDate": "2023-12-15T15:28:47.003Z",
      "content": "<p>I didn't succeed for now with the 3d as well. </p>",
      "rawMarkdown": "I didn't succeed for now with the 3d as well. ",
      "votes": 2,
      "replies": [
        {
          "id": 2562668,
          "postDate": "2023-12-15T15:43:37.543Z",
          "content": "<p>thanks for the comment.</p>\n<p>i think that is quite interesting (or unusal?).</p>\n<p>it seems that results get worse if you use more slice.</p>\n<pre><code>.g. single slice (best) &gt; three slices &gt; n slices (.d)  &gt; d subvolume (num slices&gt;)\n</code></pre>\n<p>i wonder what is the reason?<br>\n(i hope there is noting wrong with the hidden test data/label ; or train data/label) </p>",
          "rawMarkdown": "thanks for the comment.\n\ni think that is quite interesting (or unusal?).\n\nit seems that results get worse if you use more slice.\n```\ne.g. single slice (best) > three slices > n slices (2.5d)  > 3d subvolume (num slices>32)\n```\n\ni wonder what is the reason?\n(i hope there is noting wrong with the hidden test data/label ; or train data/label) ",
          "votes": 2,
          "replies": [
            {
              "id": 2562675,
              "postDate": "2023-12-15T15:47:39.670Z",
              "content": "<p>My current score is 2.5d :) <br>\nMaybe, I should try my current pipeline with 2d images. Since I almost from the beginning of the competition started with the 2.5d approach. </p>",
              "rawMarkdown": "My current score is 2.5d :) \nMaybe, I should try my current pipeline with 2d images. Since I almost from the beginning of the competition started with the 2.5d approach. ",
              "votes": 3
            }
          ]
        }
      ]
    },
    {
      "id": 2561472,
      "postDate": "2023-12-14T14:08:34.990Z",
      "content": "<p>Thanks for sharing your experience. My best LB is 2D model with 0.82, too. I tried 2.5D, but it didn’t work well. I also tried some small 3D model. It takes too much time to train. The best 3D model is LB 0.748. I think 3D model can work as well as 2D, if we have enough computation power and time.<br>\n I don’t have local surface dice metric yet. Just use LB to evaluate the model, so the threshold may not be the best.</p>",
      "rawMarkdown": "Thanks for sharing your experience. My best LB is 2D model with 0.82, too. I tried 2.5D, but it didn’t work well. I also tried some small 3D model. It takes too much time to train. The best 3D model is LB 0.748. I think 3D model can work as well as 2D, if we have enough computation power and time.\n I don’t have local surface dice metric yet. Just use LB to evaluate the model, so the threshold may not be the best.",
      "votes": 2,
      "replies": [
        {
          "id": 2561478,
          "postDate": "2023-12-14T14:16:58.177Z",
          "content": "<p>\"I don’t have local surface dice metric yet\"<br>\nplease see helper.py attached.</p>\n<pre><code> helper  fast_compute_surface_dice_score_from_tensor\n\npredict =  .... np.((D,H,W), np.) of zero  one value ....\n\nlb_score = fast_compute_surface_dice_score_from_tensor(predict, truth)\n</code></pre>",
          "rawMarkdown": "\"I don’t have local surface dice metric yet\"\nplease see helper.py attached.\n\n```\n\nfrom helper import fast_compute_surface_dice_score_from_tensor\n\npredict =  .... np.array((D,H,W), np.uint8) of zero or one value ....\n\nlb_score = fast_compute_surface_dice_score_from_tensor(predict, truth)\n\n```",
          "votes": 7,
          "replies": [
            {
              "id": 2561479,
              "postDate": "2023-12-14T14:20:58.823Z",
              "content": "<p>Thank you. 😀</p>",
              "rawMarkdown": "Thank you. 😀"
            }
          ]
        },
        {
          "id": 2561879,
          "postDate": "2023-12-14T23:03:20.943Z",
          "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> Thank you for the helper.py, now the 2D model is up to 0.844. The 3D model is on the way.<br>\nWhich size do you use when training the 3D model. 32x32x32, 64x64x64…? Maybe the bigger size can help.</p>",
          "rawMarkdown": "@hengck23 Thank you for the helper.py, now the 2D model is up to 0.844. The 3D model is on the way.\nWhich size do you use when training the 3D model. 32x32x32, 64x64x64...? Maybe the bigger size can help.",
          "votes": 2,
          "replies": [
            {
              "id": 2561909,
              "postDate": "2023-12-15T00:16:30.283Z",
              "content": "<p>\"now the 2D model is up to 0.844. \"<br>\noh, i should be focusing on 2d instead….</p>\n<p>for 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.<br>\nit needs at lest 256x256. if it is not deep, there is no point trying 2d (just 2.5 d will do) i try 256x256x128.</p>\n<p>the trick is to try a model that don't uses batch norm. then you can just push one or two subvolume in the gpu memory and use gradient accumulation for one batch, </p>\n<p>(google for 3d convnext  that uses LN,GN.)</p>\n<p>e.g.</p>\n<pre><code>    for t, in enumerate(train_loader):\n                output=[]\n        = len(        for in range(            = \n            for k in tensor_key:\n                = \n            with torch.cuda.amp.autocast(enabled=True):  \n                o = net(                output.append(o)\n                vessel_loss = o[f]\n\n             \n        \n        </code></pre>\n<p>my 2d takes one hour and 3d takes 2.5 hour to get reasonable CV.<br>\n(reasonable means good enough to do prameter search and draw conclusion)</p>\n<hr>\n<p>you can also do experiment with 0.5-scale 2d or 3d input.<br>\nhere you are detecting large vessel which is a source of problem</p>\n<hr>\n<p>other methods include gradient check but too slow.</p>\n<p>alternative is to use 2 size:<br>\ntry small 3d 128x128x64 on 0.5 resosolution input (or better on feature map of 3d convo).<br>\ntrain use input= 2 ch = (oringal input + small3d output) for another 3d cnn.</p>\n<p>one detect the large vessel, another detect  small vessel</p>\n<p>disadvantage is that this is not end-to-end (think of this like old kaggle competition when you train a stack model).</p>\n<p>there are ways to train them together if you can connect up big and small net in such a way that you can drop path (i.e. make the model small) during training. the idea is the same as drop path in residual net, effciient, trasnformer etc .. </p>",
              "rawMarkdown": "\"now the 2D model is up to 0.844. \"\noh, i should be focusing on 2d instead....\n\nfor 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.\nit needs at lest 256x256. if it is not deep, there is no point trying 2d (just 2.5 d will do) i try 256x256x128.\n\nthe trick is to try a model that don't uses batch norm. then you can just push one or two subvolume in the gpu memory and use gradient accumulation for one batch, \n\n(google for 3d convnext  that uses LN,GN.)\n\ne.g.\n\n```\n\n\tfor t, batch in enumerate(train_loader):\n                output=[]\n\t\tbatch_size = len(batch)\n\t\tfor b in range(batch_size):\n\t\t\tbatch_b = batch[b]\n\n\t\t\tfor k in tensor_key:\n\t\t\t\tbatch_b[k] = batch_b[k].unsqueeze(0).cuda(non_blocking=True)\n\n\t\t\twith torch.cuda.amp.autocast(enabled=True):  # put one to gpu memory at a time\n\t\t\t\to = net(batch_b)\n\t\t\t\toutput.append(o)\n\t\t\t\tvessel_loss = o[f'vessel_loss']\n \n\t\t\tscaler.scale(vessel_loss).backward()  #accumuate grdient for one\n\t\tscaler.step(optimizer) #backprop for all\n\t\tscaler.update()\n \n```\nmy 2d takes one hour and 3d takes 2.5 hour to get reasonable CV.\n(reasonable means good enough to do prameter search and draw conclusion)\n\n---\n\nyou can also do experiment with 0.5-scale 2d or 3d input.\nhere you are detecting large vessel which is a source of problem\n\n---\n\nother methods include gradient check but too slow.\n\nalternative is to use 2 size:\ntry small 3d 128x128x64 on 0.5 resosolution input (or better on feature map of 3d convo).\ntrain use input= 2 ch = (oringal input + small3d output) for another 3d cnn.\n\none detect the large vessel, another detect  small vessel\n\ndisadvantage is that this is not end-to-end (think of this like old kaggle competition when you train a stack model).\n\nthere are ways to train them together if you can connect up big and small net in such a way that you can drop path (i.e. make the model small) during training. the idea is the same as drop path in residual net, effciient, trasnformer etc .. ",
              "votes": 2
            },
            {
              "id": 2561912,
              "postDate": "2023-12-15T00:25:12.490Z",
              "content": "<p>\" 2D model is up to 0.844. \"</p>\n<ul>\n<li>3d add +0.02 (from academic papers)</li>\n<li>pretrain with self-supervised +0.02 (maybe relabel kidney3,2 etc … kidney 2 has label bugs, maybe need relabel)</li>\n<li>extern data add 0.01</li>\n<li>post process + 0.01</li>\n</ul>\n<p>maybe that 's  the limit.</p>\n<p>problem is data for training with 3d. hence key could be pretrain with self-supervised.<br>\nanother option is to distill fearture feature from 2d.</p>\n<p>the use of 3d is that it must perform better than 2d.</p>",
              "rawMarkdown": "\" 2D model is up to 0.844. \"\n\n- 3d add +0.02 (from academic papers)\n- pretrain with self-supervised +0.02 (maybe relabel kidney3,2 etc ... kidney 2 has label bugs, maybe need relabel)\n- extern data add 0.01\n- post process + 0.01\n\nmaybe that 's  the limit.\n\nproblem is data for training with 3d. hence key could be pretrain with self-supervised.\nanother option is to distill fearture feature from 2d.\n\nthe use of 3d is that it must perform better than 2d.",
              "votes": 1
            },
            {
              "id": 2587654,
              "postDate": "2024-01-04T23:22:00.887Z",
              "content": "<p>When you say 'for 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.' What is the error resulting from the small context window? (i.e. to many false positives?). Thanks for all of your work and input thus far</p>",
              "rawMarkdown": "When you say 'for 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.' What is the error resulting from the small context window? (i.e. to many false positives?). Thanks for all of your work and input thus far"
            }
          ]
        }
      ]
    },
    {
      "id": 2559984,
      "postDate": "2023-12-13T07:43:56.403Z",
      "content": "<p>I can't even reach 0.4 with 2d🥲</p>",
      "rawMarkdown": "I can't even reach 0.4 with 2d🥲",
      "votes": 2
    },
    {
      "id": 2610232,
      "postDate": "2024-01-20T02:56:51.117Z",
      "content": "<p>WARNING !!!! for those using 3d convolution</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2Ffc44a629ee63f4ac55667477827c3890%2FSelection_999(4639).png?generation=1705719294894768&amp;alt=media\"></p>\n<p>description of attachment image:</p>\n<pre><code>given volume.= D,H,W,\ntop volume.mean()\nvolume.mean()\n</code></pre>\n<p>there seems to be 3d reconstruction in the HiP-CT.<br>\nI wonder if this affects results?<br>\n(espeically for different resolution)</p>",
      "rawMarkdown": "WARNING !!!! for those using 3d convolution\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2Ffc44a629ee63f4ac55667477827c3890%2FSelection_999(4639).png?generation=1705719294894768&alt=media)\n\ndescription of attachment image:\n```\ngiven volume.shape = D,H,W,\ntop shows volume.mean(0)\nbottom shows volume.mean(1)\n```\n\nthere seems to be 3d reconstruction in the HiP-CT.\nI wonder if this affects results?\n(espeically for different resolution)",
      "replies": [
        {
          "id": 2610768,
          "postDate": "2024-01-20T10:23:04.860Z",
          "content": "<p>I think is a different issue with my 3D approach. But with K3 my model predicts some regular background noise as vessels. It doesn't affect public LB. I'm .786 right now.</p>",
          "rawMarkdown": "I think is a different issue with my 3D approach. But with K3 my model predicts some regular background noise as vessels. It doesn't affect public LB. I'm .786 right now."
        }
      ]
    },
    {
      "id": 2569817,
      "postDate": "2023-12-21T15:23:39.270Z",
      "content": "<p>I got a 3d Unet model working pretty well (not using the official metric, but just using good old dice loss it was getting ~.84) by training on 48x48x48 cutouts. however, running the final prediction keeps giving me memory errors. (just arbitrarily running it on the whole of kidney_2, for example)   This persists no matter how much I try to run it efficiently</p>",
      "rawMarkdown": "I got a 3d Unet model working pretty well (not using the official metric, but just using good old dice loss it was getting ~.84) by training on 48x48x48 cutouts. however, running the final prediction keeps giving me memory errors. (just arbitrarily running it on the whole of kidney_2, for example)   This persists no matter how much I try to run it efficiently",
      "replies": [
        {
          "id": 2569956,
          "postDate": "2023-12-21T17:56:07.050Z",
          "content": "<p>Have you checked the confusion matrix of the validation batches? I've been getting similar results with all 0 predictions.</p>",
          "rawMarkdown": "Have you checked the confusion matrix of the validation batches? I've been getting similar results with all 0 predictions.",
          "replies": [
            {
              "id": 2580023,
              "postDate": "2023-12-30T14:04:06.957Z",
              "content": "<p>Yeah, it’s looking pretty accurate for the most part. False positives and some glob type things and missing the really tiny vessels though.</p>",
              "rawMarkdown": "Yeah, it’s looking pretty accurate for the most part. False positives and some glob type things and missing the really tiny vessels though.",
              "votes": 1
            }
          ]
        }
      ]
    },
    {
      "id": 2588726,
      "postDate": "2024-01-05T17:17:12.407Z",
      "rawMarkdown": "",
      "votes": 2,
      "isDeleted": true
    },
    {
      "id": 2560145,
      "postDate": "2023-12-13T10:29:51.800Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 2567803,
      "author_name": "lhwcv",
      "author_url": "",
      "post_date": "2023-12-20T01:27:57.357000",
      "content": "<p>My current 3D based LB is 0.77, with a local CV of 0.885-0.90.  Patch size is (64, 256, 256),   I'm trying out more data augmentation to see if it can be improved. Have you made any breakthroughs so far?</p>",
      "votes": 4,
      "replies": [
        {
          "id": 2567833,
          "author_name": "Huang Jin Feng",
          "author_url": "",
          "post_date": "2023-12-20T02:40:11.610000",
          "content": "<p>My 3D score is 0.76, and the CV is 0.91. It's still not as high as the 2D score. Is your 0.87 score also from a 2D method, or is it 2.5D?</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2567838,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-20T03:05:16.663000",
              "content": "<p>i separate the vessel into different sizes. for the smallest vessels, 1 to 2 pixel in diameters, 3d is much better. but there is a catch. 3d prediction is better than annotation, generating in some fp ( we know pprediction is correct because it grow from larger annotated vessel)</p>\n<p>i don't think 3d alone can beat 2d. there is a limit in improvement etc if u use more data, better algorith etc. the gap between 2d and 3d baseline is too much.</p>\n<p>but a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2568925,
              "author_name": "lhwcv",
              "author_url": "",
              "post_date": "2023-12-21T00:57:58.980000",
              "content": "<p>0.87 LB is based on 2D, but I guess I  overfitted the public  LB,  different training seeds can cause significant fluctuations.<br>\nAs <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a>  said,  a clever mix of 2d and 3d will definitely better than 2d. eg 3d as a stacking model to post process 2d results.</p>",
              "votes": 6,
              "replies": []
            },
            {
              "id": 2627968,
              "author_name": "Jun Liu",
              "author_url": "",
              "post_date": "2024-01-31T02:32:13.647000",
              "content": "<p>Did you validate later?</p>",
              "votes": 0,
              "replies": []
            }
          ]
        },
        {
          "id": 2569822,
          "author_name": "Jekasm19",
          "author_url": "",
          "post_date": "2023-12-21T15:26:46.713000",
          "content": "<p>Did you run into any issues with memory when doing this? </p>",
          "votes": 1,
          "replies": [
            {
              "id": 2579975,
              "author_name": "Yassine Alouini",
              "author_url": "",
              "post_date": "2023-12-30T13:39:23.100000",
              "content": "<p>During inference, I had issues with a patch of 15 images since the model is too big for the available vRAM. That's another reason to prefer 2D models or small 2.5D models (maybe a patch of 3 to 5?).</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2562157,
      "author_name": "Reacher",
      "author_url": "",
      "post_date": "2023-12-15T06:46:19.040000",
      "content": "<p>I just started experimenting with 2.5D.<br>\nfor the same model (same encoder-decoder) and hyperparamters:</p>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>CV(kidney_3_dense)</th>\n<th>LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>2D</td>\n<td>0.868</td>\n<td>0.843</td>\n</tr>\n<tr>\n<td>2.5D</td>\n<td>0.878</td>\n<td>0.816</td>\n</tr>\n</tbody>\n</table>",
      "votes": 4,
      "replies": [
        {
          "id": 2562587,
          "author_name": "Arunodhayan",
          "author_url": "",
          "post_date": "2023-12-15T14:37:12.197000",
          "content": "<p>are you using multiview? you use 3D voxel to 2D slice or directly 2D slice</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2562674,
              "author_name": "Reacher",
              "author_url": "",
              "post_date": "2023-12-15T15:47:31.663000",
              "content": "<p>single view training and 2d slices directly.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2563458,
              "author_name": "Arunodhayan",
              "author_url": "",
              "post_date": "2023-12-16T09:50:48.520000",
              "content": "<p>What model do you use ?</p>",
              "votes": 1,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2594751,
      "author_name": "E/S Pronk",
      "author_url": "",
      "post_date": "2024-01-10T03:55:36.490000",
      "content": "<p>have a pure 3d Unet network, currently at 0.87<br>\nI think the main problem is small block sizes as input, as you will miss context beyond the block. I found a way around that.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2594768,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2024-01-10T04:09:04.120000",
          "content": "<p>thanks. my largest block size is 256x256x64. i wonder is that large enough?</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2594836,
              "author_name": "E/S Pronk",
              "author_url": "",
              "post_date": "2024-01-10T04:51:48.813000",
              "content": "<p>My input block size is now 320x320x320 hehe. I just increased it today from 240x240x240 (which scored the .87) to see if it performs better. Obviously these blocks are too big to train with, so you have to do something smart with it like dilated convolution or pooling early in your model, but I see definite reduction in (large) false positives.</p>",
              "votes": 4,
              "replies": []
            },
            {
              "id": 2594932,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2024-01-10T06:25:52.800000",
              "content": "<p>thanks. for your information my 2d unet can achieve 0.865 and i think it can be higher.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2601026,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2024-01-14T04:31:13.173000",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> <br>\nhow long does your 3d  Unet network takes for submission?<br>\nis your model for at 0.87 trained using kideney1 only?</p>\n<p>I am considering the advantage of using 3d against 2d. It seems that 2d can reach the same performance of 3d. (i confirm a single 2d alone can get  0.87+)</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2601622,
              "author_name": "zznznb",
              "author_url": "",
              "post_date": "2024-01-14T15:02:45.273000",
              "content": "<p>Thanks for your great work. I'm just new here and miss a lot of information. Can you briefly list some key points of LB 0.865? I only have 0.77 for a single 2d unet.😥</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2601668,
              "author_name": "JEANMPIA",
              "author_url": "",
              "post_date": "2024-01-14T15:52:08.857000",
              "content": "<p>Hey <a href=\"https://www.kaggle.com/zznznb\" target=\"_blank\">@zznznb</a>,<br>\nWhat you are looking for is actually all listed there: <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456118\" target=\"_blank\">https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/456118</a> (but you kinda have to read everything)</p>\n<p>On top of getting the answers you are looking for, you might learn a thing or two :)</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2602021,
              "author_name": "E/S Pronk",
              "author_url": "",
              "post_date": "2024-01-14T20:33:49.243000",
              "content": "<p>Hey <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> <br>\nFor me, the complete submission process takes about 7-8 hours on a P100. Locally I have inference code that uses four GPUs and does kidney_2 in 45 minutes. My model is trained on kidney 1 and kidney 3.</p>\n<p>It is interesting to see 2d reaching the same performance, I did not expect that when I chose to go with a 3d model. My hope is of course that I can still squeeze some more performance out of the 3d model :)</p>\n<p>Worth noting maybe is that the complete unet is trained end to end without using any pretrained weights or SSL pretraining or something. I am usually seeing a nice performance after a few hours of training, but to reach 0.87 a training on a 4 GPU machine takes me about 2 days.  </p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 2602060,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2024-01-14T21:18:12.240000",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> </p>\n<p>thanks for your reply<br>\n\"7-8 hours on a P100.\" this seems long. you can use tensort to accelerate.<br>\n(there is a trick: for private submission, you just need to submit kidney6. but you have the ask the competition host if this is \"against\" the rule)</p>\n<p>\"reach 0.87 a training on a 4 GPU machine takes me about 2 days.\" this means that your good lb score comes from low fp (which is consistent with my unet 2d)</p>\n<hr>\n<p>SSL, if effective, should improve results</p>\n<hr>\n<p>now the top score goes to lb0.890. ensmble has a gain of about 0.010, meaning their 3d/2d models are in the 0.880 range</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2602095,
              "author_name": "E/S Pronk",
              "author_url": "",
              "post_date": "2024-01-14T22:23:09.977000",
              "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> Thanks for the info, but what do you mean with the private submission trick exactly? I know that the public submissions use kidney_5 and the private ones only use kidney_6, which should be half the size, right? I don't see how I could change anything in the code to take advantage of that, if the kidney_5 folder is empty, it will simply skip it… or am I missing something?</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2602157,
              "author_name": "Ángel Jacinto Sánchez Ruiz",
              "author_url": "",
              "post_date": "2024-01-14T23:45:25.393000",
              "content": "<p>I'm always reading… Another user suggested on a thread to intentionally skip kidney_5 to spend al 10h inference limit on kidney_6 since is the one decides it all.</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2602193,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2024-01-15T00:52:58.267000",
              "content": "<p><a href=\"https://www.kaggle.com/limitz\" target=\"_blank\">@limitz</a> </p>\n<p>public submission #we somtimes use this to speed up parameter testing on public data</p>\n<pre><code>id    rle\nkid_   xxx\nkid_   xxx\n...\n\nkid_   \nkid_  \n</code></pre>\n<p>WARNING!!!!! please seek competition host permission. it is not against the rule but against the \"spirit\" of the time limitation of the competition. host reserve the rights to award prize or not.</p>\n<p>private submission</p>\n<pre><code>id    rle\nkid_       \nkid_     \n...\n\nkid_  xxx\nkid_ xxx\n</code></pre>",
              "votes": 1,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2587283,
      "author_name": "Ángel Jacinto Sánchez Ruiz",
      "author_url": "",
      "post_date": "2024-01-04T16:49:27.390000",
      "content": "<p>0.626 public LB trained 5 epochs on kidney_1 and with a bit buggy inference. That starts to work.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2587505,
          "author_name": "Ángel Jacinto Sánchez Ruiz",
          "author_url": "",
          "post_date": "2024-01-04T19:38:34.093000",
          "content": "<p>0.73 after debugging inference.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2565244,
      "author_name": "Victor Shlepov",
      "author_url": "",
      "post_date": "2023-12-17T20:17:02.897000",
      "content": "<p>I have public score of 0.811 with 3D so far. Far from ideal yet, but still got several ideas to test.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 2562651,
      "author_name": "Igor Krashenyi",
      "author_url": "",
      "post_date": "2023-12-15T15:28:47.003000",
      "content": "<p>I didn't succeed for now with the 3d as well. </p>",
      "votes": 2,
      "replies": [
        {
          "id": 2562668,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2023-12-15T15:43:37.543000",
          "content": "<p>thanks for the comment.</p>\n<p>i think that is quite interesting (or unusal?).</p>\n<p>it seems that results get worse if you use more slice.</p>\n<pre><code>.g. single slice (best) &gt; three slices &gt; n slices (.d)  &gt; d subvolume (num slices&gt;)\n</code></pre>\n<p>i wonder what is the reason?<br>\n(i hope there is noting wrong with the hidden test data/label ; or train data/label) </p>",
          "votes": 2,
          "replies": [
            {
              "id": 2562675,
              "author_name": "Igor Krashenyi",
              "author_url": "",
              "post_date": "2023-12-15T15:47:39.670000",
              "content": "<p>My current score is 2.5d :) <br>\nMaybe, I should try my current pipeline with 2d images. Since I almost from the beginning of the competition started with the 2.5d approach. </p>",
              "votes": 3,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2561472,
      "author_name": "Johnny Lee",
      "author_url": "",
      "post_date": "2023-12-14T14:08:34.990000",
      "content": "<p>Thanks for sharing your experience. My best LB is 2D model with 0.82, too. I tried 2.5D, but it didn’t work well. I also tried some small 3D model. It takes too much time to train. The best 3D model is LB 0.748. I think 3D model can work as well as 2D, if we have enough computation power and time.<br>\n I don’t have local surface dice metric yet. Just use LB to evaluate the model, so the threshold may not be the best.</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2561478,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "2023-12-14T14:16:58.177000",
          "content": "<p>\"I don’t have local surface dice metric yet\"<br>\nplease see helper.py attached.</p>\n<pre><code> helper  fast_compute_surface_dice_score_from_tensor\n\npredict =  .... np.((D,H,W), np.) of zero  one value ....\n\nlb_score = fast_compute_surface_dice_score_from_tensor(predict, truth)\n</code></pre>",
          "votes": 7,
          "replies": [
            {
              "id": 2561479,
              "author_name": "Johnny Lee",
              "author_url": "",
              "post_date": "2023-12-14T14:20:58.823000",
              "content": "<p>Thank you. 😀</p>",
              "votes": 0,
              "replies": []
            }
          ]
        },
        {
          "id": 2561879,
          "author_name": "Johnny Lee",
          "author_url": "",
          "post_date": "2023-12-14T23:03:20.943000",
          "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> Thank you for the helper.py, now the 2D model is up to 0.844. The 3D model is on the way.<br>\nWhich size do you use when training the 3D model. 32x32x32, 64x64x64…? Maybe the bigger size can help.</p>",
          "votes": 2,
          "replies": [
            {
              "id": 2561909,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-15T00:16:30.283000",
              "content": "<p>\"now the 2D model is up to 0.844. \"<br>\noh, i should be focusing on 2d instead….</p>\n<p>for 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.<br>\nit needs at lest 256x256. if it is not deep, there is no point trying 2d (just 2.5 d will do) i try 256x256x128.</p>\n<p>the trick is to try a model that don't uses batch norm. then you can just push one or two subvolume in the gpu memory and use gradient accumulation for one batch, </p>\n<p>(google for 3d convnext  that uses LN,GN.)</p>\n<p>e.g.</p>\n<pre><code>    for t, in enumerate(train_loader):\n                output=[]\n        = len(        for in range(            = \n            for k in tensor_key:\n                = \n            with torch.cuda.amp.autocast(enabled=True):  \n                o = net(                output.append(o)\n                vessel_loss = o[f]\n\n             \n        \n        </code></pre>\n<p>my 2d takes one hour and 3d takes 2.5 hour to get reasonable CV.<br>\n(reasonable means good enough to do prameter search and draw conclusion)</p>\n<hr>\n<p>you can also do experiment with 0.5-scale 2d or 3d input.<br>\nhere you are detecting large vessel which is a source of problem</p>\n<hr>\n<p>other methods include gradient check but too slow.</p>\n<p>alternative is to use 2 size:<br>\ntry small 3d 128x128x64 on 0.5 resosolution input (or better on feature map of 3d convo).<br>\ntrain use input= 2 ch = (oringal input + small3d output) for another 3d cnn.</p>\n<p>one detect the large vessel, another detect  small vessel</p>\n<p>disadvantage is that this is not end-to-end (think of this like old kaggle competition when you train a stack model).</p>\n<p>there are ways to train them together if you can connect up big and small net in such a way that you can drop path (i.e. make the model small) during training. the idea is the same as drop path in residual net, effciient, trasnformer etc .. </p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 2561912,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-12-15T00:25:12.490000",
              "content": "<p>\" 2D model is up to 0.844. \"</p>\n<ul>\n<li>3d add +0.02 (from academic papers)</li>\n<li>pretrain with self-supervised +0.02 (maybe relabel kidney3,2 etc … kidney 2 has label bugs, maybe need relabel)</li>\n<li>extern data add 0.01</li>\n<li>post process + 0.01</li>\n</ul>\n<p>maybe that 's  the limit.</p>\n<p>problem is data for training with 3d. hence key could be pretrain with self-supervised.<br>\nanother option is to distill fearture feature from 2d.</p>\n<p>the use of 3d is that it must perform better than 2d.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2587654,
              "author_name": "schaaka",
              "author_url": "",
              "post_date": "2024-01-04T23:22:00.887000",
              "content": "<p>When you say 'for 3d, 32x32x32, 64x64x64 don't work. to test try 64x64 on 2d. the context is tool small.' What is the error resulting from the small context window? (i.e. to many false positives?). Thanks for all of your work and input thus far</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2559984,
      "author_name": "Bhavesh Jain",
      "author_url": "",
      "post_date": "2023-12-13T07:43:56.403000",
      "content": "<p>I can't even reach 0.4 with 2d🥲</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 2610232,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "2024-01-20T02:56:51.117000",
      "content": "<p>WARNING !!!! for those using 3d convolution</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2Ffc44a629ee63f4ac55667477827c3890%2FSelection_999(4639).png?generation=1705719294894768&amp;alt=media\"></p>\n<p>description of attachment image:</p>\n<pre><code>given volume.= D,H,W,\ntop volume.mean()\nvolume.mean()\n</code></pre>\n<p>there seems to be 3d reconstruction in the HiP-CT.<br>\nI wonder if this affects results?<br>\n(espeically for different resolution)</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2610768,
          "author_name": "Ángel Jacinto Sánchez Ruiz",
          "author_url": "",
          "post_date": "2024-01-20T10:23:04.860000",
          "content": "<p>I think is a different issue with my 3D approach. But with K3 my model predicts some regular background noise as vessels. It doesn't affect public LB. I'm .786 right now.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2569817,
      "author_name": "Jekasm19",
      "author_url": "",
      "post_date": "2023-12-21T15:23:39.270000",
      "content": "<p>I got a 3d Unet model working pretty well (not using the official metric, but just using good old dice loss it was getting ~.84) by training on 48x48x48 cutouts. however, running the final prediction keeps giving me memory errors. (just arbitrarily running it on the whole of kidney_2, for example)   This persists no matter how much I try to run it efficiently</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2569956,
          "author_name": "Ángel Jacinto Sánchez Ruiz",
          "author_url": "",
          "post_date": "2023-12-21T17:56:07.050000",
          "content": "<p>Have you checked the confusion matrix of the validation batches? I've been getting similar results with all 0 predictions.</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2580023,
              "author_name": "Jekasm19",
              "author_url": "",
              "post_date": "2023-12-30T14:04:06.957000",
              "content": "<p>Yeah, it’s looking pretty accurate for the most part. False positives and some glob type things and missing the really tiny vessels though.</p>",
              "votes": 1,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2588726,
      "author_name": "",
      "author_url": "",
      "post_date": "2024-01-05T17:17:12.407000",
      "content": "",
      "votes": 2,
      "replies": []
    },
    {
      "id": 2560145,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-12-13T10:29:51.800000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2559935": "i tried convolution like 3d cnn unet or 3d transformer unetr and variants.\ni also tried 2.5d unets and 2d/3d hybrids.\n\nWhile performances (surface dice) for 2d, 2.5d, 3d and hybrids are comparable in local validations, the performance for public lb is considerable worse for non 2d model.\n\ne.g. \n- 2d model: easily achieved lb 0.82 and above\n- 2d, 2.5d, 3d and hybrids model: only up to lb 0.75\n\n2d, 2.5d, 3d and hybrids models: 0.88 to 0.90 local cv\n\n---\n\nit not sure what is the problems, could be:\n- not enough train data/augmentation for 3d\n- not enough resolution/context for 3d\n- network not deep enough\n\nit takes too much time and compute to do experiment for 3d. hence if you have results/observations to share, it would be of great help to pin point the problem.",
    "2567803": "My current 3D based LB is 0.77, with a local CV of 0.885-0.90.  Patch size is (64, 256, 256),   I'm trying out more data augmentation to see if it can be improved. Have you made any breakthroughs so far?",
    "2562157": "I just started experimenting with 2.5D.\nfor the same model (same encoder-decoder) and hyperparamters:\n| Model |  CV(kidney_3_dense)| LB\n| --- | --- |\n| 2D | 0.868 | 0.843\n| 2.5D | 0.878 | 0.816\n",
    "2594751": " have a pure 3d Unet network, currently at 0.87\n\nI think the main problem is small block sizes as input, as you will miss context beyond the block. I found a way around that.",
    "2587283": "0.626 public LB trained 5 epochs on kidney_1 and with a bit buggy inference. That starts to work.",
    "2565244": "I have public score of 0.811 with 3D so far. Far from ideal yet, but still got several ideas to test.",
    "2562651": "I didn't succeed for now with the 3d as well. ",
    "2561472": "Thanks for sharing your experience. My best LB is 2D model with 0.82, too. I tried 2.5D, but it didn’t work well. I also tried some small 3D model. It takes too much time to train. The best 3D model is LB 0.748. I think 3D model can work as well as 2D, if we have enough computation power and time.\n I don’t have local surface dice metric yet. Just use LB to evaluate the model, so the threshold may not be the best.",
    "2559984": "I can't even reach 0.4 with 2d🥲",
    "2610232": "WARNING !!!! for those using 3d convolution\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2Ffc44a629ee63f4ac55667477827c3890%2FSelection_999(4639).png?generation=1705719294894768&alt=media)\n\ndescription of attachment image:\n```\ngiven volume.shape = D,H,W,\ntop shows volume.mean(0)\nbottom shows volume.mean(1)\n```\n\nthere seems to be 3d reconstruction in the HiP-CT.\nI wonder if this affects results?\n(espeically for different resolution)",
    "2569817": "I got a 3d Unet model working pretty well (not using the official metric, but just using good old dice loss it was getting ~.84) by training on 48x48x48 cutouts. however, running the final prediction keeps giving me memory errors. (just arbitrarily running it on the whole of kidney_2, for example)   This persists no matter how much I try to run it efficiently",
    "2588726": "",
    "2560145": ""
  }
}