{
  "id": 117987,
  "title": "5th place solution(single segmentation model private lb 0.66806)",
  "url": "/competitions/understanding_cloud_organization/discussion/117987",
  "author_name": "langzi",
  "post_date": "2019-11-19T04:16:28.926000",
  "votes": 30,
  "comment_count": 29,
  "views": 0,
  "content": "<p>Congratulations to all winners in this competition! This is my first gold medal. I feel so happy.</p>\n\n<p>My solution is ensemble of 3 segmentation models</p>\n\n<h2>Augmentation</h2>\n\n<p>In this competition I found image augmentation is very important. I have tried many different augmentation sets and finally found one set that works good for me. I use albumentation to do image augmentation.\n<code>\naug = Compose([\n        ShiftScaleRotate(scale_limit=0.5, rotate_limit=0, shift_limit=0.1, p=0.6, border_mode=0),\n        OneOf([\n            ElasticTransform(p=0.5, alpha=50, sigma=120 * 0.02, alpha_affine=120 * 0.02),\n            GridDistortion(p=0.5),\n            OpticalDistortion(p=0.5, distort_limit=0.4, shift_limit=0.5)\n        ], p=0.8),\n        RandomRotate90(p=0.5),\n        Resize(352, 544),\n        VerticalFlip(p=0.5),\n        HorizontalFlip(p=0.5),\n        OneOf([\n            IAASharpen(alpha=(0.1, 0.3), p=0.5),\n            CLAHE(p=0.8),\n            GaussNoise(var_limit=(10.0, 50.0), p=0.5),\n            #GaussianBlur(blur_limit=3, p=0.5),\n            ISONoise(color_shift=(0.01, 0.05), intensity=(0.1, 0.5), p=0.3),\n        ], p=0.8),\n        RandomBrightnessContrast(p=0.8),\n        RandomGamma(p=0.8)])\n</code></p>\n\n<h2>Models</h2>\n\n<p><strong>Model1: **\n<code>\nEncoder: efficientnet-b1\nDecoder: unet\nImage Input Size: 416x608\nTTA: hflip, vflip, multi-scale: [(352, 544), (384, 576), (448, 640), (480, 672)] \nThreshold: threshold label = [0.85, 0.92, 0.85, 0.85], threshold pixel = [0.21, 0.44, 0.4, 0.3]\nScore: 9-fold cv = 0.66002, public lb = 0.67070, private lb = 0.66806\n</code>\n**Model2:</strong>\n<code>\nEncoder: efficientnet-b3\nDecoder: fpn\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.85, 0.9, 0.9, 0.85], threshold pixel = [0.35, 0.4, 0.42, 0.42]\nScore: 9-fold cv = 0.65646, public lb = 0.66426, private lb = 0.66687\n</code>\n<strong>Model3:</strong>\n<code>\nEncoder: resnet50\nDecoder: unet\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.9, 0.92, 0.87, 0.82], threshold pixel = [0.35, 0.51, 0.31, 0.3]\nScore: 9-fold cv = 0.65715, public lb = 0.66541, private lb = 0.65973\n</code></p>\n\n<p>All models use bcedice loss and Adam optimizer. Run threshold search to get the threshold label and threshold pixel</p>\n\n<h2>Ensemble</h2>\n\n<p>I use cv and public lb score to roughly set model weights, and run threshold search to get the threshold.\n<code>\nModel Weight: model1, model2, model3 = [4, 1, 2]\nThreshold: threshold label = [0.84, 0.9, 0.85, 0.8], threshold pixel = [0.25, 0.43, 0.35, 0.35]\nScore: 9-fold cv = 0.66449, public lb = 0.67601, private lb = 0.67080\n</code></p>\n\n<p>Finally thanks to  <a href=\"/hengck23\">@hengck23</a> rKeng,  I learn a lot from his code and ideas.</p>",
  "messages": [
    {
      "id": 676280,
      "postDate": "2019-11-19T04:16:28.927Z",
      "content": "<p>Congratulations to all winners in this competition! This is my first gold medal. I feel so happy.</p>\n\n<p>My solution is ensemble of 3 segmentation models</p>\n\n<h2>Augmentation</h2>\n\n<p>In this competition I found image augmentation is very important. I have tried many different augmentation sets and finally found one set that works good for me. I use albumentation to do image augmentation.\n<code>\naug = Compose([\n        ShiftScaleRotate(scale_limit=0.5, rotate_limit=0, shift_limit=0.1, p=0.6, border_mode=0),\n        OneOf([\n            ElasticTransform(p=0.5, alpha=50, sigma=120 * 0.02, alpha_affine=120 * 0.02),\n            GridDistortion(p=0.5),\n            OpticalDistortion(p=0.5, distort_limit=0.4, shift_limit=0.5)\n        ], p=0.8),\n        RandomRotate90(p=0.5),\n        Resize(352, 544),\n        VerticalFlip(p=0.5),\n        HorizontalFlip(p=0.5),\n        OneOf([\n            IAASharpen(alpha=(0.1, 0.3), p=0.5),\n            CLAHE(p=0.8),\n            GaussNoise(var_limit=(10.0, 50.0), p=0.5),\n            #GaussianBlur(blur_limit=3, p=0.5),\n            ISONoise(color_shift=(0.01, 0.05), intensity=(0.1, 0.5), p=0.3),\n        ], p=0.8),\n        RandomBrightnessContrast(p=0.8),\n        RandomGamma(p=0.8)])\n</code></p>\n\n<h2>Models</h2>\n\n<p><strong>Model1: **\n<code>\nEncoder: efficientnet-b1\nDecoder: unet\nImage Input Size: 416x608\nTTA: hflip, vflip, multi-scale: [(352, 544), (384, 576), (448, 640), (480, 672)] \nThreshold: threshold label = [0.85, 0.92, 0.85, 0.85], threshold pixel = [0.21, 0.44, 0.4, 0.3]\nScore: 9-fold cv = 0.66002, public lb = 0.67070, private lb = 0.66806\n</code>\n**Model2:</strong>\n<code>\nEncoder: efficientnet-b3\nDecoder: fpn\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.85, 0.9, 0.9, 0.85], threshold pixel = [0.35, 0.4, 0.42, 0.42]\nScore: 9-fold cv = 0.65646, public lb = 0.66426, private lb = 0.66687\n</code>\n<strong>Model3:</strong>\n<code>\nEncoder: resnet50\nDecoder: unet\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.9, 0.92, 0.87, 0.82], threshold pixel = [0.35, 0.51, 0.31, 0.3]\nScore: 9-fold cv = 0.65715, public lb = 0.66541, private lb = 0.65973\n</code></p>\n\n<p>All models use bcedice loss and Adam optimizer. Run threshold search to get the threshold label and threshold pixel</p>\n\n<h2>Ensemble</h2>\n\n<p>I use cv and public lb score to roughly set model weights, and run threshold search to get the threshold.\n<code>\nModel Weight: model1, model2, model3 = [4, 1, 2]\nThreshold: threshold label = [0.84, 0.9, 0.85, 0.8], threshold pixel = [0.25, 0.43, 0.35, 0.35]\nScore: 9-fold cv = 0.66449, public lb = 0.67601, private lb = 0.67080\n</code></p>\n\n<p>Finally thanks to  <a href=\"/hengck23\">@hengck23</a> rKeng,  I learn a lot from his code and ideas.</p>",
      "rawMarkdown": "Congratulations to all winners in this competition! This is my first gold medal. I feel so happy.\n\nMy solution is ensemble of 3 segmentation models\n## Augmentation\nIn this competition I found image augmentation is very important. I have tried many different augmentation sets and finally found one set that works good for me. I use albumentation to do image augmentation.\n```\naug = Compose([\n        ShiftScaleRotate(scale_limit=0.5, rotate_limit=0, shift_limit=0.1, p=0.6, border_mode=0),\n        OneOf([\n            ElasticTransform(p=0.5, alpha=50, sigma=120 * 0.02, alpha_affine=120 * 0.02),\n            GridDistortion(p=0.5),\n            OpticalDistortion(p=0.5, distort_limit=0.4, shift_limit=0.5)\n        ], p=0.8),\n        RandomRotate90(p=0.5),\n        Resize(352, 544),\n        VerticalFlip(p=0.5),\n        HorizontalFlip(p=0.5),\n        OneOf([\n            IAASharpen(alpha=(0.1, 0.3), p=0.5),\n            CLAHE(p=0.8),\n            GaussNoise(var_limit=(10.0, 50.0), p=0.5),\n            #GaussianBlur(blur_limit=3, p=0.5),\n            ISONoise(color_shift=(0.01, 0.05), intensity=(0.1, 0.5), p=0.3),\n        ], p=0.8),\n        RandomBrightnessContrast(p=0.8),\n        RandomGamma(p=0.8)])\n```\n## Models\n**Model1: **\n```\nEncoder: efficientnet-b1\nDecoder: unet\nImage Input Size: 416x608\nTTA: hflip, vflip, multi-scale: [(352, 544), (384, 576), (448, 640), (480, 672)] \nThreshold: threshold label = [0.85, 0.92, 0.85, 0.85], threshold pixel = [0.21, 0.44, 0.4, 0.3]\nScore: 9-fold cv = 0.66002, public lb = 0.67070, private lb = 0.66806\n```\n**Model2:**\n```\nEncoder: efficientnet-b3\nDecoder: fpn\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.85, 0.9, 0.9, 0.85], threshold pixel = [0.35, 0.4, 0.42, 0.42]\nScore: 9-fold cv = 0.65646, public lb = 0.66426, private lb = 0.66687\n```\n**Model3:**\n```\nEncoder: resnet50\nDecoder: unet\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.9, 0.92, 0.87, 0.82], threshold pixel = [0.35, 0.51, 0.31, 0.3]\nScore: 9-fold cv = 0.65715, public lb = 0.66541, private lb = 0.65973\n```\n\nAll models use bcedice loss and Adam optimizer. Run threshold search to get the threshold label and threshold pixel\n## Ensemble\nI use cv and public lb score to roughly set model weights, and run threshold search to get the threshold.\n```\nModel Weight: model1, model2, model3 = [4, 1, 2]\nThreshold: threshold label = [0.84, 0.9, 0.85, 0.8], threshold pixel = [0.25, 0.43, 0.35, 0.35]\nScore: 9-fold cv = 0.66449, public lb = 0.67601, private lb = 0.67080\n```\n\nFinally thanks to  @hengck23 rKeng,  I learn a lot from his code and ideas.\n",
      "votes": 30
    },
    {
      "id": 676320,
      "postDate": "2019-11-19T04:54:10.407Z",
      "content": "<p>Simple and Elegant. Thank you for sharing and congrats on your solo gold. \nI wonder how important was TTA in your submissions? Did you check LB score without TTA?</p>",
      "rawMarkdown": "Simple and Elegant. Thank you for sharing and congrats on your solo gold. \nI wonder how important was TTA in your submissions? Did you check LB score without TTA?",
      "votes": 1,
      "replies": [
        {
          "id": 676387,
          "postDate": "2019-11-19T06:06:57.930Z",
          "content": "<p>Thank you and also congrats your silver.\nfor single model cv and lb score TTA can improve about 0.002</p>",
          "rawMarkdown": "Thank you and also congrats your silver.\nfor single model cv and lb score TTA can improve about 0.002",
          "votes": 1
        }
      ]
    },
    {
      "id": 676292,
      "postDate": "2019-11-19T04:29:03.183Z",
      "content": "<p>Thank you for sharing.\nJust wondering\n1. How did you come up with the image size for different models\n2. To do 9-fold cv, did you train every fold from scratch or start with checkpoint of other fold\n3.  Could you tell me how to do multi-scale TTA</p>\n\n<p>Thanks a lot.</p>",
      "rawMarkdown": "Thank you for sharing.\nJust wondering\n1. How did you come up with the image size for different models\n2. To do 9-fold cv, did you train every fold from scratch or start with checkpoint of other fold\n3.  Could you tell me how to do multi-scale TTA\n\nThanks a lot.",
      "votes": 1,
      "replies": [
        {
          "id": 676348,
          "postDate": "2019-11-19T05:22:37.770Z",
          "content": "<p>ttach by qubvel makes it very easy to run tta with pytorch(theres also a keras version i think)</p>",
          "rawMarkdown": "ttach by qubvel makes it very easy to run tta with pytorch(theres also a keras version i think)",
          "votes": 1
        },
        {
          "id": 676376,
          "postDate": "2019-11-19T06:00:18.037Z",
          "content": "<ol>\n<li>I have tried many differient image sizes to find which one works better, then I would use it.</li>\n<li>I trained each fold from scratch, thus I can get a robust cv score and no train data leakage.</li>\n<li>I wrote a multi-scale TTA code to do this. Input differient scale to model, then resize the model mask output to same size and mutiply weight   </li>\n</ol>",
          "rawMarkdown": "1. I have tried many differient image sizes to find which one works better, then I would use it.\n2. I trained each fold from scratch, thus I can get a robust cv score and no train data leakage.\n3. I wrote a multi-scale TTA code to do this. Input differient scale to model, then resize the model mask output to same size and mutiply weight   ",
          "votes": 1
        }
      ]
    },
    {
      "id": 677049,
      "postDate": "2019-11-19T18:29:09.030Z",
      "content": "<p>Congrats great job. I like all your augmentation. I plan to use some of those in future comps. Thanks for sharing.</p>",
      "rawMarkdown": "Congrats great job. I like all your augmentation. I plan to use some of those in future comps. Thanks for sharing.",
      "replies": [
        {
          "id": 677271,
          "postDate": "2019-11-20T01:37:10.633Z",
          "content": "<p>Thanks for your congratulations! and also thanks for your sharing in this competition!</p>",
          "rawMarkdown": "Thanks for your congratulations! and also thanks for your sharing in this competition!"
        }
      ]
    },
    {
      "id": 676719,
      "postDate": "2019-11-19T13:08:29.317Z",
      "content": "<p>Congratulations!\nyour augmentation，threshold label for classes are impressive\nthanks for your shearing!!!</p>",
      "rawMarkdown": "Congratulations!\nyour augmentation，threshold label for classes are impressive\nthanks for your shearing!!!",
      "replies": [
        {
          "id": 677272,
          "postDate": "2019-11-20T01:37:31.697Z",
          "content": "<p>Thanks for your congratulations!</p>",
          "rawMarkdown": "Thanks for your congratulations!"
        }
      ]
    },
    {
      "id": 676550,
      "postDate": "2019-11-19T09:44:01.453Z",
      "content": "<p>Congradulations! May I ask how you do your multi scale TTA, what do you mean by multiply the weights? Thanks</p>",
      "rawMarkdown": "Congradulations! May I ask how you do your multi scale TTA, what do you mean by multiply the weights? Thanks",
      "replies": [
        {
          "id": 677261,
          "postDate": "2019-11-20T01:19:13.137Z",
          "content": "<p>```\nsizes = [(352, 544), (416, 608)]  # 384x576\nweights = [0.25, 0.25]\nfor i in range(len(sizes)):\n    input_scale = F.interpolate(input, size=sizes[i], mode='bilinear')\n    logit = data_parallel(net, input_scale)\n    probability = torch.sigmoid(logit)</p>\n\n<pre><code>probability_mask += F.interpolate(probability, size=(350, 525), mode='bilinear') * weights[i]\nprobability_label += F.adaptive_max_pool2d(probability, (1, 1)).view(batch_size, -1) * weights[i]\n\nnum_augment += weights[i]\n</code></pre>\n\n<p>```</p>",
          "rawMarkdown": "```\nsizes = [(352, 544), (416, 608)]  # 384x576\nweights = [0.25, 0.25]\nfor i in range(len(sizes)):\n    input_scale = F.interpolate(input, size=sizes[i], mode='bilinear')\n    logit = data_parallel(net, input_scale)\n    probability = torch.sigmoid(logit)\n\n    probability_mask += F.interpolate(probability, size=(350, 525), mode='bilinear') * weights[i]\n    probability_label += F.adaptive_max_pool2d(probability, (1, 1)).view(batch_size, -1) * weights[i]\n\n    num_augment += weights[i]\n```"
        }
      ]
    },
    {
      "id": 676434,
      "postDate": "2019-11-19T07:18:35.053Z",
      "content": "<p>Congratulations  <a href=\"/q525614\">@q525614</a>, thank you for sharing\nJust a little concern, did you use the external data for training? </p>",
      "rawMarkdown": "Congratulations  @q525614, thank you for sharing\nJust a little concern, did you use the external data for training? ",
      "replies": [
        {
          "id": 676464,
          "postDate": "2019-11-19T07:58:31.407Z",
          "content": "<p>no</p>",
          "rawMarkdown": "no"
        }
      ]
    },
    {
      "id": 676417,
      "postDate": "2019-11-19T06:49:25.690Z",
      "content": "<ol>\n<li>I wonder how you found the right (for you) augmentations? You said you tried a lot of different augmentation sets, but how you choose that sets and parameters for each of them?</li>\n<li>I'm really curious about not-like-0.05 thresholds like <code>0.21</code>, <code>0.84</code> and so on. How did you come to them?</li>\n</ol>\n\n<p>P.S. Congratulations!</p>",
      "rawMarkdown": "1. I wonder how you found the right (for you) augmentations? You said you tried a lot of different augmentation sets, but how you choose that sets and parameters for each of them?\n2. I'm really curious about not-like-0.05 thresholds like `0.21`, `0.84` and so on. How did you come to them?\n\nP.S. Congratulations!",
      "replies": [
        {
          "id": 676471,
          "postDate": "2019-11-19T08:05:51.590Z",
          "content": "<ol>\n<li>I use resnet50 to do the experiment, freeze other sets and train with differient augmentations, then see which augmentation sets have a better cv score.</li>\n<li>I use threshold search to find this  <code>'0.21'</code>  like threshold.</li>\n</ol>",
          "rawMarkdown": "1. I use resnet50 to do the experiment, freeze other sets and train with differient augmentations, then see which augmentation sets have a better cv score.\n2. I use threshold search to find this  `'0.21'`  like threshold.",
          "votes": 1
        }
      ]
    },
    {
      "id": 676359,
      "postDate": "2019-11-19T05:42:42.297Z",
      "content": "<p>cngrats !</p>",
      "rawMarkdown": "cngrats !",
      "replies": [
        {
          "id": 677273,
          "postDate": "2019-11-20T01:37:57.133Z",
          "content": "<p>Thanks!</p>",
          "rawMarkdown": "Thanks!"
        }
      ]
    },
    {
      "id": 676312,
      "postDate": "2019-11-19T04:48:40.987Z",
      "content": "<p>Wow, that's simple. So you can get that score only with segmentation models! Congratulations for your solo gold and thanks for sharing, langzi.</p>",
      "rawMarkdown": "Wow, that's simple. So you can get that score only with segmentation models! Congratulations for your solo gold and thanks for sharing, langzi.",
      "replies": [
        {
          "id": 677278,
          "postDate": "2019-11-20T01:38:48.517Z",
          "content": "<p>Thanks for your congratulations!</p>",
          "rawMarkdown": "Thanks for your congratulations!"
        }
      ]
    },
    {
      "id": 676311,
      "postDate": "2019-11-19T04:48:39.890Z",
      "content": "<p>Thank you for sharing and congrats!</p>",
      "rawMarkdown": "Thank you for sharing and congrats!",
      "replies": [
        {
          "id": 677277,
          "postDate": "2019-11-20T01:38:35.740Z",
          "content": "<p>Thanks for your congratulations!</p>",
          "rawMarkdown": "Thanks for your congratulations!"
        }
      ]
    },
    {
      "id": 676310,
      "postDate": "2019-11-19T04:48:12.573Z",
      "content": "<p>Hi, Congratulations!</p>\n\n<p>Pardon me,</p>\n\n<p>I have a question.</p>\n\n<p>Did you use classifiers? \nBecause you mentioned the threshold label, I think you used some classifiers. </p>",
      "rawMarkdown": "Hi, Congratulations!\n\nPardon me,\n\nI have a question.\n\nDid you use classifiers? \nBecause you mentioned the threshold label, I think you used some classifiers. ",
      "replies": [
        {
          "id": 676389,
          "postDate": "2019-11-19T06:09:15.970Z",
          "content": "<p>I use max mask pixel probability as labels, no classifiers.</p>",
          "rawMarkdown": "I use max mask pixel probability as labels, no classifiers."
        }
      ]
    },
    {
      "id": 676308,
      "postDate": "2019-11-19T04:42:17.843Z",
      "content": "<p>Congratulations! Thanks for sharing your solution!</p>",
      "rawMarkdown": "Congratulations! Thanks for sharing your solution!",
      "replies": [
        {
          "id": 677280,
          "postDate": "2019-11-20T01:39:02.993Z",
          "content": "<p>Thanks for your congratulations!</p>",
          "rawMarkdown": "Thanks for your congratulations!"
        }
      ]
    },
    {
      "id": 676291,
      "postDate": "2019-11-19T04:28:11.093Z",
      "content": "<p>Congratulation ,  thanks  for  sharing ,  I'm  gonna  to reproduce  your  result .\nBut  if  there  will  be  code  release  for  noob  to  consult ,  if  <code>dalao</code>   don't  mind ?  :)</p>",
      "rawMarkdown": "Congratulation ,  thanks  for  sharing ,  I'm  gonna  to reproduce  your  result .\nBut  if  there  will  be  code  release  for  noob  to  consult ,  if  `dalao`   don't  mind ?  :)",
      "replies": [
        {
          "id": 676432,
          "postDate": "2019-11-19T07:13:37.440Z",
          "content": "<p>I have no plan to release code.  nothing special.\nMain tricks I used have been introduced above   </p>",
          "rawMarkdown": "I have no plan to release code.  nothing special.\nMain tricks I used have been introduced above   "
        }
      ]
    },
    {
      "id": 676337,
      "postDate": "2019-11-19T05:13:39.740Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 677275,
          "postDate": "2019-11-20T01:38:11.187Z",
          "content": "<p>Thanks for your congratulations!</p>",
          "rawMarkdown": "Thanks for your congratulations!"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 676320,
      "author_name": "Bibek",
      "author_url": "",
      "post_date": "2019-11-19T04:54:10.407000",
      "content": "<p>Simple and Elegant. Thank you for sharing and congrats on your solo gold. \nI wonder how important was TTA in your submissions? Did you check LB score without TTA?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 676387,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T06:06:57.930000",
          "content": "<p>Thank you and also congrats your silver.\nfor single model cv and lb score TTA can improve about 0.002</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 676292,
      "author_name": "Xu",
      "author_url": "",
      "post_date": "2019-11-19T04:29:03.183000",
      "content": "<p>Thank you for sharing.\nJust wondering\n1. How did you come up with the image size for different models\n2. To do 9-fold cv, did you train every fold from scratch or start with checkpoint of other fold\n3.  Could you tell me how to do multi-scale TTA</p>\n\n<p>Thanks a lot.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 676348,
          "author_name": "sh",
          "author_url": "",
          "post_date": "2019-11-19T05:22:37.770000",
          "content": "<p>ttach by qubvel makes it very easy to run tta with pytorch(theres also a keras version i think)</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 676376,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T06:00:18.037000",
          "content": "<ol>\n<li>I have tried many differient image sizes to find which one works better, then I would use it.</li>\n<li>I trained each fold from scratch, thus I can get a robust cv score and no train data leakage.</li>\n<li>I wrote a multi-scale TTA code to do this. Input differient scale to model, then resize the model mask output to same size and mutiply weight   </li>\n</ol>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 677049,
      "author_name": "Chris Deotte",
      "author_url": "",
      "post_date": "2019-11-19T18:29:09.030000",
      "content": "<p>Congrats great job. I like all your augmentation. I plan to use some of those in future comps. Thanks for sharing.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677271,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:37:10.633000",
          "content": "<p>Thanks for your congratulations! and also thanks for your sharing in this competition!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676719,
      "author_name": "Sizhe Li",
      "author_url": "",
      "post_date": "2019-11-19T13:08:29.317000",
      "content": "<p>Congratulations!\nyour augmentation，threshold label for classes are impressive\nthanks for your shearing!!!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677272,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:37:31.697000",
          "content": "<p>Thanks for your congratulations!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676550,
      "author_name": "Heisenger",
      "author_url": "",
      "post_date": "2019-11-19T09:44:01.453000",
      "content": "<p>Congradulations! May I ask how you do your multi scale TTA, what do you mean by multiply the weights? Thanks</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677261,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:19:13.137000",
          "content": "<p>```\nsizes = [(352, 544), (416, 608)]  # 384x576\nweights = [0.25, 0.25]\nfor i in range(len(sizes)):\n    input_scale = F.interpolate(input, size=sizes[i], mode='bilinear')\n    logit = data_parallel(net, input_scale)\n    probability = torch.sigmoid(logit)</p>\n\n<pre><code>probability_mask += F.interpolate(probability, size=(350, 525), mode='bilinear') * weights[i]\nprobability_label += F.adaptive_max_pool2d(probability, (1, 1)).view(batch_size, -1) * weights[i]\n\nnum_augment += weights[i]\n</code></pre>\n\n<p>```</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676434,
      "author_name": "Tuan Ho Lai",
      "author_url": "",
      "post_date": "2019-11-19T07:18:35.053000",
      "content": "<p>Congratulations  <a href=\"/q525614\">@q525614</a>, thank you for sharing\nJust a little concern, did you use the external data for training? </p>",
      "votes": 0,
      "replies": [
        {
          "id": 676464,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T07:58:31.407000",
          "content": "<p>no</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676417,
      "author_name": "Nikita Detkov",
      "author_url": "",
      "post_date": "2019-11-19T06:49:25.690000",
      "content": "<ol>\n<li>I wonder how you found the right (for you) augmentations? You said you tried a lot of different augmentation sets, but how you choose that sets and parameters for each of them?</li>\n<li>I'm really curious about not-like-0.05 thresholds like <code>0.21</code>, <code>0.84</code> and so on. How did you come to them?</li>\n</ol>\n\n<p>P.S. Congratulations!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 676471,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T08:05:51.590000",
          "content": "<ol>\n<li>I use resnet50 to do the experiment, freeze other sets and train with differient augmentations, then see which augmentation sets have a better cv score.</li>\n<li>I use threshold search to find this  <code>'0.21'</code>  like threshold.</li>\n</ol>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 676359,
      "author_name": "Naruhiko Nakanishi",
      "author_url": "",
      "post_date": "2019-11-19T05:42:42.297000",
      "content": "<p>cngrats !</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677273,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:37:57.133000",
          "content": "<p>Thanks!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676312,
      "author_name": "YoonSoo",
      "author_url": "",
      "post_date": "2019-11-19T04:48:40.987000",
      "content": "<p>Wow, that's simple. So you can get that score only with segmentation models! Congratulations for your solo gold and thanks for sharing, langzi.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677278,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:38:48.517000",
          "content": "<p>Thanks for your congratulations!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676311,
      "author_name": "Camaro",
      "author_url": "",
      "post_date": "2019-11-19T04:48:39.890000",
      "content": "<p>Thank you for sharing and congrats!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677277,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:38:35.740000",
          "content": "<p>Thanks for your congratulations!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676310,
      "author_name": "Youhan Lee",
      "author_url": "",
      "post_date": "2019-11-19T04:48:12.573000",
      "content": "<p>Hi, Congratulations!</p>\n\n<p>Pardon me,</p>\n\n<p>I have a question.</p>\n\n<p>Did you use classifiers? \nBecause you mentioned the threshold label, I think you used some classifiers. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 676389,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T06:09:15.970000",
          "content": "<p>I use max mask pixel probability as labels, no classifiers.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676308,
      "author_name": "Hieu Phung",
      "author_url": "",
      "post_date": "2019-11-19T04:42:17.843000",
      "content": "<p>Congratulations! Thanks for sharing your solution!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 677280,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:39:02.993000",
          "content": "<p>Thanks for your congratulations!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676291,
      "author_name": "哈尔的移动城堡",
      "author_url": "",
      "post_date": "2019-11-19T04:28:11.093000",
      "content": "<p>Congratulation ,  thanks  for  sharing ,  I'm  gonna  to reproduce  your  result .\nBut  if  there  will  be  code  release  for  noob  to  consult ,  if  <code>dalao</code>   don't  mind ?  :)</p>",
      "votes": 0,
      "replies": [
        {
          "id": 676432,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-19T07:13:37.440000",
          "content": "<p>I have no plan to release code.  nothing special.\nMain tricks I used have been introduced above   </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 676337,
      "author_name": "",
      "author_url": "",
      "post_date": "2019-11-19T05:13:39.740000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 677275,
          "author_name": "langzi",
          "author_url": "",
          "post_date": "2019-11-20T01:38:11.187000",
          "content": "<p>Thanks for your congratulations!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "676280": "Congratulations to all winners in this competition! This is my first gold medal. I feel so happy.\n\nMy solution is ensemble of 3 segmentation models\n## Augmentation\nIn this competition I found image augmentation is very important. I have tried many different augmentation sets and finally found one set that works good for me. I use albumentation to do image augmentation.\n```\naug = Compose([\n        ShiftScaleRotate(scale_limit=0.5, rotate_limit=0, shift_limit=0.1, p=0.6, border_mode=0),\n        OneOf([\n            ElasticTransform(p=0.5, alpha=50, sigma=120 * 0.02, alpha_affine=120 * 0.02),\n            GridDistortion(p=0.5),\n            OpticalDistortion(p=0.5, distort_limit=0.4, shift_limit=0.5)\n        ], p=0.8),\n        RandomRotate90(p=0.5),\n        Resize(352, 544),\n        VerticalFlip(p=0.5),\n        HorizontalFlip(p=0.5),\n        OneOf([\n            IAASharpen(alpha=(0.1, 0.3), p=0.5),\n            CLAHE(p=0.8),\n            GaussNoise(var_limit=(10.0, 50.0), p=0.5),\n            #GaussianBlur(blur_limit=3, p=0.5),\n            ISONoise(color_shift=(0.01, 0.05), intensity=(0.1, 0.5), p=0.3),\n        ], p=0.8),\n        RandomBrightnessContrast(p=0.8),\n        RandomGamma(p=0.8)])\n```\n## Models\n**Model1: **\n```\nEncoder: efficientnet-b1\nDecoder: unet\nImage Input Size: 416x608\nTTA: hflip, vflip, multi-scale: [(352, 544), (384, 576), (448, 640), (480, 672)] \nThreshold: threshold label = [0.85, 0.92, 0.85, 0.85], threshold pixel = [0.21, 0.44, 0.4, 0.3]\nScore: 9-fold cv = 0.66002, public lb = 0.67070, private lb = 0.66806\n```\n**Model2:**\n```\nEncoder: efficientnet-b3\nDecoder: fpn\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.85, 0.9, 0.9, 0.85], threshold pixel = [0.35, 0.4, 0.42, 0.42]\nScore: 9-fold cv = 0.65646, public lb = 0.66426, private lb = 0.66687\n```\n**Model3:**\n```\nEncoder: resnet50\nDecoder: unet\nImage Input Size: 352x544\nTTA: hflip, vflip, multi-scale: [(320, 512), (384, 576)]\nThreshold: threshold label = [0.9, 0.92, 0.87, 0.82], threshold pixel = [0.35, 0.51, 0.31, 0.3]\nScore: 9-fold cv = 0.65715, public lb = 0.66541, private lb = 0.65973\n```\n\nAll models use bcedice loss and Adam optimizer. Run threshold search to get the threshold label and threshold pixel\n## Ensemble\nI use cv and public lb score to roughly set model weights, and run threshold search to get the threshold.\n```\nModel Weight: model1, model2, model3 = [4, 1, 2]\nThreshold: threshold label = [0.84, 0.9, 0.85, 0.8], threshold pixel = [0.25, 0.43, 0.35, 0.35]\nScore: 9-fold cv = 0.66449, public lb = 0.67601, private lb = 0.67080\n```\n\nFinally thanks to  @hengck23 rKeng,  I learn a lot from his code and ideas.\n",
    "676320": "Simple and Elegant. Thank you for sharing and congrats on your solo gold. \nI wonder how important was TTA in your submissions? Did you check LB score without TTA?",
    "676292": "Thank you for sharing.\nJust wondering\n1. How did you come up with the image size for different models\n2. To do 9-fold cv, did you train every fold from scratch or start with checkpoint of other fold\n3.  Could you tell me how to do multi-scale TTA\n\nThanks a lot.",
    "677049": "Congrats great job. I like all your augmentation. I plan to use some of those in future comps. Thanks for sharing.",
    "676719": "Congratulations!\nyour augmentation，threshold label for classes are impressive\nthanks for your shearing!!!",
    "676550": "Congradulations! May I ask how you do your multi scale TTA, what do you mean by multiply the weights? Thanks",
    "676434": "Congratulations  @q525614, thank you for sharing\nJust a little concern, did you use the external data for training? ",
    "676417": "1. I wonder how you found the right (for you) augmentations? You said you tried a lot of different augmentation sets, but how you choose that sets and parameters for each of them?\n2. I'm really curious about not-like-0.05 thresholds like `0.21`, `0.84` and so on. How did you come to them?\n\nP.S. Congratulations!",
    "676359": "cngrats !",
    "676312": "Wow, that's simple. So you can get that score only with segmentation models! Congratulations for your solo gold and thanks for sharing, langzi.",
    "676311": "Thank you for sharing and congrats!",
    "676310": "Hi, Congratulations!\n\nPardon me,\n\nI have a question.\n\nDid you use classifiers? \nBecause you mentioned the threshold label, I think you used some classifiers. ",
    "676308": "Congratulations! Thanks for sharing your solution!",
    "676291": "Congratulation ,  thanks  for  sharing ,  I'm  gonna  to reproduce  your  result .\nBut  if  there  will  be  code  release  for  noob  to  consult ,  if  `dalao`   don't  mind ?  :)",
    "676337": ""
  }
}