{
  "id": 117975,
  "title": "19th place solution with code",
  "url": "/competitions/understanding_cloud_organization/discussion/117975",
  "author_name": "Camaro",
  "post_date": "2019-11-19T02:52:18.267000",
  "votes": 31,
  "comment_count": 13,
  "views": 0,
  "content": "<p>Congrats for all the prize winner and who finished in gold zone!</p>\n\n<p>I joined this competition relatively lately, after Severstal competition finished.(I believe same as many people, don't you?) \nMy purpose was to make sure the segmentation pipeline I made in Severstal works for other competition. And it turned out it actually works, I just modified directory and some small parameters. That means my solution is not so special, honestly.\n<br></p>\n\n<h3>Overview</h3>\n\n<ul>\n<li>Extremely noisy annotation</li>\n<li>Not so imbalanced classes (compared with Severstal)</li>\n<li>Relatively small data(number of samples)</li>\n<li><p>Good train/test split(cv works)\n<br></p>\n\n<h3>What works</h3></li>\n<li><p>Unet &amp; FPN</p></li>\n<li>not so large encoder</li>\n<li>BCE + Dice loss</li>\n<li>heavy augmentation(including mixup)</li>\n<li>cosine anealing</li>\n<li>ensemble many models</li>\n<li><p>Triplet thresholding(label threshold/mask threshold/min componet)\n<br></p>\n\n<h3>What didn't works</h3></li>\n<li><p>PSPNet</p></li>\n<li>large image size(over 448*672)</li>\n<li>plane BCE</li>\n<li>pseudo labeling</li>\n</ul>\n\n<h3>Solution</h3>\n\n<ol>\n<li>Unet/efficientnet-b3/image size 320x480/5fold</li>\n<li>Unet/efficientnet-b0/image size 320x480/cosineanealing/5fold</li>\n<li>Unet/efficientnet-b3/image size 384x576/cosineanealing/5fold</li>\n<li>FPN/resnet34/image size 384x576/mixup/5fold</li>\n<li>Ensemble above 20 models</li>\n<li>Triplet thresholding(label threshold/mask threshold/min componet)</li>\n</ol>\n\n<hr>\n\n<p>Here is my code. <br>\nIf you have question, please feel free to ask:)\nThanks!</p>\n\n<p><a href=\"https://github.com/bamps53/kaggle-cloud-2019\">https://github.com/bamps53/kaggle-cloud-2019</a></p>",
  "messages": [
    {
      "id": 676205,
      "postDate": "2019-11-19T02:52:18.267Z",
      "content": "<p>Congrats for all the prize winner and who finished in gold zone!</p>\n\n<p>I joined this competition relatively lately, after Severstal competition finished.(I believe same as many people, don't you?) \nMy purpose was to make sure the segmentation pipeline I made in Severstal works for other competition. And it turned out it actually works, I just modified directory and some small parameters. That means my solution is not so special, honestly.\n<br></p>\n\n<h3>Overview</h3>\n\n<ul>\n<li>Extremely noisy annotation</li>\n<li>Not so imbalanced classes (compared with Severstal)</li>\n<li>Relatively small data(number of samples)</li>\n<li><p>Good train/test split(cv works)\n<br></p>\n\n<h3>What works</h3></li>\n<li><p>Unet &amp; FPN</p></li>\n<li>not so large encoder</li>\n<li>BCE + Dice loss</li>\n<li>heavy augmentation(including mixup)</li>\n<li>cosine anealing</li>\n<li>ensemble many models</li>\n<li><p>Triplet thresholding(label threshold/mask threshold/min componet)\n<br></p>\n\n<h3>What didn't works</h3></li>\n<li><p>PSPNet</p></li>\n<li>large image size(over 448*672)</li>\n<li>plane BCE</li>\n<li>pseudo labeling</li>\n</ul>\n\n<h3>Solution</h3>\n\n<ol>\n<li>Unet/efficientnet-b3/image size 320x480/5fold</li>\n<li>Unet/efficientnet-b0/image size 320x480/cosineanealing/5fold</li>\n<li>Unet/efficientnet-b3/image size 384x576/cosineanealing/5fold</li>\n<li>FPN/resnet34/image size 384x576/mixup/5fold</li>\n<li>Ensemble above 20 models</li>\n<li>Triplet thresholding(label threshold/mask threshold/min componet)</li>\n</ol>\n\n<hr>\n\n<p>Here is my code. <br>\nIf you have question, please feel free to ask:)\nThanks!</p>\n\n<p><a href=\"https://github.com/bamps53/kaggle-cloud-2019\">https://github.com/bamps53/kaggle-cloud-2019</a></p>",
      "rawMarkdown": "Congrats for all the prize winner and who finished in gold zone!\n\nI joined this competition relatively lately, after Severstal competition finished.(I believe same as many people, don't you?) \nMy purpose was to make sure the segmentation pipeline I made in Severstal works for other competition. And it turned out it actually works, I just modified directory and some small parameters. That means my solution is not so special, honestly.\n<br>\n### Overview\n- Extremely noisy annotation\n- Not so imbalanced classes (compared with Severstal)\n- Relatively small data(number of samples)\n- Good train/test split(cv works)\n<br>\n### What works\n- Unet &amp; FPN\n- not so large encoder\n- BCE + Dice loss\n- heavy augmentation(including mixup)\n- cosine anealing\n- ensemble many models\n- Triplet thresholding(label threshold/mask threshold/min componet)\n<br>\n### What didn't works\n- PSPNet\n- large image size(over 448*672)\n- plane BCE\n- pseudo labeling\n\n### Solution\n1. Unet/efficientnet-b3/image size 320x480/5fold\n2. Unet/efficientnet-b0/image size 320x480/cosineanealing/5fold\n3. Unet/efficientnet-b3/image size 384x576/cosineanealing/5fold\n4. FPN/resnet34/image size 384x576/mixup/5fold\n5. Ensemble above 20 models\n6. Triplet thresholding(label threshold/mask threshold/min componet)\n\n----\nHere is my code.  \nIf you have question, please feel free to ask:)\nThanks!\n\nhttps://github.com/bamps53/kaggle-cloud-2019\n\n\n\n",
      "votes": 31
    },
    {
      "id": 678831,
      "postDate": "2019-11-22T00:23:41.143Z",
      "content": "<p>Congratulations on getting silver!</p>\n\n<p>I'm seeing you are creating almost empty <strong>init</strong>.py file where you are importing a module. I've seen this in a couple of other pipelines. Is this some kind of a programming pattern? </p>",
      "rawMarkdown": "Congratulations on getting silver!\n\nI'm seeing you are creating almost empty __init__.py file where you are importing a module. I've seen this in a couple of other pipelines. Is this some kind of a programming pattern? ",
      "votes": 1
    },
    {
      "id": 676273,
      "postDate": "2019-11-19T04:09:58.763Z",
      "content": "<p>It  seems  that   I  gotta  to  read  your  code  again .</p>",
      "rawMarkdown": "It  seems  that   I  gotta  to  read  your  code  again .",
      "votes": 1,
      "replies": [
        {
          "id": 676318,
          "postDate": "2019-11-19T04:53:17.977Z",
          "content": "<p>No, you don't need because it's almost same😹 </p>",
          "rawMarkdown": "No, you don't need because it's almost same😹 "
        }
      ]
    },
    {
      "id": 767784,
      "postDate": "2020-03-10T04:58:26.333Z",
      "content": "<p>Thank you, as a beginner, I have a problem, your code is in the form of a project, but you use Kaggle or Colab's GPU in it, I'm curious how to run this project in a notebook, I tried a few Times, but  need to change a lot of paths, so are you running locally?</p>",
      "rawMarkdown": "Thank you, as a beginner, I have a problem, your code is in the form of a project, but you use Kaggle or Colab's GPU in it, I'm curious how to run this project in a notebook, I tried a few Times, but  need to change a lot of paths, so are you running locally?"
    },
    {
      "id": 732540,
      "postDate": "2020-01-29T23:28:20.420Z",
      "content": "<p><a href=\"/bamps53\">@bamps53</a> I tried to run your code. The resnet backbone folds work fine but the efficientnet backbones through an error when segmentation_models_pytorch tries to download the model I think. Any idea how to fix that?</p>\n\n<p>train Segmentation model.\nload config from config/seg/030_efnet_b0_Unet_bs16_half_cosine_fold0.yml\nworking directory: 030_efnet_b0_Unet_bs16_half_cosine_fold0\nDownloading: \"<a href=\"http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth\">http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth</a>\" to /home/yousef/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth\nTraceback (most recent call last):\n  File \"train.py\", line 132, in \n   main()\nFile \"train.py\", line 128, in main\n    run(args.config_file)\n  File \"train.py\", line 58, in run\n    activation=None,\n  File \"/home/yousef/anaconda3/envs/kaggle/lib/python3.7/site-packages/segmentation_models_pytorch/unet/model.py\", line 63, in <strong>init</strong>\n    weights=encoder_weights,\n..................................................................................\nraise HTTPError(req.full_url, code, msg, hdrs, fp)\nurllib.error.HTTPError: HTTP Error 403: Forbidden</p>",
      "rawMarkdown": "@bamps53 I tried to run your code. The resnet backbone folds work fine but the efficientnet backbones through an error when segmentation_models_pytorch tries to download the model I think. Any idea how to fix that?\n\ntrain Segmentation model.\nload config from config/seg/030_efnet_b0_Unet_bs16_half_cosine_fold0.yml\nworking directory: 030_efnet_b0_Unet_bs16_half_cosine_fold0\nDownloading: \"http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth\" to /home/yousef/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth\nTraceback (most recent call last):\n  File \"train.py\", line 132, in \n   main()\nFile \"train.py\", line 128, in main\n    run(args.config_file)\n  File \"train.py\", line 58, in run\n    activation=None,\n  File \"/home/yousef/anaconda3/envs/kaggle/lib/python3.7/site-packages/segmentation_models_pytorch/unet/model.py\", line 63, in __init__\n    weights=encoder_weights,\n..................................................................................\nraise HTTPError(req.full_url, code, msg, hdrs, fp)\nurllib.error.HTTPError: HTTP Error 403: Forbidden",
      "replies": [
        {
          "id": 732630,
          "postDate": "2020-01-30T03:00:38.847Z",
          "content": "<p>pip install --upgrade efficientnet-pytorch should do it because the latest update of EfficientNet-PyTorch changed the hosting providers of the pretrained models and segmentation_models_pytorch by default installs the old efficientnet-pytorch.</p>",
          "rawMarkdown": "pip install --upgrade efficientnet-pytorch should do it because the latest update of EfficientNet-PyTorch changed the hosting providers of the pretrained models and segmentation_models_pytorch by default installs the old efficientnet-pytorch."
        }
      ]
    },
    {
      "id": 676616,
      "postDate": "2019-11-19T11:02:49.220Z",
      "content": "<p>congratulations, Camaro, thanks for your sharing</p>\n\n<p>almost got gold, good luck next time</p>",
      "rawMarkdown": "congratulations, Camaro, thanks for your sharing\n\nalmost got gold, good luck next time"
    },
    {
      "id": 676346,
      "postDate": "2019-11-19T05:22:16.877Z",
      "content": "<p>large image size(over 448*672) didn't work? very very strange!</p>",
      "rawMarkdown": "large image size(over 448*672) didn't work? very very strange!"
    },
    {
      "id": 676222,
      "postDate": "2019-11-19T03:13:00.157Z",
      "content": "<p>Nice! Thanks for sharing! And congratulations!!!</p>",
      "rawMarkdown": "Nice! Thanks for sharing! And congratulations!!!"
    },
    {
      "id": 676338,
      "postDate": "2019-11-19T05:15:00.130Z",
      "rawMarkdown": "",
      "isDeleted": true
    },
    {
      "id": 685639,
      "postDate": "2019-12-02T03:18:13.327Z",
      "content": "<p>Thanks for sharing!</p>",
      "rawMarkdown": "Thanks for sharing!"
    },
    {
      "id": 678753,
      "postDate": "2019-11-21T20:21:53.843Z",
      "content": "<p>Thanks for sharing!</p>",
      "rawMarkdown": "Thanks for sharing!"
    },
    {
      "id": 676333,
      "postDate": "2019-11-19T05:10:33.687Z",
      "content": "<p>Thanks for sharing and congratulations!</p>",
      "rawMarkdown": "Thanks for sharing and congratulations!"
    }
  ],
  "comments": [
    {
      "id": 678831,
      "author_name": "Cyr1ll",
      "author_url": "",
      "post_date": "2019-11-22T00:23:41.143000",
      "content": "<p>Congratulations on getting silver!</p>\n\n<p>I'm seeing you are creating almost empty <strong>init</strong>.py file where you are importing a module. I've seen this in a couple of other pipelines. Is this some kind of a programming pattern? </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 676273,
      "author_name": "哈尔的移动城堡",
      "author_url": "",
      "post_date": "2019-11-19T04:09:58.763000",
      "content": "<p>It  seems  that   I  gotta  to  read  your  code  again .</p>",
      "votes": 1,
      "replies": [
        {
          "id": 676318,
          "author_name": "Camaro",
          "author_url": "",
          "post_date": "2019-11-19T04:53:17.977000",
          "content": "<p>No, you don't need because it's almost same😹 </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 767784,
      "author_name": "guigui",
      "author_url": "",
      "post_date": "2020-03-10T04:58:26.333000",
      "content": "<p>Thank you, as a beginner, I have a problem, your code is in the form of a project, but you use Kaggle or Colab's GPU in it, I'm curious how to run this project in a notebook, I tried a few Times, but  need to change a lot of paths, so are you running locally?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 732540,
      "author_name": "Yousef Rabi",
      "author_url": "",
      "post_date": "2020-01-29T23:28:20.420000",
      "content": "<p><a href=\"/bamps53\">@bamps53</a> I tried to run your code. The resnet backbone folds work fine but the efficientnet backbones through an error when segmentation_models_pytorch tries to download the model I think. Any idea how to fix that?</p>\n\n<p>train Segmentation model.\nload config from config/seg/030_efnet_b0_Unet_bs16_half_cosine_fold0.yml\nworking directory: 030_efnet_b0_Unet_bs16_half_cosine_fold0\nDownloading: \"<a href=\"http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth\">http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth</a>\" to /home/yousef/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth\nTraceback (most recent call last):\n  File \"train.py\", line 132, in \n   main()\nFile \"train.py\", line 128, in main\n    run(args.config_file)\n  File \"train.py\", line 58, in run\n    activation=None,\n  File \"/home/yousef/anaconda3/envs/kaggle/lib/python3.7/site-packages/segmentation_models_pytorch/unet/model.py\", line 63, in <strong>init</strong>\n    weights=encoder_weights,\n..................................................................................\nraise HTTPError(req.full_url, code, msg, hdrs, fp)\nurllib.error.HTTPError: HTTP Error 403: Forbidden</p>",
      "votes": 0,
      "replies": [
        {
          "id": 732630,
          "author_name": "Yousef Rabi",
          "author_url": "",
          "post_date": "2020-01-30T03:00:38.847000",
          "content": "<p>pip install --upgrade efficientnet-pytorch should do it because the latest update of EfficientNet-PyTorch changed the hosting providers of the pretrained models and segmentation_models_pytorch by default installs the old efficientnet-pytorch.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676616,
      "author_name": "liuze",
      "author_url": "",
      "post_date": "2019-11-19T11:02:49.220000",
      "content": "<p>congratulations, Camaro, thanks for your sharing</p>\n\n<p>almost got gold, good luck next time</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 676346,
      "author_name": "Mobassir",
      "author_url": "",
      "post_date": "2019-11-19T05:22:16.877000",
      "content": "<p>large image size(over 448*672) didn't work? very very strange!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 676222,
      "author_name": "Hieu Phung",
      "author_url": "",
      "post_date": "2019-11-19T03:13:00.157000",
      "content": "<p>Nice! Thanks for sharing! And congratulations!!!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 676338,
      "author_name": "",
      "author_url": "",
      "post_date": "2019-11-19T05:15:00.130000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 685639,
      "author_name": "cswwp",
      "author_url": "",
      "post_date": "2019-12-02T03:18:13.327000",
      "content": "<p>Thanks for sharing!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 678753,
      "author_name": "Georgi Pamukov",
      "author_url": "",
      "post_date": "2019-11-21T20:21:53.843000",
      "content": "<p>Thanks for sharing!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 676333,
      "author_name": "John",
      "author_url": "",
      "post_date": "2019-11-19T05:10:33.687000",
      "content": "<p>Thanks for sharing and congratulations!</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "676205": "Congrats for all the prize winner and who finished in gold zone!\n\nI joined this competition relatively lately, after Severstal competition finished.(I believe same as many people, don't you?) \nMy purpose was to make sure the segmentation pipeline I made in Severstal works for other competition. And it turned out it actually works, I just modified directory and some small parameters. That means my solution is not so special, honestly.\n<br>\n### Overview\n- Extremely noisy annotation\n- Not so imbalanced classes (compared with Severstal)\n- Relatively small data(number of samples)\n- Good train/test split(cv works)\n<br>\n### What works\n- Unet &amp; FPN\n- not so large encoder\n- BCE + Dice loss\n- heavy augmentation(including mixup)\n- cosine anealing\n- ensemble many models\n- Triplet thresholding(label threshold/mask threshold/min componet)\n<br>\n### What didn't works\n- PSPNet\n- large image size(over 448*672)\n- plane BCE\n- pseudo labeling\n\n### Solution\n1. Unet/efficientnet-b3/image size 320x480/5fold\n2. Unet/efficientnet-b0/image size 320x480/cosineanealing/5fold\n3. Unet/efficientnet-b3/image size 384x576/cosineanealing/5fold\n4. FPN/resnet34/image size 384x576/mixup/5fold\n5. Ensemble above 20 models\n6. Triplet thresholding(label threshold/mask threshold/min componet)\n\n----\nHere is my code.  \nIf you have question, please feel free to ask:)\nThanks!\n\nhttps://github.com/bamps53/kaggle-cloud-2019\n\n\n\n",
    "678831": "Congratulations on getting silver!\n\nI'm seeing you are creating almost empty __init__.py file where you are importing a module. I've seen this in a couple of other pipelines. Is this some kind of a programming pattern? ",
    "676273": "It  seems  that   I  gotta  to  read  your  code  again .",
    "767784": "Thank you, as a beginner, I have a problem, your code is in the form of a project, but you use Kaggle or Colab's GPU in it, I'm curious how to run this project in a notebook, I tried a few Times, but  need to change a lot of paths, so are you running locally?",
    "732540": "@bamps53 I tried to run your code. The resnet backbone folds work fine but the efficientnet backbones through an error when segmentation_models_pytorch tries to download the model I think. Any idea how to fix that?\n\ntrain Segmentation model.\nload config from config/seg/030_efnet_b0_Unet_bs16_half_cosine_fold0.yml\nworking directory: 030_efnet_b0_Unet_bs16_half_cosine_fold0\nDownloading: \"http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth\" to /home/yousef/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth\nTraceback (most recent call last):\n  File \"train.py\", line 132, in \n   main()\nFile \"train.py\", line 128, in main\n    run(args.config_file)\n  File \"train.py\", line 58, in run\n    activation=None,\n  File \"/home/yousef/anaconda3/envs/kaggle/lib/python3.7/site-packages/segmentation_models_pytorch/unet/model.py\", line 63, in __init__\n    weights=encoder_weights,\n..................................................................................\nraise HTTPError(req.full_url, code, msg, hdrs, fp)\nurllib.error.HTTPError: HTTP Error 403: Forbidden",
    "676616": "congratulations, Camaro, thanks for your sharing\n\nalmost got gold, good luck next time",
    "676346": "large image size(over 448*672) didn't work? very very strange!",
    "676222": "Nice! Thanks for sharing! And congratulations!!!",
    "676338": "",
    "685639": "Thanks for sharing!",
    "678753": "Thanks for sharing!",
    "676333": "Thanks for sharing and congratulations!"
  }
}