{
  "id": 417323,
  "title": "33d place solution",
  "url": "/competitions/vesuvius-challenge-ink-detection/discussion/417323",
  "author_name": "",
  "post_date": "2023-06-15T08:37:51.873308Z",
  "votes": 10,
  "comment_count": 4,
  "views": 0,
  "content": "<p>This was my first serious Kaggle competition, and I have been working more or less full time for the past 2 months on it. It's pretty amazing how much one can learn from being committed on Kaggle. </p>\n<p>I especially would like to thank:</p>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> for sharing his inference and training pipeline pretty early on. Coming from a background of FastAI, I started using that when joining the competition. However, I had a hard time customizing FastAI for this competition and found that FastAI is easy and nice for tasks like image classification but for anything more customized it get's a bit tricky since you have to dive into the details of the library itself, which is.. not very straight-forward. I found the code shared by <a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> truely amazing, very well build and organized and a great way to start with standard PyTorch. I believe I will use this basic structure for more competitions :)</p></li>\n<li><p><a href=\"https://www.kaggle.com/yoyobar\" target=\"_blank\">@yoyobar</a> for sharing his 3D Unet pipeline that also build of the work of <a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> for sharing so much on all his experiments.</p></li>\n</ul>\n<p>My best submission:</p>\n<ul>\n<li>Resnet3D as in <a href=\"https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference\" target=\"_blank\">https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference</a></li>\n<li>pretrained weights: r3d18_K_200ep.pth from <a href=\"https://github.com/kenshohara/3D-ResNets-PyTorch\" target=\"_blank\">https://github.com/kenshohara/3D-ResNets-PyTorch</a></li>\n<li>splitting the fragments vertically (top and bottom) into 2: (1a, 1b, 2a, 2b, 3a, 3b)</li>\n<li>validation on 1a, train on the rest</li>\n<li>heavy data augmentation, including cutmix</li>\n<li>16 slices into the network</li>\n<li>train dataset selects 16 slices around 28-32 midpoint at random</li>\n<li>image size: 224</li>\n<li>train-stride = 224//2</li>\n<li>test-stride = 224//8</li>\n<li>lr 1e-4</li>\n<li>train with both masks and ir image as label</li>\n<li>loss: [mask: ]Dice + BCE (no smoothing) + [ir] MSE</li>\n<li>scheduler: onecyclelr</li>\n<li>30 epchs</li>\n<li>always use threshold 0.5</li>\n<li>tta</li>\n<li>denoising</li>\n</ul>",
  "messages": [
    {
      "id": "2303327",
      "postDate": "06/15/2023 08:37:51",
      "content": "<p>This was my first serious Kaggle competition, and I have been working more or less full time for the past 2 months on it. It's pretty amazing how much one can learn from being committed on Kaggle. </p>\n<p>I especially would like to thank:</p>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> for sharing his inference and training pipeline pretty early on. Coming from a background of FastAI, I started using that when joining the competition. However, I had a hard time customizing FastAI for this competition and found that FastAI is easy and nice for tasks like image classification but for anything more customized it get's a bit tricky since you have to dive into the details of the library itself, which is.. not very straight-forward. I found the code shared by <a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> truely amazing, very well build and organized and a great way to start with standard PyTorch. I believe I will use this basic structure for more competitions :)</p></li>\n<li><p><a href=\"https://www.kaggle.com/yoyobar\" target=\"_blank\">@yoyobar</a> for sharing his 3D Unet pipeline that also build of the work of <a href=\"https://www.kaggle.com/tanakar\" target=\"_blank\">@tanakar</a> </p></li>\n<li><p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> for sharing so much on all his experiments.</p></li>\n</ul>\n<p>My best submission:</p>\n<ul>\n<li>Resnet3D as in <a href=\"https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference\" target=\"_blank\">https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference</a></li>\n<li>pretrained weights: r3d18_K_200ep.pth from <a href=\"https://github.com/kenshohara/3D-ResNets-PyTorch\" target=\"_blank\">https://github.com/kenshohara/3D-ResNets-PyTorch</a></li>\n<li>splitting the fragments vertically (top and bottom) into 2: (1a, 1b, 2a, 2b, 3a, 3b)</li>\n<li>validation on 1a, train on the rest</li>\n<li>heavy data augmentation, including cutmix</li>\n<li>16 slices into the network</li>\n<li>train dataset selects 16 slices around 28-32 midpoint at random</li>\n<li>image size: 224</li>\n<li>train-stride = 224//2</li>\n<li>test-stride = 224//8</li>\n<li>lr 1e-4</li>\n<li>train with both masks and ir image as label</li>\n<li>loss: [mask: ]Dice + BCE (no smoothing) + [ir] MSE</li>\n<li>scheduler: onecyclelr</li>\n<li>30 epchs</li>\n<li>always use threshold 0.5</li>\n<li>tta</li>\n<li>denoising</li>\n</ul>",
      "rawMarkdown": "This was my first serious Kaggle competition, and I have been working more or less full time for the past 2 months on it. It's pretty amazing how much one can learn from being committed on Kaggle. \n\nI especially would like to thank:\n\n- @tanakar for sharing his inference and training pipeline pretty early on. Coming from a background of FastAI, I started using that when joining the competition. However, I had a hard time customizing FastAI for this competition and found that FastAI is easy and nice for tasks like image classification but for anything more customized it get's a bit tricky since you have to dive into the details of the library itself, which is.. not very straight-forward. I found the code shared by @tanakar truely amazing, very well build and organized and a great way to start with standard PyTorch. I believe I will use this basic structure for more competitions :)\n\n- @yoyobar for sharing his 3D Unet pipeline that also build of the work of @tanakar \n\n- @hengck23 for sharing so much on all his experiments.\n\nMy best submission:\n\n- Resnet3D as in https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference\n- pretrained weights: r3d18_K_200ep.pth from https://github.com/kenshohara/3D-ResNets-PyTorch\n- splitting the fragments vertically (top and bottom) into 2: (1a, 1b, 2a, 2b, 3a, 3b)\n- validation on 1a, train on the rest\n- heavy data augmentation, including cutmix\n- 16 slices into the network\n- train dataset selects 16 slices around 28-32 midpoint at random\n- image size: 224\n- train-stride = 224//2\n- test-stride = 224//8\n- lr 1e-4\n- train with both masks and ir image as label\n- loss: [mask: ]Dice + BCE (no smoothing) + [ir] MSE\n- scheduler: onecyclelr\n- 30 epchs\n- always use threshold 0.5\n- tta\n- denoising",
      "votes": null
    },
    {
      "id": "2309818",
      "postDate": "06/19/2023 22:58:36",
      "content": "<p>Congrats! We started with fastai as well, and spent a significant amount of time on setting up a pipeline. While we got it to work, we weren't able to get a similar performance as tanakar's training pipeline. Could you share some more on the challenges that you've encountered with fastai?</p>",
      "rawMarkdown": "Congrats! We started with fastai as well, and spent a significant amount of time on setting up a pipeline. While we got it to work, we weren't able to get a similar performance as tanakar's training pipeline. Could you share some more on the challenges that you've encountered with fastai?",
      "votes": null
    },
    {
      "id": "2310141",
      "postDate": "06/20/2023 06:24:05",
      "content": "<p>Congratulations on your result for your first \"serious\" competition!</p>\n<p>\"heavy data augmentation, including cutmix\"  - that is interesting. except for rotations, not much about other augmentation like cutmix was mentioned in discussions.  Do you have an idea of how much it helped? </p>\n<p>looking at the 4th place solution post <br>\n<a href=\"https://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779\" target=\"_blank\">https://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779</a><br>\nTemporal random crop &amp; random paste &amp; random cutout was important and cutmix augmentation as well.</p>",
      "rawMarkdown": "Congratulations on your result for your first \"serious\" competition!\n\n\"heavy data augmentation, including cutmix\"  - that is interesting. except for rotations, not much about other augmentation like cutmix was mentioned in discussions.  Do you have an idea of how much it helped? \n\nlooking at the 4th place solution post \nhttps://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779\nTemporal random crop & random paste & random cutout was important and cutmix augmentation as well.",
      "votes": null
    },
    {
      "id": "2310231",
      "postDate": "06/20/2023 08:09:25",
      "content": "<p>Thanks! To be honest I'm not really sure how much it helped. But I remember it worked quite a bit with overcoming the overfitting.</p>\n<p>I believe this was even more important:</p>\n<ul>\n<li>16 slices into the network</li>\n<li>the train dataset selects 16 slices around 28-32 midpoint at random</li>\n</ul>\n<p>So to actually feed the network different random crops in the z-direction</p>",
      "rawMarkdown": "Thanks! To be honest I'm not really sure how much it helped. But I remember it worked quite a bit with overcoming the overfitting.\n\nI believe this was even more important:\n\n- 16 slices into the network\n- the train dataset selects 16 slices around 28-32 midpoint at random\n\nSo to actually feed the network different random crops in the z-direction",
      "votes": null
    },
    {
      "id": "2310238",
      "postDate": "06/20/2023 08:19:17",
      "content": "<p>Thanks! I experienced the same, I got stuck around a local performance of around 0.2 when trying to replicate <a href=\"https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training\" target=\"_blank\">https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training</a>. I really couldn't figure out why it was doing so much worse, and in the end gave up and turned to PyTorch.</p>\n<p>Other issues I encountered with FastAI were for example getting 3D data to work \"nicely\" in fastai, for example so that the show_batch and show_results methods work. That was quite a hassle, because you have to dive deep into the internals of FastAI. </p>\n<p>See for example: <a href=\"https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw\" target=\"_blank\">https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw</a><br>\nand: <a href=\"https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5\" target=\"_blank\">https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5</a></p>\n<p>Especially the first example shows well how tricky it can become to fix stuff in FastAI, because the lib uses to many non-standard conventions and structures (after_item ?! retain_types ?!) to make sure all the high level API's work, that you have to be an expert at \"fastai\" besides being an expert in machine learning. </p>\n<p>For me, it was way easier to get to grips with PyTorch instead</p>",
      "rawMarkdown": "Thanks! I experienced the same, I got stuck around a local performance of around 0.2 when trying to replicate https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training. I really couldn't figure out why it was doing so much worse, and in the end gave up and turned to PyTorch.\n\nOther issues I encountered with FastAI were for example getting 3D data to work \"nicely\" in fastai, for example so that the show_batch and show_results methods work. That was quite a hassle, because you have to dive deep into the internals of FastAI. \n\nSee for example: https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw\nand: https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5\n\nEspecially the first example shows well how tricky it can become to fix stuff in FastAI, because the lib uses to many non-standard conventions and structures (after_item ?! retain_types ?!) to make sure all the high level API's work, that you have to be an expert at \"fastai\" besides being an expert in machine learning. \n\nFor me, it was way easier to get to grips with PyTorch instead",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2309818,
      "author_name": "headsortails",
      "author_url": "",
      "post_date": "06/19/2023 22:58:36",
      "content": "<p>Congrats! We started with fastai as well, and spent a significant amount of time on setting up a pipeline. While we got it to work, we weren't able to get a similar performance as tanakar's training pipeline. Could you share some more on the challenges that you've encountered with fastai?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2310238,
          "author_name": "lucasvw",
          "author_url": "",
          "post_date": "06/20/2023 08:19:17",
          "content": "<p>Thanks! I experienced the same, I got stuck around a local performance of around 0.2 when trying to replicate <a href=\"https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training\" target=\"_blank\">https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training</a>. I really couldn't figure out why it was doing so much worse, and in the end gave up and turned to PyTorch.</p>\n<p>Other issues I encountered with FastAI were for example getting 3D data to work \"nicely\" in fastai, for example so that the show_batch and show_results methods work. That was quite a hassle, because you have to dive deep into the internals of FastAI. </p>\n<p>See for example: <a href=\"https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw\" target=\"_blank\">https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw</a><br>\nand: <a href=\"https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5\" target=\"_blank\">https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5</a></p>\n<p>Especially the first example shows well how tricky it can become to fix stuff in FastAI, because the lib uses to many non-standard conventions and structures (after_item ?! retain_types ?!) to make sure all the high level API's work, that you have to be an expert at \"fastai\" besides being an expert in machine learning. </p>\n<p>For me, it was way easier to get to grips with PyTorch instead</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2310141,
      "author_name": "something4kag",
      "author_url": "",
      "post_date": "06/20/2023 06:24:05",
      "content": "<p>Congratulations on your result for your first \"serious\" competition!</p>\n<p>\"heavy data augmentation, including cutmix\"  - that is interesting. except for rotations, not much about other augmentation like cutmix was mentioned in discussions.  Do you have an idea of how much it helped? </p>\n<p>looking at the 4th place solution post <br>\n<a href=\"https://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779\" target=\"_blank\">https://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779</a><br>\nTemporal random crop &amp; random paste &amp; random cutout was important and cutmix augmentation as well.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2310231,
          "author_name": "lucasvw",
          "author_url": "",
          "post_date": "06/20/2023 08:09:25",
          "content": "<p>Thanks! To be honest I'm not really sure how much it helped. But I remember it worked quite a bit with overcoming the overfitting.</p>\n<p>I believe this was even more important:</p>\n<ul>\n<li>16 slices into the network</li>\n<li>the train dataset selects 16 slices around 28-32 midpoint at random</li>\n</ul>\n<p>So to actually feed the network different random crops in the z-direction</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2303327": "This was my first serious Kaggle competition, and I have been working more or less full time for the past 2 months on it. It's pretty amazing how much one can learn from being committed on Kaggle. \n\nI especially would like to thank:\n\n- @tanakar for sharing his inference and training pipeline pretty early on. Coming from a background of FastAI, I started using that when joining the competition. However, I had a hard time customizing FastAI for this competition and found that FastAI is easy and nice for tasks like image classification but for anything more customized it get's a bit tricky since you have to dive into the details of the library itself, which is.. not very straight-forward. I found the code shared by @tanakar truely amazing, very well build and organized and a great way to start with standard PyTorch. I believe I will use this basic structure for more competitions :)\n\n- @yoyobar for sharing his 3D Unet pipeline that also build of the work of @tanakar \n\n- @hengck23 for sharing so much on all his experiments.\n\nMy best submission:\n\n- Resnet3D as in https://www.kaggle.com/code/yoyobar/3d-resnet-baseline-inference\n- pretrained weights: r3d18_K_200ep.pth from https://github.com/kenshohara/3D-ResNets-PyTorch\n- splitting the fragments vertically (top and bottom) into 2: (1a, 1b, 2a, 2b, 3a, 3b)\n- validation on 1a, train on the rest\n- heavy data augmentation, including cutmix\n- 16 slices into the network\n- train dataset selects 16 slices around 28-32 midpoint at random\n- image size: 224\n- train-stride = 224//2\n- test-stride = 224//8\n- lr 1e-4\n- train with both masks and ir image as label\n- loss: [mask: ]Dice + BCE (no smoothing) + [ir] MSE\n- scheduler: onecyclelr\n- 30 epchs\n- always use threshold 0.5\n- tta\n- denoising",
    "2309818": "Congrats! We started with fastai as well, and spent a significant amount of time on setting up a pipeline. While we got it to work, we weren't able to get a similar performance as tanakar's training pipeline. Could you share some more on the challenges that you've encountered with fastai?",
    "2310141": "Congratulations on your result for your first \"serious\" competition!\n\n\"heavy data augmentation, including cutmix\"  - that is interesting. except for rotations, not much about other augmentation like cutmix was mentioned in discussions.  Do you have an idea of how much it helped? \n\nlooking at the 4th place solution post \nhttps://www.kaggle.com/competitions/vesuvius-challenge-ink-detection/discussion/417779\nTemporal random crop & random paste & random cutout was important and cutmix augmentation as well.",
    "2310231": "Thanks! To be honest I'm not really sure how much it helped. But I remember it worked quite a bit with overcoming the overfitting.\n\nI believe this was even more important:\n\n- 16 slices into the network\n- the train dataset selects 16 slices around 28-32 midpoint at random\n\nSo to actually feed the network different random crops in the z-direction",
    "2310238": "Thanks! I experienced the same, I got stuck around a local performance of around 0.2 when trying to replicate https://www.kaggle.com/code/tanakar/2-5d-segmentaion-baseline-training. I really couldn't figure out why it was doing so much worse, and in the end gave up and turned to PyTorch.\n\nOther issues I encountered with FastAI were for example getting 3D data to work \"nicely\" in fastai, for example so that the show_batch and show_results methods work. That was quite a hassle, because you have to dive deep into the internals of FastAI. \n\nSee for example: https://forums.fast.ai/t/metadata-of-a-tensor-subclass-not-available-in-show-batch/93138/2?u=lucasvw\nand: https://towardsdatascience.com/how-to-create-a-datablock-for-multispectral-satellite-image-segmentation-with-the-fastai-v2-bc5e82f4eb5\n\nEspecially the first example shows well how tricky it can become to fix stuff in FastAI, because the lib uses to many non-standard conventions and structures (after_item ?! retain_types ?!) to make sure all the high level API's work, that you have to be an expert at \"fastai\" besides being an expert in machine learning. \n\nFor me, it was way easier to get to grips with PyTorch instead"
  },
  "source": "meta"
}