{
  "id": 214863,
  "title": "Convert From RGBY to RGB",
  "url": "/competitions/hpa-single-cell-image-classification/discussion/214863",
  "author_name": "Darien Schettler",
  "post_date": "2021-01-27T23:22:39.987000",
  "votes": 1,
  "comment_count": 2,
  "views": 0,
  "content": "<p>One of the competition hosts gave feedback on a methodology for combining the 4 channel RGBY images into a single image. For more details and other EDA related things please see my <a href=\"https://www.kaggle.com/dschettler8845/visual-eda-hpa-single-cell-classification\" target=\"_blank\"><strong>WIP EDA</strong></a></p>\n<p>Please see the function below:</p>\n<pre><code>def convert_rgby_to_rgb(arr):\n    \"\"\" Convert a 4 channel (RGBY) image to a 3 channel RGB image.\n\n    Advice From Competition Host/User: lnhtrang\n\n    For annotation (by experts) and for the model, I guess we agree that individual \n    channels with full range px values are better. \n    In annotation, we toggled the channels. \n    For visualization purpose only, you can try blending the channels. \n    For example, \n        - red = red + yellow\n        - green = green + yellow/2\n        - blue=blue.\n\n    Args:\n        arr (numpy array): The RGBY, 4 channel numpy array for a given image\n\n    Returns:\n        RGB Image\n    \"\"\"\n\n    rgb_arr = np.zeros_like(arr[..., :-1])\n    rgb_arr[..., 0] = arr[..., 0]\n    rgb_arr[..., 1] = arr[..., 1]+arr[..., 3]/2\n    rgb_arr[..., 2] = arr[..., 2]\n\n    return rgb_arr\n</code></pre>",
  "messages": [
    {
      "id": 1173473,
      "postDate": "2021-01-27T23:22:39.987Z",
      "content": "<p>One of the competition hosts gave feedback on a methodology for combining the 4 channel RGBY images into a single image. For more details and other EDA related things please see my <a href=\"https://www.kaggle.com/dschettler8845/visual-eda-hpa-single-cell-classification\" target=\"_blank\"><strong>WIP EDA</strong></a></p>\n<p>Please see the function below:</p>\n<pre><code>def convert_rgby_to_rgb(arr):\n    \"\"\" Convert a 4 channel (RGBY) image to a 3 channel RGB image.\n\n    Advice From Competition Host/User: lnhtrang\n\n    For annotation (by experts) and for the model, I guess we agree that individual \n    channels with full range px values are better. \n    In annotation, we toggled the channels. \n    For visualization purpose only, you can try blending the channels. \n    For example, \n        - red = red + yellow\n        - green = green + yellow/2\n        - blue=blue.\n\n    Args:\n        arr (numpy array): The RGBY, 4 channel numpy array for a given image\n\n    Returns:\n        RGB Image\n    \"\"\"\n\n    rgb_arr = np.zeros_like(arr[..., :-1])\n    rgb_arr[..., 0] = arr[..., 0]\n    rgb_arr[..., 1] = arr[..., 1]+arr[..., 3]/2\n    rgb_arr[..., 2] = arr[..., 2]\n\n    return rgb_arr\n</code></pre>",
      "rawMarkdown": "One of the competition hosts gave feedback on a methodology for combining the 4 channel RGBY images into a single image. For more details and other EDA related things please see my [**WIP EDA**](https://www.kaggle.com/dschettler8845/visual-eda-hpa-single-cell-classification)\n\nPlease see the function below:\n\n```python\ndef convert_rgby_to_rgb(arr):\n    \"\"\" Convert a 4 channel (RGBY) image to a 3 channel RGB image.\n    \n    Advice From Competition Host/User: lnhtrang\n\n    For annotation (by experts) and for the model, I guess we agree that individual \n    channels with full range px values are better. \n    In annotation, we toggled the channels. \n    For visualization purpose only, you can try blending the channels. \n    For example, \n        - red = red + yellow\n        - green = green + yellow/2\n        - blue=blue.\n        \n    Args:\n        arr (numpy array): The RGBY, 4 channel numpy array for a given image\n    \n    Returns:\n        RGB Image\n    \"\"\"\n\n    rgb_arr = np.zeros_like(arr[..., :-1])\n    rgb_arr[..., 0] = arr[..., 0]\n    rgb_arr[..., 1] = arr[..., 1]+arr[..., 3]/2\n    rgb_arr[..., 2] = arr[..., 2]\n    \n    return rgb_arr\n```"
    },
    {
      "id": 1175347,
      "postDate": "2021-01-29T05:13:07.880Z",
      "content": "<p><a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> So for the green channel, the idea is to take the average of green and yellow, right?</p>",
      "rawMarkdown": "@dschettler8845 So for the green channel, the idea is to take the average of green and yellow, right?",
      "replies": [
        {
          "id": 1189150,
          "postDate": "2021-02-06T18:42:18.163Z",
          "content": "<p>Correct. Although, this is only for the purposes of visualization. </p>\n<p>For modelling it is recommended to use all 4 channels (although one of the takeaways from the past competition was that the yellow channel did not add very much information… so perhaps RGB is sufficient)</p>",
          "rawMarkdown": "Correct. Although, this is only for the purposes of visualization. \n\nFor modelling it is recommended to use all 4 channels (although one of the takeaways from the past competition was that the yellow channel did not add very much information... so perhaps RGB is sufficient)"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1175347,
      "author_name": "Izzy Adesanya",
      "author_url": "",
      "post_date": "2021-01-29T05:13:07.880000",
      "content": "<p><a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> So for the green channel, the idea is to take the average of green and yellow, right?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1189150,
          "author_name": "Darien Schettler",
          "author_url": "",
          "post_date": "2021-02-06T18:42:18.163000",
          "content": "<p>Correct. Although, this is only for the purposes of visualization. </p>\n<p>For modelling it is recommended to use all 4 channels (although one of the takeaways from the past competition was that the yellow channel did not add very much information… so perhaps RGB is sufficient)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1173473": "One of the competition hosts gave feedback on a methodology for combining the 4 channel RGBY images into a single image. For more details and other EDA related things please see my [**WIP EDA**](https://www.kaggle.com/dschettler8845/visual-eda-hpa-single-cell-classification)\n\nPlease see the function below:\n\n```python\ndef convert_rgby_to_rgb(arr):\n    \"\"\" Convert a 4 channel (RGBY) image to a 3 channel RGB image.\n    \n    Advice From Competition Host/User: lnhtrang\n\n    For annotation (by experts) and for the model, I guess we agree that individual \n    channels with full range px values are better. \n    In annotation, we toggled the channels. \n    For visualization purpose only, you can try blending the channels. \n    For example, \n        - red = red + yellow\n        - green = green + yellow/2\n        - blue=blue.\n        \n    Args:\n        arr (numpy array): The RGBY, 4 channel numpy array for a given image\n    \n    Returns:\n        RGB Image\n    \"\"\"\n\n    rgb_arr = np.zeros_like(arr[..., :-1])\n    rgb_arr[..., 0] = arr[..., 0]\n    rgb_arr[..., 1] = arr[..., 1]+arr[..., 3]/2\n    rgb_arr[..., 2] = arr[..., 2]\n    \n    return rgb_arr\n```",
    "1175347": "@dschettler8845 So for the green channel, the idea is to take the average of green and yellow, right?"
  }
}