{
  "id": 379210,
  "title": "Are some of the image literalities labelled incorrectly?  Or, am I mistaken?",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/379210",
  "author_name": "Branden Keck",
  "post_date": "2023-01-18T16:37:27.351000",
  "votes": 5,
  "comment_count": 10,
  "views": 0,
  "content": "<p>I'm in the pre-processing stage of my analysis and am struggling with padding images for left/right laterality.   The attached case is image 1371307297 for patient 11350.  My training data file labels the laterality of this image as 'R' (the label 'RMLO' is also written directly on the image).  However, this is clearly a left breast image based on orientation, unless it is a mirrored image or something else is going on.  </p>\n<p>Any help with this is extremely appreciated.  I've noticed this with a couple images, but only those labeled 'R' in laterality, which leads me to believe this is based on machine_id or something similar.  I'm sorry if this has been already discussed and I've missed it.</p>",
  "messages": [
    {
      "id": 2105660,
      "postDate": "2023-01-18T16:37:27.350Z",
      "content": "<p>I'm in the pre-processing stage of my analysis and am struggling with padding images for left/right laterality.   The attached case is image 1371307297 for patient 11350.  My training data file labels the laterality of this image as 'R' (the label 'RMLO' is also written directly on the image).  However, this is clearly a left breast image based on orientation, unless it is a mirrored image or something else is going on.  </p>\n<p>Any help with this is extremely appreciated.  I've noticed this with a couple images, but only those labeled 'R' in laterality, which leads me to believe this is based on machine_id or something similar.  I'm sorry if this has been already discussed and I've missed it.</p>",
      "rawMarkdown": "I'm in the pre-processing stage of my analysis and am struggling with padding images for left/right laterality.   The attached case is image 1371307297 for patient 11350.  My training data file labels the laterality of this image as 'R' (the label 'RMLO' is also written directly on the image).  However, this is clearly a left breast image based on orientation, unless it is a mirrored image or something else is going on.  \n\nAny help with this is extremely appreciated.  I've noticed this with a couple images, but only those labeled 'R' in laterality, which leads me to believe this is based on machine_id or something similar.  I'm sorry if this has been already discussed and I've missed it.",
      "votes": 5
    },
    {
      "id": 2105727,
      "postDate": "2023-01-18T17:10:48.417Z",
      "content": "<p>I believe that laterality left != breast pointing to the right. Maybe some people in the field can comment but there are about ~9726 mismatches if we do assume that (based on a model I trained with over 3k hand-labeled images). There is literature that flips all images to one side to aid generalization, so I assume that laterality is not important to keep as a feature in a balanced (cancer-wise for each laterality) dataset</p>\n<p>Another note: the mismatched breasts which are from site_id == 2 are flipped, make sure models are able to generalize to the flipped breast (upside down). There are about 45 mismatches from site_id == 2</p>",
      "rawMarkdown": "I believe that laterality left != breast pointing to the right. Maybe some people in the field can comment but there are about ~9726 mismatches if we do assume that (based on a model I trained with over 3k hand-labeled images). There is literature that flips all images to one side to aid generalization, so I assume that laterality is not important to keep as a feature in a balanced (cancer-wise for each laterality) dataset\n\nAnother note: the mismatched breasts which are from site_id == 2 are flipped, make sure models are able to generalize to the flipped breast (upside down). There are about 45 mismatches from site_id == 2",
      "votes": 2,
      "replies": [
        {
          "id": 2105862,
          "postDate": "2023-01-18T19:36:26.470Z",
          "content": "<p>Thank you for this!  This is perfect.  I will probably procede by flipping the site 2 data so that orientation is consistent for all of them</p>",
          "rawMarkdown": "Thank you for this!  This is perfect.  I will probably procede by flipping the site 2 data so that orientation is consistent for all of them",
          "replies": [
            {
              "id": 2105918,
              "postDate": "2023-01-18T20:32:00.413Z",
              "content": "<p>It only affects a very small number of images, I think building a model (or models) that generalizes well is key.</p>",
              "rawMarkdown": "It only affects a very small number of images, I think building a model (or models) that generalizes well is key.",
              "votes": 1
            },
            {
              "id": 2127382,
              "postDate": "2023-02-02T21:03:27.683Z",
              "content": "<p>Perhaps something like this can be used to detect flipped images:</p>\n<pre><code>sum_rows = np.(img, axis=)\nmidpoint = (np.floor((sum_rows) / ))\nmass_on_the_left_side = np.(sum_rows[:midpoint])\nmass_on_the_right_side = np.(sum_rows[midpoint + :])\n\n (laterality ==   mass_on_the_left_side &lt; mass_on_the_right_side)  (laterality ==   mass_on_the_left_side &gt; mass_on_the_right_side):\n    img = cv2.flip(img, flipCode=)\n\n\n</code></pre>\n<p>It might not always work, but in many cases it will.</p>",
              "rawMarkdown": "Perhaps something like this can be used to detect flipped images:\n```python\nsum_rows = np.sum(img, axis=0)\nmidpoint = int(np.floor(len(sum_rows) / 2.))\nmass_on_the_left_side = np.sum(sum_rows[0:midpoint])\nmass_on_the_right_side = np.sum(sum_rows[midpoint + 1:])\n\nif (laterality == 'L' and mass_on_the_left_side < mass_on_the_right_side) or (laterality == 'R' and mass_on_the_left_side > mass_on_the_right_side):\n    img = cv2.flip(img, flipCode=1)\n\n# and so forth, and so on...\n```\nIt might not always work, but in many cases it will."
            }
          ]
        }
      ]
    },
    {
      "id": 2105728,
      "postDate": "2023-01-18T17:12:52.830Z",
      "rawMarkdown": "",
      "votes": -1,
      "isDeleted": true,
      "replies": [
        {
          "id": 2105731,
          "postDate": "2023-01-18T17:15:35.767Z",
          "content": "<p>This sounds oddly like a chatgpt response. Is this spam?</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5918909%2Fd0efc826409d5565ca1f9ec0da12c003%2Fhmmmm.PNG?generation=1674062098936459&amp;alt=media\" alt=\"GPT2 Detector\"></p>",
          "rawMarkdown": "This sounds oddly like a chatgpt response. Is this spam?\n\n![GPT2 Detector](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5918909%2Fd0efc826409d5565ca1f9ec0da12c003%2Fhmmmm.PNG?generation=1674062098936459&alt=media)",
          "votes": 5,
          "replies": [
            {
              "id": 2105776,
              "postDate": "2023-01-18T17:59:37.520Z",
              "content": "<p>Even kaggle might not be safe from chatGPT spammers 😂 ..</p>",
              "rawMarkdown": "Even kaggle might not be safe from chatGPT spammers 😂 ..\n",
              "votes": 1
            },
            {
              "id": 2105861,
              "postDate": "2023-01-18T19:35:29.037Z",
              "content": "<p>Hahaha I was not aware of the Output Detector Demo - this is great! :)</p>",
              "rawMarkdown": "Hahaha I was not aware of the Output Detector Demo - this is great! :)"
            },
            {
              "id": 2106553,
              "postDate": "2023-01-19T08:13:16.773Z",
              "content": "<p>Ask him directory.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9268451%2F2590fd76819f33888f4b3aab130160ed%2F13553.jpg?generation=1674115968450483&amp;alt=media\" alt=\"\"></p>",
              "rawMarkdown": "Ask him directory.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9268451%2F2590fd76819f33888f4b3aab130160ed%2F13553.jpg?generation=1674115968450483&alt=media)",
              "votes": 7
            },
            {
              "id": 2108268,
              "postDate": "2023-01-20T11:41:45.790Z",
              "content": "<p><img src=\"https://i.ibb.co/C0vPP1F/Selection-605.png\" alt=\"https://i.ibb.co/C0vPP1F/Selection-605.png\"><br>\nthis is not better?</p>",
              "rawMarkdown": "![https://i.ibb.co/C0vPP1F/Selection-605.png](https://i.ibb.co/C0vPP1F/Selection-605.png)\nthis is not better?",
              "votes": 2
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2105727,
      "author_name": "outwrest",
      "author_url": "",
      "post_date": "2023-01-18T17:10:48.417000",
      "content": "<p>I believe that laterality left != breast pointing to the right. Maybe some people in the field can comment but there are about ~9726 mismatches if we do assume that (based on a model I trained with over 3k hand-labeled images). There is literature that flips all images to one side to aid generalization, so I assume that laterality is not important to keep as a feature in a balanced (cancer-wise for each laterality) dataset</p>\n<p>Another note: the mismatched breasts which are from site_id == 2 are flipped, make sure models are able to generalize to the flipped breast (upside down). There are about 45 mismatches from site_id == 2</p>",
      "votes": 2,
      "replies": [
        {
          "id": 2105862,
          "author_name": "Branden Keck",
          "author_url": "",
          "post_date": "2023-01-18T19:36:26.470000",
          "content": "<p>Thank you for this!  This is perfect.  I will probably procede by flipping the site 2 data so that orientation is consistent for all of them</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2105918,
              "author_name": "outwrest",
              "author_url": "",
              "post_date": "2023-01-18T20:32:00.413000",
              "content": "<p>It only affects a very small number of images, I think building a model (or models) that generalizes well is key.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2127382,
              "author_name": "Antti Isosalo",
              "author_url": "",
              "post_date": "2023-02-02T21:03:27.683000",
              "content": "<p>Perhaps something like this can be used to detect flipped images:</p>\n<pre><code>sum_rows = np.(img, axis=)\nmidpoint = (np.floor((sum_rows) / ))\nmass_on_the_left_side = np.(sum_rows[:midpoint])\nmass_on_the_right_side = np.(sum_rows[midpoint + :])\n\n (laterality ==   mass_on_the_left_side &lt; mass_on_the_right_side)  (laterality ==   mass_on_the_left_side &gt; mass_on_the_right_side):\n    img = cv2.flip(img, flipCode=)\n\n\n</code></pre>\n<p>It might not always work, but in many cases it will.</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2105728,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-01-18T17:12:52.830000",
      "content": "",
      "votes": -1,
      "replies": [
        {
          "id": 2105731,
          "author_name": "outwrest",
          "author_url": "",
          "post_date": "2023-01-18T17:15:35.767000",
          "content": "<p>This sounds oddly like a chatgpt response. Is this spam?</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5918909%2Fd0efc826409d5565ca1f9ec0da12c003%2Fhmmmm.PNG?generation=1674062098936459&amp;alt=media\" alt=\"GPT2 Detector\"></p>",
          "votes": 5,
          "replies": [
            {
              "id": 2105776,
              "author_name": "Ayushman Buragohain",
              "author_url": "",
              "post_date": "2023-01-18T17:59:37.520000",
              "content": "<p>Even kaggle might not be safe from chatGPT spammers 😂 ..</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2105861,
              "author_name": "Branden Keck",
              "author_url": "",
              "post_date": "2023-01-18T19:35:29.037000",
              "content": "<p>Hahaha I was not aware of the Output Detector Demo - this is great! :)</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2106553,
              "author_name": "luddite^",
              "author_url": "",
              "post_date": "2023-01-19T08:13:16.773000",
              "content": "<p>Ask him directory.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F9268451%2F2590fd76819f33888f4b3aab130160ed%2F13553.jpg?generation=1674115968450483&amp;alt=media\" alt=\"\"></p>",
              "votes": 7,
              "replies": []
            },
            {
              "id": 2108268,
              "author_name": "hengck23",
              "author_url": "",
              "post_date": "2023-01-20T11:41:45.790000",
              "content": "<p><img src=\"https://i.ibb.co/C0vPP1F/Selection-605.png\" alt=\"https://i.ibb.co/C0vPP1F/Selection-605.png\"><br>\nthis is not better?</p>",
              "votes": 2,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2105660": "I'm in the pre-processing stage of my analysis and am struggling with padding images for left/right laterality.   The attached case is image 1371307297 for patient 11350.  My training data file labels the laterality of this image as 'R' (the label 'RMLO' is also written directly on the image).  However, this is clearly a left breast image based on orientation, unless it is a mirrored image or something else is going on.  \n\nAny help with this is extremely appreciated.  I've noticed this with a couple images, but only those labeled 'R' in laterality, which leads me to believe this is based on machine_id or something similar.  I'm sorry if this has been already discussed and I've missed it.",
    "2105727": "I believe that laterality left != breast pointing to the right. Maybe some people in the field can comment but there are about ~9726 mismatches if we do assume that (based on a model I trained with over 3k hand-labeled images). There is literature that flips all images to one side to aid generalization, so I assume that laterality is not important to keep as a feature in a balanced (cancer-wise for each laterality) dataset\n\nAnother note: the mismatched breasts which are from site_id == 2 are flipped, make sure models are able to generalize to the flipped breast (upside down). There are about 45 mismatches from site_id == 2",
    "2105728": ""
  }
}