{
  "id": 220386,
  "title": "38 place writeup(image classification on TPU/Colab only with s3 trick)",
  "url": "/competitions/rfcx-species-audio-detection/discussion/220386",
  "author_name": "Victor Zaguskin",
  "post_date": "2021-02-18T06:54:49.805000",
  "votes": 18,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi all.<br>\nFirst, thanks for a great competition. Thats my favorite type of competitions where there are incomplete or noisy labels and you have to think how to deal with them.<br>\nSecond, thanks to those who shared code. In particular to the authors of the following kernels:</p>\n<ol>\n<li><a href=\"https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2\" target=\"_blank\">https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2</a> - that was a great starter and I was just doing edits of that kernel to move on</li>\n<li><a href=\"https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle\" target=\"_blank\">https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle</a> - that showed how you can train on colab as well</li>\n</ol>\n<p>My code is in the following notebook - <a href=\"https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp\" target=\"_blank\">https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp</a>. The final submission is a merge of several versions of submissions from that code(and similar code on colab) plus s3 trick. </p>\n<p>Now, how I got from initial 80+ in the starter notebook to 90+ and silver zone.</p>\n<ol>\n<li>5-second cut worked better then initial 10 second</li>\n<li>Added FP data with masked BCE/BCEFocal loss. I simply calculate BCE loss only on the label I know is missing(and just usual BCE with label smoothing 0.2/Usual BCEFocal on TP data)</li>\n<li>Use heavier model(B4)</li>\n<li>Added mixup/cutmix</li>\n</ol>\n<p>The best version of that code got .89+ on private LB. <br>\nThan ensembling goes - I just collect all the well scoring submissions(.87+ public) and average them. Ranking average seem to work slightly better than simple average(by 0.001 approximately).<br>\nThe best private score I could get with that approach is .912</p>\n<p>My version of s3 trick is that I multiply s3 by 2.5 and s7 by 2. That gave me .93 on private LB(.918 public). The version I selected for final had same .918 public and .929 private which is pretty much the same.</p>\n<p>Again, thanks a lot for the competition. Learned many things and had a lot of fun.</p>\n<p><strong>Upd:</strong> I've added postprocessing from Chris and now <a href=\"https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp\" target=\"_blank\">this kernel</a> scores 0.95467 private (gold zone) - which means complete training and inference on Kaggle TPU only within less than 3 hours and gold level score.</p>",
  "messages": [
    {
      "id": 1208105,
      "postDate": "2021-02-18T06:54:49.807Z",
      "content": "<p>Hi all.<br>\nFirst, thanks for a great competition. Thats my favorite type of competitions where there are incomplete or noisy labels and you have to think how to deal with them.<br>\nSecond, thanks to those who shared code. In particular to the authors of the following kernels:</p>\n<ol>\n<li><a href=\"https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2\" target=\"_blank\">https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2</a> - that was a great starter and I was just doing edits of that kernel to move on</li>\n<li><a href=\"https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle\" target=\"_blank\">https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle</a> - that showed how you can train on colab as well</li>\n</ol>\n<p>My code is in the following notebook - <a href=\"https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp\" target=\"_blank\">https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp</a>. The final submission is a merge of several versions of submissions from that code(and similar code on colab) plus s3 trick. </p>\n<p>Now, how I got from initial 80+ in the starter notebook to 90+ and silver zone.</p>\n<ol>\n<li>5-second cut worked better then initial 10 second</li>\n<li>Added FP data with masked BCE/BCEFocal loss. I simply calculate BCE loss only on the label I know is missing(and just usual BCE with label smoothing 0.2/Usual BCEFocal on TP data)</li>\n<li>Use heavier model(B4)</li>\n<li>Added mixup/cutmix</li>\n</ol>\n<p>The best version of that code got .89+ on private LB. <br>\nThan ensembling goes - I just collect all the well scoring submissions(.87+ public) and average them. Ranking average seem to work slightly better than simple average(by 0.001 approximately).<br>\nThe best private score I could get with that approach is .912</p>\n<p>My version of s3 trick is that I multiply s3 by 2.5 and s7 by 2. That gave me .93 on private LB(.918 public). The version I selected for final had same .918 public and .929 private which is pretty much the same.</p>\n<p>Again, thanks a lot for the competition. Learned many things and had a lot of fun.</p>\n<p><strong>Upd:</strong> I've added postprocessing from Chris and now <a href=\"https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp\" target=\"_blank\">this kernel</a> scores 0.95467 private (gold zone) - which means complete training and inference on Kaggle TPU only within less than 3 hours and gold level score.</p>",
      "rawMarkdown": "Hi all.\nFirst, thanks for a great competition. Thats my favorite type of competitions where there are incomplete or noisy labels and you have to think how to deal with them.\nSecond, thanks to those who shared code. In particular to the authors of the following kernels:\n1. https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2 - that was a great starter and I was just doing edits of that kernel to move on\n2. https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle - that showed how you can train on colab as well\n\nMy code is in the following notebook - https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp. The final submission is a merge of several versions of submissions from that code(and similar code on colab) plus s3 trick. \n\nNow, how I got from initial 80+ in the starter notebook to 90+ and silver zone.\n1. 5-second cut worked better then initial 10 second\n2. Added FP data with masked BCE/BCEFocal loss. I simply calculate BCE loss only on the label I know is missing(and just usual BCE with label smoothing 0.2/Usual BCEFocal on TP data)\n3. Use heavier model(B4)\n4. Added mixup/cutmix\n\nThe best version of that code got .89+ on private LB. \nThan ensembling goes - I just collect all the well scoring submissions(.87+ public) and average them. Ranking average seem to work slightly better than simple average(by 0.001 approximately).\nThe best private score I could get with that approach is .912\n\nMy version of s3 trick is that I multiply s3 by 2.5 and s7 by 2. That gave me .93 on private LB(.918 public). The version I selected for final had same .918 public and .929 private which is pretty much the same.\n\nAgain, thanks a lot for the competition. Learned many things and had a lot of fun.\n\n**Upd:** I've added postprocessing from Chris and now [this kernel](https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp) scores 0.95467 private (gold zone) - which means complete training and inference on Kaggle TPU only within less than 3 hours and gold level score.",
      "votes": 18
    },
    {
      "id": 1209271,
      "postDate": "2021-02-18T19:39:50.550Z",
      "content": "<p>Congratz ! <br>\nIt's getting harder and harder these days to grab a medal only using Kaggle &amp; colab, so extra credits for that :)</p>",
      "rawMarkdown": "Congratz ! \nIt's getting harder and harder these days to grab a medal only using Kaggle & colab, so extra credits for that :)",
      "votes": 1
    },
    {
      "id": 1859459,
      "postDate": "2022-07-17T16:43:49.877Z",
      "content": "<p>Can you please explain to me what masked BCE/BCEFocal loss is? Why does it help you improve your performance in this task? Thank you.</p>",
      "rawMarkdown": "Can you please explain to me what masked BCE/BCEFocal loss is? Why does it help you improve your performance in this task? Thank you."
    },
    {
      "id": 1208160,
      "postDate": "2021-02-18T07:30:58.110Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true,
      "replies": [
        {
          "id": 1208189,
          "postDate": "2021-02-18T07:48:49.923Z",
          "content": "<p>First I noticed that my CV score for several classes is much lower than average. S3 was the most obvious. I've tried submitting all 0.5 for s3 and it gave me a score boost close to 0.01.<br>\nI started investigating and found that I actually underpredicting s3(and probaly s7 as well)<br>\nSo I tried upscaling the prediction for those two classes that would give the best boost in local CV on one of the folds and got those values.<br>\nI guess one could do much better than that(like <a href=\"https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/220389\" target=\"_blank\">https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/220389</a>)</p>",
          "rawMarkdown": "First I noticed that my CV score for several classes is much lower than average. S3 was the most obvious. I've tried submitting all 0.5 for s3 and it gave me a score boost close to 0.01.\nI started investigating and found that I actually underpredicting s3(and probaly s7 as well)\nSo I tried upscaling the prediction for those two classes that would give the best boost in local CV on one of the folds and got those values.\nI guess one could do much better than that(like https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/220389)",
          "votes": 3
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1209271,
      "author_name": "Theo Viel",
      "author_url": "",
      "post_date": "2021-02-18T19:39:50.550000",
      "content": "<p>Congratz ! <br>\nIt's getting harder and harder these days to grab a medal only using Kaggle &amp; colab, so extra credits for that :)</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1859459,
      "author_name": "KhoaPD",
      "author_url": "",
      "post_date": "2022-07-17T16:43:49.877000",
      "content": "<p>Can you please explain to me what masked BCE/BCEFocal loss is? Why does it help you improve your performance in this task? Thank you.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1208160,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-02-18T07:30:58.110000",
      "content": "",
      "votes": 1,
      "replies": [
        {
          "id": 1208189,
          "author_name": "Victor Zaguskin",
          "author_url": "",
          "post_date": "2021-02-18T07:48:49.923000",
          "content": "<p>First I noticed that my CV score for several classes is much lower than average. S3 was the most obvious. I've tried submitting all 0.5 for s3 and it gave me a score boost close to 0.01.<br>\nI started investigating and found that I actually underpredicting s3(and probaly s7 as well)<br>\nSo I tried upscaling the prediction for those two classes that would give the best boost in local CV on one of the folds and got those values.<br>\nI guess one could do much better than that(like <a href=\"https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/220389\" target=\"_blank\">https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/220389</a>)</p>",
          "votes": 3,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1208105": "Hi all.\nFirst, thanks for a great competition. Thats my favorite type of competitions where there are incomplete or noisy labels and you have to think how to deal with them.\nSecond, thanks to those who shared code. In particular to the authors of the following kernels:\n1. https://www.kaggle.com/ashusma/training-rfcx-tensorflow-tpu-effnet-b2 - that was a great starter and I was just doing edits of that kernel to move on\n2. https://www.kaggle.com/aikhmelnytskyy/resnet-tpu-on-colab-and-kaggle - that showed how you can train on colab as well\n\nMy code is in the following notebook - https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp. The final submission is a merge of several versions of submissions from that code(and similar code on colab) plus s3 trick. \n\nNow, how I got from initial 80+ in the starter notebook to 90+ and silver zone.\n1. 5-second cut worked better then initial 10 second\n2. Added FP data with masked BCE/BCEFocal loss. I simply calculate BCE loss only on the label I know is missing(and just usual BCE with label smoothing 0.2/Usual BCEFocal on TP data)\n3. Use heavier model(B4)\n4. Added mixup/cutmix\n\nThe best version of that code got .89+ on private LB. \nThan ensembling goes - I just collect all the well scoring submissions(.87+ public) and average them. Ranking average seem to work slightly better than simple average(by 0.001 approximately).\nThe best private score I could get with that approach is .912\n\nMy version of s3 trick is that I multiply s3 by 2.5 and s7 by 2. That gave me .93 on private LB(.918 public). The version I selected for final had same .918 public and .929 private which is pretty much the same.\n\nAgain, thanks a lot for the competition. Learned many things and had a lot of fun.\n\n**Upd:** I've added postprocessing from Chris and now [this kernel](https://www.kaggle.com/vzaguskin/training-rfcx-tensorflow-tpu-effnet-b2-with-fp) scores 0.95467 private (gold zone) - which means complete training and inference on Kaggle TPU only within less than 3 hours and gold level score.",
    "1209271": "Congratz ! \nIt's getting harder and harder these days to grab a medal only using Kaggle & colab, so extra credits for that :)",
    "1859459": "Can you please explain to me what masked BCE/BCEFocal loss is? Why does it help you improve your performance in this task? Thank you.",
    "1208160": ""
  }
}