{
  "id": 76656,
  "title": "Focal loss parameters intuition",
  "url": "/competitions/human-protein-atlas-image-classification/discussion/76656",
  "author_name": "",
  "post_date": "2019-01-05T10:27:14.970967500Z",
  "votes": null,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hi all!\nTo those, who use focal loss in their training, what parameters do you use? </p>\n\n<p>When I try to use focal loss, I constantly get worse results than with BCE of soft F1.\nI tried to train from scratch and finetuning, both perform worse. \nAfter some googling I found this topic: <a href=\"https://github.com/fizyr/keras-retinanet/issues/540\">https://github.com/fizyr/keras-retinanet/issues/540</a></p>\n\n<p>Don't we need to increase alpha in our task because positives are rare?</p>",
  "messages": [
    {
      "id": "450589",
      "postDate": "01/05/2019 10:27:14",
      "content": "<p>Hi all!\nTo those, who use focal loss in their training, what parameters do you use? </p>\n\n<p>When I try to use focal loss, I constantly get worse results than with BCE of soft F1.\nI tried to train from scratch and finetuning, both perform worse. \nAfter some googling I found this topic: <a href=\"https://github.com/fizyr/keras-retinanet/issues/540\">https://github.com/fizyr/keras-retinanet/issues/540</a></p>\n\n<p>Don't we need to increase alpha in our task because positives are rare?</p>",
      "rawMarkdown": "Hi all!\nTo those, who use focal loss in their training, what parameters do you use? \n\nWhen I try to use focal loss, I constantly get worse results than with BCE of soft F1.\nI tried to train from scratch and finetuning, both perform worse. \nAfter some googling I found this topic: https://github.com/fizyr/keras-retinanet/issues/540\n\nDon't we need to increase alpha in our task because positives are rare?",
      "votes": null
    },
    {
      "id": "450692",
      "postDate": "01/05/2019 14:37:46",
      "content": "<p>I use focal loss default parameter in original paper. \nBut for me, focal loss and bce are giving same results. And there are huge gaps with same network when compared to the results in discussion thread. Sad...</p>",
      "rawMarkdown": "I use focal loss default parameter in original paper. \nBut for me, focal loss and bce are giving same results. And there are huge gaps with same network when compared to the results in discussion thread. Sad...",
      "votes": null
    },
    {
      "id": "450704",
      "postDate": "01/05/2019 14:51:42",
      "content": "<p>Alpha=1, gamma=2</p>",
      "rawMarkdown": "Alpha=1, gamma=2",
      "votes": null
    },
    {
      "id": "944101",
      "postDate": "07/24/2020 20:37:56",
      "content": "<p>This comment is appearing in top results for google search for Focal loss, so for future onlookers: \n<a href=\"https://leimao.github.io/blog/Focal-Loss-Explained/\">https://leimao.github.io/blog/Focal-Loss-Explained/</a> ---&gt; This article has a very good explanation.</p>",
      "rawMarkdown": "This comment is appearing in top results for google search for Focal loss, so for future onlookers: \n[https://leimao.github.io/blog/Focal-Loss-Explained/](https://leimao.github.io/blog/Focal-Loss-Explained/) ---&gt; This article has a very good explanation.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 450692,
      "author_name": "yiwei2016",
      "author_url": "",
      "post_date": "01/05/2019 14:37:46",
      "content": "<p>I use focal loss default parameter in original paper. \nBut for me, focal loss and bce are giving same results. And there are huge gaps with same network when compared to the results in discussion thread. Sad...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 450704,
      "author_name": "maudung164",
      "author_url": "",
      "post_date": "01/05/2019 14:51:42",
      "content": "<p>Alpha=1, gamma=2</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 944101,
      "author_name": "monami",
      "author_url": "",
      "post_date": "07/24/2020 20:37:56",
      "content": "<p>This comment is appearing in top results for google search for Focal loss, so for future onlookers: \n<a href=\"https://leimao.github.io/blog/Focal-Loss-Explained/\">https://leimao.github.io/blog/Focal-Loss-Explained/</a> ---&gt; This article has a very good explanation.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "450589": "Hi all!\nTo those, who use focal loss in their training, what parameters do you use? \n\nWhen I try to use focal loss, I constantly get worse results than with BCE of soft F1.\nI tried to train from scratch and finetuning, both perform worse. \nAfter some googling I found this topic: https://github.com/fizyr/keras-retinanet/issues/540\n\nDon't we need to increase alpha in our task because positives are rare?",
    "450692": "I use focal loss default parameter in original paper. \nBut for me, focal loss and bce are giving same results. And there are huge gaps with same network when compared to the results in discussion thread. Sad...",
    "450704": "Alpha=1, gamma=2",
    "944101": "This comment is appearing in top results for google search for Focal loss, so for future onlookers: \n[https://leimao.github.io/blog/Focal-Loss-Explained/](https://leimao.github.io/blog/Focal-Loss-Explained/) ---&gt; This article has a very good explanation."
  },
  "source": "meta"
}