{
  "id": 388392,
  "title": "Incorporating attributes into an image classifier",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/388392",
  "author_name": "Julian Macnamara",
  "post_date": "2023-02-17T08:39:37.781000",
  "votes": 3,
  "comment_count": 8,
  "views": 0,
  "content": "<p>As a beginner, I’d appreciate any guidance on how an attribute such as machine_id (or laterality) can be incorporated into an image classifier. My googling on the topic is raising more questions than answers</p>\n<p>If the answer is to use multi-label classification such as “Y 49” to indicate a cancer diagnosis from machine 49, then how do you get a prediction that only considers the cancer diagnosis? Similarly how do you get a prediction that only considers the cancer diagnosis if a single label classification is used?</p>\n<p>How should you proceed if you take an ensemble approach, create a separate model for each machine_id and store the trained learned objects in a list? (This seems to be the most logical approach to me)</p>\n<p>Is it possible to incorporate some form of control structure such as “ if … then” or “select case” so that a particular trained learner object  is used depending on the machine_id?</p>\n<p>My WIP notebook is available at <a href=\"https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2\" target=\"_blank\">https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2</a></p>\n<p>Many thanks in advance</p>\n<p>All the best</p>\n<p>Julian</p>",
  "messages": [
    {
      "id": 2148211,
      "postDate": "2023-02-17T08:39:37.780Z",
      "content": "<p>As a beginner, I’d appreciate any guidance on how an attribute such as machine_id (or laterality) can be incorporated into an image classifier. My googling on the topic is raising more questions than answers</p>\n<p>If the answer is to use multi-label classification such as “Y 49” to indicate a cancer diagnosis from machine 49, then how do you get a prediction that only considers the cancer diagnosis? Similarly how do you get a prediction that only considers the cancer diagnosis if a single label classification is used?</p>\n<p>How should you proceed if you take an ensemble approach, create a separate model for each machine_id and store the trained learned objects in a list? (This seems to be the most logical approach to me)</p>\n<p>Is it possible to incorporate some form of control structure such as “ if … then” or “select case” so that a particular trained learner object  is used depending on the machine_id?</p>\n<p>My WIP notebook is available at <a href=\"https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2\" target=\"_blank\">https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2</a></p>\n<p>Many thanks in advance</p>\n<p>All the best</p>\n<p>Julian</p>",
      "rawMarkdown": "As a beginner, I’d appreciate any guidance on how an attribute such as machine_id (or laterality) can be incorporated into an image classifier. My googling on the topic is raising more questions than answers\n\nIf the answer is to use multi-label classification such as “Y 49” to indicate a cancer diagnosis from machine 49, then how do you get a prediction that only considers the cancer diagnosis? Similarly how do you get a prediction that only considers the cancer diagnosis if a single label classification is used?\n\nHow should you proceed if you take an ensemble approach, create a separate model for each machine_id and store the trained learned objects in a list? (This seems to be the most logical approach to me)\n\nIs it possible to incorporate some form of control structure such as “ if ... then” or “select case” so that a particular trained learner object  is used depending on the machine_id?\n\nMy WIP notebook is available at https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2\n\nMany thanks in advance\n\nAll the best\n\nJulian\n",
      "votes": 3
    },
    {
      "id": 2148645,
      "postDate": "2023-02-17T15:39:21.877Z",
      "content": "<p>Referring to my question on taking an ensemble approach, this seems to work</p>\n<ul>\n<li>For each machine id of interest extract the prediction</li>\n<li>Create a df containing all the predictions and calculate the mean. (I'll also explore min and max)</li>\n<li>Proceed as for a single model</li>\n</ul>",
      "rawMarkdown": "Referring to my question on taking an ensemble approach, this seems to work\n\n- For each machine id of interest extract the prediction\n- Create a df containing all the predictions and calculate the mean. (I'll also explore min and max)\n- Proceed as for a single model\n\n",
      "votes": 1
    },
    {
      "id": 2148639,
      "postDate": "2023-02-17T15:34:12.943Z",
      "content": "<p><a href=\"https://www.kaggle.com/code/hengck23/3hr-tensorrt-nextvit-example?scriptVersionId=116312479&amp;cellId=12\" target=\"_blank\">Here</a> is an inference example considering several models/nets.</p>",
      "rawMarkdown": "[Here](https://www.kaggle.com/code/hengck23/3hr-tensorrt-nextvit-example?scriptVersionId=116312479&cellId=12) is an inference example considering several models/nets.",
      "votes": 1,
      "replies": [
        {
          "id": 2148648,
          "postDate": "2023-02-17T15:42:10.490Z",
          "content": "<p>Many thanks Antti. I'll check it out. I've also posted a solution that seems to show promise</p>",
          "rawMarkdown": "Many thanks Antti. I'll check it out. I've also posted a solution that seems to show promise"
        }
      ]
    },
    {
      "id": 2149731,
      "postDate": "2023-02-18T16:11:49.753Z",
      "content": "<p>Hi Julian, I found this <a href=\"https://www.kaggle.com/code/awsaf49/rsna-bcd-efficientnet-tf-tpu-1vm-train\" target=\"_blank\">notebook</a> useful. </p>",
      "rawMarkdown": "Hi Julian, I found this [notebook](https://www.kaggle.com/code/awsaf49/rsna-bcd-efficientnet-tf-tpu-1vm-train) useful. ",
      "replies": [
        {
          "id": 2150449,
          "postDate": "2023-02-19T09:06:23.140Z",
          "content": "<p>Hi<br>\nIt is both interesting and helpful<br>\nMany thanks for sharing it with me<br>\nAll the best<br>\nJulian</p>",
          "rawMarkdown": "Hi\nIt is both interesting and helpful\nMany thanks for sharing it with me\nAll the best\nJulian",
          "votes": 1
        }
      ]
    },
    {
      "id": 2148671,
      "postDate": "2023-02-17T15:59:14.177Z",
      "content": "<p>One way is described in this notebook:<br>\n<a href=\"https://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline\" target=\"_blank\">https://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline</a><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4392121%2F5a527e4e90338e488152ce30ad95ab70%2FChkZ53p.jpg?generation=1676649585421557&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "One way is described in this notebook:\nhttps://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4392121%2F5a527e4e90338e488152ce30ad95ab70%2FChkZ53p.jpg?generation=1676649585421557&alt=media)",
      "replies": [
        {
          "id": 2149393,
          "postDate": "2023-02-18T08:51:23.270Z",
          "content": "<p>Hello Resoul<br>\nVery interesting<br>\nMany thanks<br>\nAll the best<br>\nJulian</p>",
          "rawMarkdown": "Hello Resoul\nVery interesting\nMany thanks\nAll the best\nJulian",
          "votes": 1
        }
      ]
    },
    {
      "id": 2148638,
      "postDate": "2023-02-17T15:32:36.917Z",
      "content": "<p>Perhaps <a href=\"https://www.kaggle.com/code/vslaykovsky/infer-pytorch-aux-targets-weighted-loss-thres?scriptVersionId=113756289&amp;cellId=15\" target=\"_blank\">this</a> will be helpful to implement auxiliary outputs?</p>",
      "rawMarkdown": "Perhaps [this](https://www.kaggle.com/code/vslaykovsky/infer-pytorch-aux-targets-weighted-loss-thres?scriptVersionId=113756289&cellId=15) will be helpful to implement auxiliary outputs?"
    }
  ],
  "comments": [
    {
      "id": 2148645,
      "author_name": "Julian Macnamara",
      "author_url": "",
      "post_date": "2023-02-17T15:39:21.877000",
      "content": "<p>Referring to my question on taking an ensemble approach, this seems to work</p>\n<ul>\n<li>For each machine id of interest extract the prediction</li>\n<li>Create a df containing all the predictions and calculate the mean. (I'll also explore min and max)</li>\n<li>Proceed as for a single model</li>\n</ul>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2148639,
      "author_name": "Antti Isosalo",
      "author_url": "",
      "post_date": "2023-02-17T15:34:12.943000",
      "content": "<p><a href=\"https://www.kaggle.com/code/hengck23/3hr-tensorrt-nextvit-example?scriptVersionId=116312479&amp;cellId=12\" target=\"_blank\">Here</a> is an inference example considering several models/nets.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2148648,
          "author_name": "Julian Macnamara",
          "author_url": "",
          "post_date": "2023-02-17T15:42:10.490000",
          "content": "<p>Many thanks Antti. I'll check it out. I've also posted a solution that seems to show promise</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2149731,
      "author_name": "bmjdoherty",
      "author_url": "",
      "post_date": "2023-02-18T16:11:49.753000",
      "content": "<p>Hi Julian, I found this <a href=\"https://www.kaggle.com/code/awsaf49/rsna-bcd-efficientnet-tf-tpu-1vm-train\" target=\"_blank\">notebook</a> useful. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 2150449,
          "author_name": "Julian Macnamara",
          "author_url": "",
          "post_date": "2023-02-19T09:06:23.140000",
          "content": "<p>Hi<br>\nIt is both interesting and helpful<br>\nMany thanks for sharing it with me<br>\nAll the best<br>\nJulian</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2148671,
      "author_name": "Rasoul Mojtahedzadeh",
      "author_url": "",
      "post_date": "2023-02-17T15:59:14.177000",
      "content": "<p>One way is described in this notebook:<br>\n<a href=\"https://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline\" target=\"_blank\">https://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline</a><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4392121%2F5a527e4e90338e488152ce30ad95ab70%2FChkZ53p.jpg?generation=1676649585421557&amp;alt=media\" alt=\"\"></p>",
      "votes": 0,
      "replies": [
        {
          "id": 2149393,
          "author_name": "Julian Macnamara",
          "author_url": "",
          "post_date": "2023-02-18T08:51:23.270000",
          "content": "<p>Hello Resoul<br>\nVery interesting<br>\nMany thanks<br>\nAll the best<br>\nJulian</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 2148638,
      "author_name": "Antti Isosalo",
      "author_url": "",
      "post_date": "2023-02-17T15:32:36.917000",
      "content": "<p>Perhaps <a href=\"https://www.kaggle.com/code/vslaykovsky/infer-pytorch-aux-targets-weighted-loss-thres?scriptVersionId=113756289&amp;cellId=15\" target=\"_blank\">this</a> will be helpful to implement auxiliary outputs?</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2148211": "As a beginner, I’d appreciate any guidance on how an attribute such as machine_id (or laterality) can be incorporated into an image classifier. My googling on the topic is raising more questions than answers\n\nIf the answer is to use multi-label classification such as “Y 49” to indicate a cancer diagnosis from machine 49, then how do you get a prediction that only considers the cancer diagnosis? Similarly how do you get a prediction that only considers the cancer diagnosis if a single label classification is used?\n\nHow should you proceed if you take an ensemble approach, create a separate model for each machine_id and store the trained learned objects in a list? (This seems to be the most logical approach to me)\n\nIs it possible to incorporate some form of control structure such as “ if ... then” or “select case” so that a particular trained learner object  is used depending on the machine_id?\n\nMy WIP notebook is available at https://www.kaggle.com/code/julianmacnamara/rsna-breast-cancer-detection-pttoa-v1-2\n\nMany thanks in advance\n\nAll the best\n\nJulian\n",
    "2148645": "Referring to my question on taking an ensemble approach, this seems to work\n\n- For each machine id of interest extract the prediction\n- Create a df containing all the predictions and calculate the mean. (I'll also explore min and max)\n- Proceed as for a single model\n\n",
    "2148639": "[Here](https://www.kaggle.com/code/hengck23/3hr-tensorrt-nextvit-example?scriptVersionId=116312479&cellId=12) is an inference example considering several models/nets.",
    "2149731": "Hi Julian, I found this [notebook](https://www.kaggle.com/code/awsaf49/rsna-bcd-efficientnet-tf-tpu-1vm-train) useful. ",
    "2148671": "One way is described in this notebook:\nhttps://www.kaggle.com/code/andradaolteanu/rsna-breast-cancer-eda-pytorch-baseline\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4392121%2F5a527e4e90338e488152ce30ad95ab70%2FChkZ53p.jpg?generation=1676649585421557&alt=media)",
    "2148638": "Perhaps [this](https://www.kaggle.com/code/vslaykovsky/infer-pytorch-aux-targets-weighted-loss-thres?scriptVersionId=113756289&cellId=15) will be helpful to implement auxiliary outputs?"
  }
}