{
  "id": 370498,
  "title": "[LB:0.27] Pytorch+EffNetV2 some working ideas",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/370498",
  "author_name": "Vladimir Slaykovskiy",
  "post_date": "2022-12-04T21:32:56.337000",
  "votes": 20,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Sharing some ideas here that worked for me here: </p>\n<ul>\n<li><a href=\"https://www.kaggle.com/vslaykovsky/train-effnetv2-aux-targets-weighted-loss-thres\" target=\"_blank\">Train - EffNetV2:aux targets+weighted loss+thres</a></li>\n<li><a href=\"https://www.kaggle.com/vslaykovsky/infer-effnetv2-aux-targets-weighted-loss-thres\" target=\"_blank\">infer - EffNetV2:aux targets+weighted loss+thres</a></li>\n</ul>\n<h2>Ideas:</h2>\n<ol>\n<li>Both thresholding and weight-balancing improved my CV. \"cancer\" targets are highly imbalanced, so I use weighted loss to counteract (Positive weight ~50). Thresholding works well for F1-ish metrics, so optimized threshold with evaluation set. </li>\n<li>Used this <a href=\"https://www.kaggle.com/datasets/theoviel/rsna-breast-cancer-512-pngs\" target=\"_blank\">preprocessed dataset of 512x512 png images</a> to  speed up dataloader by ~10x with no performance degradation.</li>\n<li>Used additional classification auxilliary targets <code>['site_id', 'laterality', 'view', 'implant', 'biopsy', 'invasive', 'BIRADS', 'density', 'difficult_negative_case', 'machine_id', 'age']</code>. Auxilliary targets help to learn combined distribution of *.CSV + *.PNG data  which helps to improve performance of the main classifier.</li>\n</ol>",
  "messages": [
    {
      "id": 2055207,
      "postDate": "2022-12-04T21:32:56.337Z",
      "content": "<p>Sharing some ideas here that worked for me here: </p>\n<ul>\n<li><a href=\"https://www.kaggle.com/vslaykovsky/train-effnetv2-aux-targets-weighted-loss-thres\" target=\"_blank\">Train - EffNetV2:aux targets+weighted loss+thres</a></li>\n<li><a href=\"https://www.kaggle.com/vslaykovsky/infer-effnetv2-aux-targets-weighted-loss-thres\" target=\"_blank\">infer - EffNetV2:aux targets+weighted loss+thres</a></li>\n</ul>\n<h2>Ideas:</h2>\n<ol>\n<li>Both thresholding and weight-balancing improved my CV. \"cancer\" targets are highly imbalanced, so I use weighted loss to counteract (Positive weight ~50). Thresholding works well for F1-ish metrics, so optimized threshold with evaluation set. </li>\n<li>Used this <a href=\"https://www.kaggle.com/datasets/theoviel/rsna-breast-cancer-512-pngs\" target=\"_blank\">preprocessed dataset of 512x512 png images</a> to  speed up dataloader by ~10x with no performance degradation.</li>\n<li>Used additional classification auxilliary targets <code>['site_id', 'laterality', 'view', 'implant', 'biopsy', 'invasive', 'BIRADS', 'density', 'difficult_negative_case', 'machine_id', 'age']</code>. Auxilliary targets help to learn combined distribution of *.CSV + *.PNG data  which helps to improve performance of the main classifier.</li>\n</ol>",
      "rawMarkdown": "Sharing some ideas here that worked for me here: \n* [Train - EffNetV2:aux targets+weighted loss+thres](https://www.kaggle.com/vslaykovsky/train-effnetv2-aux-targets-weighted-loss-thres)\n* [infer - EffNetV2:aux targets+weighted loss+thres](https://www.kaggle.com/vslaykovsky/infer-effnetv2-aux-targets-weighted-loss-thres)\n\n\n## Ideas:\n1. Both thresholding and weight-balancing improved my CV. \"cancer\" targets are highly imbalanced, so I use weighted loss to counteract (Positive weight ~50). Thresholding works well for F1-ish metrics, so optimized threshold with evaluation set. \n2. Used this [preprocessed dataset of 512x512 png images](https://www.kaggle.com/datasets/theoviel/rsna-breast-cancer-512-pngs) to  speed up dataloader by ~10x with no performance degradation.\n3. Used additional classification auxilliary targets `['site_id', 'laterality', 'view', 'implant', 'biopsy', 'invasive', 'BIRADS', 'density', 'difficult_negative_case', 'machine_id', 'age']`. Auxilliary targets help to learn combined distribution of *.CSV + *.PNG data  which helps to improve performance of the main classifier.\n",
      "votes": 20
    },
    {
      "id": 2055423,
      "postDate": "2022-12-05T04:30:41.453Z",
      "content": "<p>hey <a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a>! Really cool work, thank you for sharing! You using <code>DEBUG</code> as you are working on stuff to check that it works is very awesome! 🙂 </p>\n<p>Just wanted to stop by and say thank you. And also to let you know that you might want to fix the links in the OP -- some people might have a hard time getting to your NB 🙂</p>",
      "rawMarkdown": "hey @vslaykovsky! Really cool work, thank you for sharing! You using `DEBUG` as you are working on stuff to check that it works is very awesome! 🙂 \n\nJust wanted to stop by and say thank you. And also to let you know that you might want to fix the links in the OP -- some people might have a hard time getting to your NB 🙂",
      "votes": 2,
      "replies": [
        {
          "id": 2055632,
          "postDate": "2022-12-05T08:56:20.323Z",
          "content": "<p>Thanks for reporting!</p>",
          "rawMarkdown": "Thanks for reporting!",
          "votes": 1
        }
      ]
    },
    {
      "id": 2056520,
      "postDate": "2022-12-06T07:32:55.927Z",
      "content": "<p>Thanks for sharing your nice work!  Did you do experiment  to test how much auxilliary can boost the CV score? </p>",
      "rawMarkdown": "Thanks for sharing your nice work!  Did you do experiment  to test how much auxilliary can boost the CV score? "
    },
    {
      "id": 2055257,
      "postDate": "2022-12-04T23:54:38.980Z",
      "content": "<p>Thanks for sharing, <a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a> Did you try other pre-trained models than EffNetV2? I'm planning to go with EffNet as a starter, but I'm thinking to try ResNet.</p>",
      "rawMarkdown": "Thanks for sharing, @vslaykovsky Did you try other pre-trained models than EffNetV2? I'm planning to go with EffNet as a starter, but I'm thinking to try ResNet.",
      "replies": [
        {
          "id": 2055633,
          "postDate": "2022-12-05T08:56:46.710Z",
          "content": "<p>I haven't tried other models yet. Seems like a promissing idea</p>",
          "rawMarkdown": "I haven't tried other models yet. Seems like a promissing idea",
          "votes": 1
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2055423,
      "author_name": "Radek Osmulski",
      "author_url": "",
      "post_date": "2022-12-05T04:30:41.453000",
      "content": "<p>hey <a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a>! Really cool work, thank you for sharing! You using <code>DEBUG</code> as you are working on stuff to check that it works is very awesome! 🙂 </p>\n<p>Just wanted to stop by and say thank you. And also to let you know that you might want to fix the links in the OP -- some people might have a hard time getting to your NB 🙂</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2055632,
          "author_name": "Vladimir Slaykovskiy",
          "author_url": "",
          "post_date": "2022-12-05T08:56:20.323000",
          "content": "<p>Thanks for reporting!</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2056520,
      "author_name": "Mr.Fire",
      "author_url": "",
      "post_date": "2022-12-06T07:32:55.927000",
      "content": "<p>Thanks for sharing your nice work!  Did you do experiment  to test how much auxilliary can boost the CV score? </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 2055257,
      "author_name": "Gabriel Lins",
      "author_url": "",
      "post_date": "2022-12-04T23:54:38.980000",
      "content": "<p>Thanks for sharing, <a href=\"https://www.kaggle.com/vslaykovsky\" target=\"_blank\">@vslaykovsky</a> Did you try other pre-trained models than EffNetV2? I'm planning to go with EffNet as a starter, but I'm thinking to try ResNet.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2055633,
          "author_name": "Vladimir Slaykovskiy",
          "author_url": "",
          "post_date": "2022-12-05T08:56:46.710000",
          "content": "<p>I haven't tried other models yet. Seems like a promissing idea</p>",
          "votes": 1,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2055207": "Sharing some ideas here that worked for me here: \n* [Train - EffNetV2:aux targets+weighted loss+thres](https://www.kaggle.com/vslaykovsky/train-effnetv2-aux-targets-weighted-loss-thres)\n* [infer - EffNetV2:aux targets+weighted loss+thres](https://www.kaggle.com/vslaykovsky/infer-effnetv2-aux-targets-weighted-loss-thres)\n\n\n## Ideas:\n1. Both thresholding and weight-balancing improved my CV. \"cancer\" targets are highly imbalanced, so I use weighted loss to counteract (Positive weight ~50). Thresholding works well for F1-ish metrics, so optimized threshold with evaluation set. \n2. Used this [preprocessed dataset of 512x512 png images](https://www.kaggle.com/datasets/theoviel/rsna-breast-cancer-512-pngs) to  speed up dataloader by ~10x with no performance degradation.\n3. Used additional classification auxilliary targets `['site_id', 'laterality', 'view', 'implant', 'biopsy', 'invasive', 'BIRADS', 'density', 'difficult_negative_case', 'machine_id', 'age']`. Auxilliary targets help to learn combined distribution of *.CSV + *.PNG data  which helps to improve performance of the main classifier.\n",
    "2055423": "hey @vslaykovsky! Really cool work, thank you for sharing! You using `DEBUG` as you are working on stuff to check that it works is very awesome! 🙂 \n\nJust wanted to stop by and say thank you. And also to let you know that you might want to fix the links in the OP -- some people might have a hard time getting to your NB 🙂",
    "2056520": "Thanks for sharing your nice work!  Did you do experiment  to test how much auxilliary can boost the CV score? ",
    "2055257": "Thanks for sharing, @vslaykovsky Did you try other pre-trained models than EffNetV2? I'm planning to go with EffNet as a starter, but I'm thinking to try ResNet."
  }
}