{
  "id": 454732,
  "title": "A couple of questions on the submission format",
  "url": "/competitions/blood-vessel-segmentation/discussion/454732",
  "author_name": "",
  "post_date": "2023-11-11T13:12:29.357400800Z",
  "votes": 11,
  "comment_count": 9,
  "views": 0,
  "content": "<ol>\n<li>There's a different number of files in the sample_submission.csv and actual test folders. sample_submission.csv has slices 0000 and 0001 and each of the two test folders has 3 files 0000 0001 0002. Should I use all of the files or only those in the sample_submission?</li>\n<li>Does it matter if the slice number is encoded as 0000 or just 0 in the submission file? The sample submission has 0000 while the evaluation page states it should be 0</li>\n</ol>\n<p>I know I can test this. But I already have two failed submissions (Submission scoring error) and don't want to spend all of my today's submissions on some random errors :)</p>",
  "messages": [
    {
      "id": "2521150",
      "postDate": "11/11/2023 13:12:29",
      "content": "<ol>\n<li>There's a different number of files in the sample_submission.csv and actual test folders. sample_submission.csv has slices 0000 and 0001 and each of the two test folders has 3 files 0000 0001 0002. Should I use all of the files or only those in the sample_submission?</li>\n<li>Does it matter if the slice number is encoded as 0000 or just 0 in the submission file? The sample submission has 0000 while the evaluation page states it should be 0</li>\n</ol>\n<p>I know I can test this. But I already have two failed submissions (Submission scoring error) and don't want to spend all of my today's submissions on some random errors :)</p>",
      "rawMarkdown": "1. There's a different number of files in the sample_submission.csv and actual test folders. sample_submission.csv has slices 0000 and 0001 and each of the two test folders has 3 files 0000 0001 0002. Should I use all of the files or only those in the sample_submission?\n2. Does it matter if the slice number is encoded as 0000 or just 0 in the submission file? The sample submission has 0000 while the evaluation page states it should be 0\n\nI know I can test this. But I already have two failed submissions (Submission scoring error) and don't want to spend all of my today's submissions on some random errors :)",
      "votes": null
    },
    {
      "id": "2521239",
      "postDate": "11/11/2023 14:28:46",
      "content": "<p>Use all the slices in the test folders and ignore the sample submission dataframe. <br>\nWhen you submit, use the full filename for the ID column, like this .. <strong>kidney_5_dense_0001</strong>. I don't know if it's required to keep the zero padded slice number, but it does work to submit in that format.</p>",
      "rawMarkdown": "Use all the slices in the test folders and ignore the sample submission dataframe. \nWhen you submit, use the full filename for the ID column, like this .. **kidney_5_dense_0001**. I don't know if it's required to keep the zero padded slice number, but it does work to submit in that format.",
      "votes": null
    },
    {
      "id": "2521563",
      "postDate": "11/11/2023 20:07:18",
      "content": "<p>Thanks, David, still no luck. May I ask you if your submission had any actual predictions involving loading images, doing predictions, etc.?</p>",
      "rawMarkdown": "Thanks, David, still no luck. May I ask you if your submission had any actual predictions involving loading images, doing predictions, etc.?",
      "votes": null
    },
    {
      "id": "2521579",
      "postDate": "11/11/2023 20:52:08",
      "content": "<p>Yes, my subs read each image and create masks, then RLE encode them. </p>",
      "rawMarkdown": "Yes, my subs read each image and create masks, then RLE encode them.",
      "votes": null
    },
    {
      "id": "2521735",
      "postDate": "11/12/2023 02:57:34",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/sakvaua\" target=\"_blank\">@sakvaua</a>, if you still have the problem, check that the values of your binary mask are indeed between 0 and 1 before computing the RLE. I lose 4 hours on that 😅. And also here is how I compute my RLE: </p>\n<pre><code> ():\n    \n\n    \n    pixels = binary_mask.flatten()\n\n    \n    pixels = np.concatenate([[], pixels, []])\n\n    \n    runs = np.where(pixels[:] != pixels[:-])[] + \n\n    \n    runs[::] -= runs[::]\n\n    rle = .join((x)  x  runs)\n\n     (rle) == :\n         \n\n    :\n         rle\n</code></pre>",
      "rawMarkdown": "Hi @sakvaua, if you still have the problem, check that the values of your binary mask are indeed between 0 and 1 before computing the RLE. I lose 4 hours on that 😅. And also here is how I compute my RLE: \n\n```python\n\ndef binary_mask_to_rle(binary_mask):\n    \"\"\"\n    Convert a binary mask to Run Length Encoding (RLE).\n    Args:\n        binary_mask (ndarray): binary mask of shape [width, height]\n    Returns:\n        rle (str): run-length as string formated\n    \"\"\"\n\n    # Flatten the mask\n    pixels = binary_mask.flatten()\n\n    # Pad the start and end with zero to capture runs that might start or end at the edges\n    pixels = np.concatenate([[0], pixels, [0]])\n\n    # Find where the pixels change\n    runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n\n    # Ensure that every second element subtracts the one before it\n    runs[1::2] -= runs[::2]\n\n    rle = \" \".join(str(x) for x in runs)\n\n    if len(rle) == 0:\n        return \"1 0\"\n\n    else:\n        return rle\n\n```",
      "votes": null
    },
    {
      "id": "2521947",
      "postDate": "11/12/2023 07:39:23",
      "content": "<p>Thanks, buddy, but this is not about the mask. It's about the way I form the submission file. I removed all the predictive parts and used 1 0 as a dummy submission and it still failed. It probably has to do with how id column is constructed.</p>",
      "rawMarkdown": "Thanks, buddy, but this is not about the mask. It's about the way I form the submission file. I removed all the predictive parts and used 1 0 as a dummy submission and it still failed. It probably has to do with how id column is constructed.",
      "votes": null
    },
    {
      "id": "2522593",
      "postDate": "11/12/2023 20:30:48",
      "content": "<p>I suspect that the issue with your submissions might be related to the use of \"1 0\" to indicate the absence of a mask in your predictions. I observed that a very basic model of mine, which predicted masks for all inputs, had its submission accepted. However, when I used a more sophisticated model that included a couple of instances with \"1 0\" (indicating no mask), the submission was not successful.</p>\n<p>Additionally, I found a relevant example (<a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/clemchris/test-submission</a>) where another participant didn't use the \"1 0\" notation for no-mask cases. Instead, they employed random values, and their submission was accepted. This observation further supports my hypothesis that the format of indicating no mask might be the root cause of the issue with the submission. </p>\n<p>I have no submissions left, but I will try my hypothesis once they get reset.</p>",
      "rawMarkdown": "I suspect that the issue with your submissions might be related to the use of \"1 0\" to indicate the absence of a mask in your predictions. I observed that a very basic model of mine, which predicted masks for all inputs, had its submission accepted. However, when I used a more sophisticated model that included a couple of instances with \"1 0\" (indicating no mask), the submission was not successful.\n\nAdditionally, I found a relevant example ([https://www.kaggle.com/code/clemchris/test-submission](url)) where another participant didn't use the \"1 0\" notation for no-mask cases. Instead, they employed random values, and their submission was accepted. This observation further supports my hypothesis that the format of indicating no mask might be the root cause of the issue with the submission. \n\nI have no submissions left, but I will try my hypothesis once they get reset.",
      "votes": null
    },
    {
      "id": "2522610",
      "postDate": "11/12/2023 21:19:27",
      "content": "<p>I took this from the evaluation page \"Represent the RLE for an empty mask as 1 0.\"</p>",
      "rawMarkdown": "I took this from the evaluation page \"Represent the RLE for an empty mask as 1 0.\"",
      "votes": null
    },
    {
      "id": "2522784",
      "postDate": "11/13/2023 03:55:47",
      "content": "<p>Now i'm pretty sure that the \"1 0\" for empty mask is the problem here is my full investigation : <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008\" target=\"_blank\">https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008</a></p>",
      "rawMarkdown": "Now i'm pretty sure that the \"1 0\" for empty mask is the problem here is my full investigation : https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008",
      "votes": null
    },
    {
      "id": "2523060",
      "postDate": "11/13/2023 08:13:16",
      "content": "<p><a href=\"https://www.kaggle.com/abdrah\" target=\"_blank\">@abdrah</a>, good spot: I added one more test to my test-submission notebook where I used another dummy RLE and then it work: <a href=\"https://www.kaggle.com/code/clemchris/test-submission\" target=\"_blank\">https://www.kaggle.com/code/clemchris/test-submission</a></p>",
      "rawMarkdown": "abdrah, good spot: I added one more test to my test-submission notebook where I used another dummy RLE and then it work: https://www.kaggle.com/code/clemchris/test-submission",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2521239,
      "author_name": "davidbroberts",
      "author_url": "",
      "post_date": "11/11/2023 14:28:46",
      "content": "<p>Use all the slices in the test folders and ignore the sample submission dataframe. <br>\nWhen you submit, use the full filename for the ID column, like this .. <strong>kidney_5_dense_0001</strong>. I don't know if it's required to keep the zero padded slice number, but it does work to submit in that format.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2521563,
          "author_name": "sakvaua",
          "author_url": "",
          "post_date": "11/11/2023 20:07:18",
          "content": "<p>Thanks, David, still no luck. May I ask you if your submission had any actual predictions involving loading images, doing predictions, etc.?</p>",
          "votes": null,
          "replies": [
            {
              "id": 2521579,
              "author_name": "davidbroberts",
              "author_url": "",
              "post_date": "11/11/2023 20:52:08",
              "content": "<p>Yes, my subs read each image and create masks, then RLE encode them. </p>",
              "votes": null,
              "replies": []
            },
            {
              "id": 2521735,
              "author_name": "abdrah",
              "author_url": "",
              "post_date": "11/12/2023 02:57:34",
              "content": "<p>Hi <a href=\"https://www.kaggle.com/sakvaua\" target=\"_blank\">@sakvaua</a>, if you still have the problem, check that the values of your binary mask are indeed between 0 and 1 before computing the RLE. I lose 4 hours on that 😅. And also here is how I compute my RLE: </p>\n<pre><code> ():\n    \n\n    \n    pixels = binary_mask.flatten()\n\n    \n    pixels = np.concatenate([[], pixels, []])\n\n    \n    runs = np.where(pixels[:] != pixels[:-])[] + \n\n    \n    runs[::] -= runs[::]\n\n    rle = .join((x)  x  runs)\n\n     (rle) == :\n         \n\n    :\n         rle\n</code></pre>",
              "votes": null,
              "replies": [
                {
                  "id": 2521947,
                  "author_name": "sakvaua",
                  "author_url": "",
                  "post_date": "11/12/2023 07:39:23",
                  "content": "<p>Thanks, buddy, but this is not about the mask. It's about the way I form the submission file. I removed all the predictive parts and used 1 0 as a dummy submission and it still failed. It probably has to do with how id column is constructed.</p>",
                  "votes": null,
                  "replies": [
                    {
                      "id": 2522593,
                      "author_name": "abdrah",
                      "author_url": "",
                      "post_date": "11/12/2023 20:30:48",
                      "content": "<p>I suspect that the issue with your submissions might be related to the use of \"1 0\" to indicate the absence of a mask in your predictions. I observed that a very basic model of mine, which predicted masks for all inputs, had its submission accepted. However, when I used a more sophisticated model that included a couple of instances with \"1 0\" (indicating no mask), the submission was not successful.</p>\n<p>Additionally, I found a relevant example (<a href=\"url\" target=\"_blank\">https://www.kaggle.com/code/clemchris/test-submission</a>) where another participant didn't use the \"1 0\" notation for no-mask cases. Instead, they employed random values, and their submission was accepted. This observation further supports my hypothesis that the format of indicating no mask might be the root cause of the issue with the submission. </p>\n<p>I have no submissions left, but I will try my hypothesis once they get reset.</p>",
                      "votes": null,
                      "replies": [
                        {
                          "id": 2522610,
                          "author_name": "sakvaua",
                          "author_url": "",
                          "post_date": "11/12/2023 21:19:27",
                          "content": "<p>I took this from the evaluation page \"Represent the RLE for an empty mask as 1 0.\"</p>",
                          "votes": null,
                          "replies": [
                            {
                              "id": 2522784,
                              "author_name": "abdrah",
                              "author_url": "",
                              "post_date": "11/13/2023 03:55:47",
                              "content": "<p>Now i'm pretty sure that the \"1 0\" for empty mask is the problem here is my full investigation : <a href=\"https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008\" target=\"_blank\">https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008</a></p>",
                              "votes": null,
                              "replies": [
                                {
                                  "id": 2523060,
                                  "author_name": "clemchris",
                                  "author_url": "",
                                  "post_date": "11/13/2023 08:13:16",
                                  "content": "<p><a href=\"https://www.kaggle.com/abdrah\" target=\"_blank\">@abdrah</a>, good spot: I added one more test to my test-submission notebook where I used another dummy RLE and then it work: <a href=\"https://www.kaggle.com/code/clemchris/test-submission\" target=\"_blank\">https://www.kaggle.com/code/clemchris/test-submission</a></p>",
                                  "votes": null,
                                  "replies": []
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2521150": "1. There's a different number of files in the sample_submission.csv and actual test folders. sample_submission.csv has slices 0000 and 0001 and each of the two test folders has 3 files 0000 0001 0002. Should I use all of the files or only those in the sample_submission?\n2. Does it matter if the slice number is encoded as 0000 or just 0 in the submission file? The sample submission has 0000 while the evaluation page states it should be 0\n\nI know I can test this. But I already have two failed submissions (Submission scoring error) and don't want to spend all of my today's submissions on some random errors :)",
    "2521239": "Use all the slices in the test folders and ignore the sample submission dataframe. \nWhen you submit, use the full filename for the ID column, like this .. **kidney_5_dense_0001**. I don't know if it's required to keep the zero padded slice number, but it does work to submit in that format.",
    "2521563": "Thanks, David, still no luck. May I ask you if your submission had any actual predictions involving loading images, doing predictions, etc.?",
    "2521579": "Yes, my subs read each image and create masks, then RLE encode them.",
    "2521735": "Hi @sakvaua, if you still have the problem, check that the values of your binary mask are indeed between 0 and 1 before computing the RLE. I lose 4 hours on that 😅. And also here is how I compute my RLE: \n\n```python\n\ndef binary_mask_to_rle(binary_mask):\n    \"\"\"\n    Convert a binary mask to Run Length Encoding (RLE).\n    Args:\n        binary_mask (ndarray): binary mask of shape [width, height]\n    Returns:\n        rle (str): run-length as string formated\n    \"\"\"\n\n    # Flatten the mask\n    pixels = binary_mask.flatten()\n\n    # Pad the start and end with zero to capture runs that might start or end at the edges\n    pixels = np.concatenate([[0], pixels, [0]])\n\n    # Find where the pixels change\n    runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n\n    # Ensure that every second element subtracts the one before it\n    runs[1::2] -= runs[::2]\n\n    rle = \" \".join(str(x) for x in runs)\n\n    if len(rle) == 0:\n        return \"1 0\"\n\n    else:\n        return rle\n\n```",
    "2521947": "Thanks, buddy, but this is not about the mask. It's about the way I form the submission file. I removed all the predictive parts and used 1 0 as a dummy submission and it still failed. It probably has to do with how id column is constructed.",
    "2522593": "I suspect that the issue with your submissions might be related to the use of \"1 0\" to indicate the absence of a mask in your predictions. I observed that a very basic model of mine, which predicted masks for all inputs, had its submission accepted. However, when I used a more sophisticated model that included a couple of instances with \"1 0\" (indicating no mask), the submission was not successful.\n\nAdditionally, I found a relevant example ([https://www.kaggle.com/code/clemchris/test-submission](url)) where another participant didn't use the \"1 0\" notation for no-mask cases. Instead, they employed random values, and their submission was accepted. This observation further supports my hypothesis that the format of indicating no mask might be the root cause of the issue with the submission. \n\nI have no submissions left, but I will try my hypothesis once they get reset.",
    "2522610": "I took this from the evaluation page \"Represent the RLE for an empty mask as 1 0.\"",
    "2522784": "Now i'm pretty sure that the \"1 0\" for empty mask is the problem here is my full investigation : https://www.kaggle.com/competitions/blood-vessel-segmentation/discussion/455008",
    "2523060": "abdrah, good spot: I added one more test to my test-submission notebook where I used another dummy RLE and then it work: https://www.kaggle.com/code/clemchris/test-submission"
  },
  "source": "meta"
}