{
  "id": 297774,
  "title": "Tips about \"Submission Scoring Error\"",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/297774",
  "author_name": "",
  "post_date": "2021-12-29T13:58:34.855662600Z",
  "votes": 4,
  "comment_count": 23,
  "views": 0,
  "content": "<hr>\n<h1>Note for someone who encounters the same error</h1>\n<p>I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.</p>\n<p>What I can say generally is just said in the below thread:<br>\n<a href=\"https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\" target=\"_blank\">https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598</a></p>\n<p>To be short, just make sure your submission is O.K. on your local before submit your code.<br>\nHope you success in detecting error.</p>\n<hr>\n<h1>Original Contents</h1>\n<p>Maybe almost all of you are not in the case, but, for some reason, I have to call test data providing API from python script like this:</p>\n<pre><code>cd /tmp/my_project\npython /tmp/infer.py\n</code></pre>\n<p>in this case, <code>submission.csv</code> is created in directory <code>/tmp/my_project</code>, so the evaluation fails after completed inference over whole test data.</p>\n<p>In this case, don't forget to copy <code>submission.csv</code> to <code>/kaggle/working</code> like this:</p>\n<pre><code>cd /tmp/my_project\npython /tmp/infer.py\ncp submission.csv /kaggle/working/.\n</code></pre>\n<p>It took me some hours to find out this. (At first time, I just copied <code>sample_submission.csv</code> as <code>submission.csv</code>. Clearly this is wrong. API creates the file <code>submission.csv</code>. Don't place the other file.)</p>\n<p>I guess it is as usual in In the kernel competition, but the crew why the notebook failed is too few. it is really frustrating.</p>\n<p>Hope this tips helps someone.</p>\n<p>BTW, I share a useful tips for debugging in kernel competition:<br>\n<a href=\"https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046\" target=\"_blank\">https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046</a></p>",
  "messages": [
    {
      "id": "1632331",
      "postDate": "12/29/2021 13:58:34",
      "content": "<hr>\n<h1>Note for someone who encounters the same error</h1>\n<p>I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.</p>\n<p>What I can say generally is just said in the below thread:<br>\n<a href=\"https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\" target=\"_blank\">https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598</a></p>\n<p>To be short, just make sure your submission is O.K. on your local before submit your code.<br>\nHope you success in detecting error.</p>\n<hr>\n<h1>Original Contents</h1>\n<p>Maybe almost all of you are not in the case, but, for some reason, I have to call test data providing API from python script like this:</p>\n<pre><code>cd /tmp/my_project\npython /tmp/infer.py\n</code></pre>\n<p>in this case, <code>submission.csv</code> is created in directory <code>/tmp/my_project</code>, so the evaluation fails after completed inference over whole test data.</p>\n<p>In this case, don't forget to copy <code>submission.csv</code> to <code>/kaggle/working</code> like this:</p>\n<pre><code>cd /tmp/my_project\npython /tmp/infer.py\ncp submission.csv /kaggle/working/.\n</code></pre>\n<p>It took me some hours to find out this. (At first time, I just copied <code>sample_submission.csv</code> as <code>submission.csv</code>. Clearly this is wrong. API creates the file <code>submission.csv</code>. Don't place the other file.)</p>\n<p>I guess it is as usual in In the kernel competition, but the crew why the notebook failed is too few. it is really frustrating.</p>\n<p>Hope this tips helps someone.</p>\n<p>BTW, I share a useful tips for debugging in kernel competition:<br>\n<a href=\"https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046\" target=\"_blank\">https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046</a></p>",
      "rawMarkdown": "# Note for someone who encounters the same error\n\nI’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.\n\nWhat I can say generally is just said in the below thread:\nhttps://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\n\nTo be short, just make sure your submission is O.K. on your local before submit your code.\nHope you success in detecting error.\n\n----------------\n\n# Original Contents\n\nMaybe almost all of you are not in the case, but, for some reason, I have to call test data providing API from python script like this:\n\n```bash\ncd /tmp/my_project\npython /tmp/infer.py\n```\n\nin this case, `submission.csv` is created in directory `/tmp/my_project`, so the evaluation fails after completed inference over whole test data.\n\nIn this case, don't forget to copy `submission.csv` to `/kaggle/working` like this:\n\n```bash\ncd /tmp/my_project\npython /tmp/infer.py\ncp submission.csv /kaggle/working/.\n```\n\nIt took me some hours to find out this. (At first time, I just copied `sample_submission.csv` as `submission.csv`. Clearly this is wrong. API creates the file `submission.csv`. Don't place the other file.)\n\nI guess it is as usual in In the kernel competition, but the crew why the notebook failed is too few. it is really frustrating.\n\nHope this tips helps someone.\n\nBTW, I share a useful tips for debugging in kernel competition:\nhttps://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046",
      "votes": null
    },
    {
      "id": "1637236",
      "postDate": "01/03/2022 17:11:33",
      "content": "<p>Do you mind sharing if your submission csv has NaN in it? My team is having difficulty getting it to submit.</p>",
      "rawMarkdown": "Do you mind sharing if your submission csv has NaN in it? My team is having difficulty getting it to submit.",
      "votes": null
    },
    {
      "id": "1637471",
      "postDate": "01/03/2022 23:14:50",
      "content": "<p><a href=\"https://www.kaggle.com/hkrsmk\" target=\"_blank\">@hkrsmk</a> Do you mean the annotation column of submission.csv contains nan or not? In my case, no. My notebook outputs blank string when zero detection.</p>\n<p>But some public notebook[1], it seems to contain nan, so it might not be the cause of submission error, if you show one.<br>\n[1] <a href=\"https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507\" target=\"_blank\">https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507</a></p>\n<p>Why don’t you check if a simple nan only submission pass the evaluation If you want to be sure? I think it will take only 10 minutes or so.</p>",
      "rawMarkdown": "hkrsmk Do you mean the annotation column of submission.csv contains nan or not? In my case, no. My notebook outputs blank string when zero detection.\n\nBut some public notebook[1], it seems to contain nan, so it might not be the cause of submission error, if you show one.\n[1] https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507\n\nWhy don’t you check if a simple nan only submission pass the evaluation If you want to be sure? I think it will take only 10 minutes or so.",
      "votes": null
    },
    {
      "id": "1637563",
      "postDate": "01/04/2022 02:51:33",
      "content": "<p>Yeah that's what my code does as well… I'll put in a string of '0 0 0 0 0' to see if that changes things.</p>\n<p>You'll notice that empty string is evaluated to NaN when we put it in a pandas dataframe from a csv, and I think that's where it comes from.</p>\n<p>Edit: 0 0 0 0 0 doesn't work either. No idea where the issue is.</p>",
      "rawMarkdown": "Yeah that's what my code does as well... I'll put in a string of '0 0 0 0 0' to see if that changes things.\n\nYou'll notice that empty string is evaluated to NaN when we put it in a pandas dataframe from a csv, and I think that's where it comes from.\n\nEdit: 0 0 0 0 0 doesn't work either. No idea where the issue is.",
      "votes": null
    },
    {
      "id": "1637598",
      "postDate": "01/04/2022 04:03:44",
      "content": "<p>My basic idea is like this:</p>\n<ol>\n<li>check the infer script runs over train set and verify if the result does’t contain any unusual data.</li>\n<li>If you can’t find anything wrong, probing hack like [1] may help to check where your script fails.</li>\n</ol>\n<p>Hope you success.</p>\n<p>[1] <a href=\"https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046\" target=\"_blank\">https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046</a></p>",
      "rawMarkdown": "My basic idea is like this:\n\n1. check the infer script runs over train set and verify if the result does’t contain any unusual data.\n2. If you can’t find anything wrong, probing hack like [1] may help to check where your script fails.\n\nHope you success.\n\n[1] https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046",
      "votes": null
    },
    {
      "id": "1637605",
      "postDate": "01/04/2022 04:12:51",
      "content": "<ol>\n<li>Yeah, maybe more extensive testing is needed…</li>\n</ol>\n<p>Would 2. work even for submission scoring error? Because for that case at least a score is coming back in the submission and they're using that to debug instead.</p>",
      "rawMarkdown": "1. Yeah, maybe more extensive testing is needed...\n\nWould 2. work even for submission scoring error? Because for that case at least a score is coming back in the submission and they're using that to debug instead.",
      "votes": null
    },
    {
      "id": "1637664",
      "postDate": "01/04/2022 05:30:53",
      "content": "<p>(edited)</p>\n<blockquote>\n  <p>Because for that case at least a score is coming back in the submission and they're using that to debug instead.</p>\n</blockquote>\n<p>I agree with that. In my understanding, this error usually come upon during evaluation step (but I'm not 100% sure).<br>\nIf you are confident on your script never fails, I think checking your submission result is easier.</p>\n<p>I don't think you need complicated test. In most of the cases, the cause is simple: format error, value error, invalid bbox, length of submissions is inconsistent, etc.</p>",
      "rawMarkdown": "(edited)\n\n> Because for that case at least a score is coming back in the submission and they're using that to debug instead.\n\nI agree with that. In my understanding, this error usually come upon during evaluation step (but I'm not 100% sure).\nIf you are confident on your script never fails, I think checking your submission result is easier.\n\nI don't think you need complicated test. In most of the cases, the cause is simple: format error, value error, invalid bbox, length of submissions is inconsistent, etc.",
      "votes": null
    },
    {
      "id": "1637851",
      "postDate": "01/04/2022 08:58:00",
      "content": "<p>Hmm alright, thanks!</p>",
      "rawMarkdown": "Hmm alright, thanks!",
      "votes": null
    },
    {
      "id": "1638408",
      "postDate": "01/04/2022 17:34:54",
      "content": "<p>I would strongly recommend changing your setup so you can run a traditional pipeline. Interacting directly with the submission gets you flagged for a cheat ban review at the end of the competition. </p>",
      "rawMarkdown": "I would strongly recommend changing your setup so you can run a traditional pipeline. Interacting directly with the submission gets you flagged for a cheat ban review at the end of the competition.",
      "votes": null
    },
    {
      "id": "1638697",
      "postDate": "01/04/2022 23:54:09",
      "content": "<p>Hi. Thank you for commenting.</p>\n<p>But I don't get what <code>traditional pipeline</code> and <code>Interacting directly with the submission</code> mean.<br>\nDoes the latter mean modifying <code>submission.csv</code> directly?</p>",
      "rawMarkdown": "Hi. Thank you for commenting.\n\nBut I don't get what `traditional pipeline` and `Interacting directly with the submission` mean.\nDoes the latter mean modifying `submission.csv` directly?",
      "votes": null
    },
    {
      "id": "1638706",
      "postDate": "01/05/2022 00:05:48",
      "content": "<p>Yes, I mean directly modifying the submission file.</p>",
      "rawMarkdown": "Yes, I mean directly modifying the submission file.",
      "votes": null
    },
    {
      "id": "1638718",
      "postDate": "01/05/2022 00:19:48",
      "content": "<p>I see. Thank you for letting me know.</p>",
      "rawMarkdown": "I see. Thank you for letting me know.",
      "votes": null
    },
    {
      "id": "1638719",
      "postDate": "01/05/2022 00:25:37",
      "content": "<p>By the way, my current configuration is not modifying <code>submission.csv</code>. At the first time I thought <code>submission.csv</code> is just a dummy file because we already have an interface to submit with API.<br>\nNow I understands it is not correct, I already modified my infer notebook.</p>",
      "rawMarkdown": "By the way, my current configuration is not modifying `submission.csv`. At the first time I thought `submission.csv` is just a dummy file because we already have an interface to submit with API.\nNow I understands it is not correct, I already modified my infer notebook.",
      "votes": null
    },
    {
      "id": "1638722",
      "postDate": "01/05/2022 00:37:04",
      "content": "<p>Wait, do you mean just moving <code>submission.csv</code> touches the rule?</p>\n<p>My inference script have to run under the specific directory, and submission API seems to create <code>submission.csv</code> in the current directory. So I have to move the file to <code>/kaggle/working</code> to correctly scores. I don't touch any of the file contents.<br>\nDoes Kaggle considers this is against rule?</p>",
      "rawMarkdown": "Wait, do you mean just moving `submission.csv` touches the rule?\n\nMy inference script have to run under the specific directory, and submission API seems to create `submission.csv` in the current directory. So I have to move the file to `/kaggle/working` to correctly scores. I don't touch any of the file contents.\nDoes Kaggle considers this is against rule?",
      "votes": null
    },
    {
      "id": "1675112",
      "postDate": "02/04/2022 03:44:11",
      "content": "<p>Great information. Thanks.</p>",
      "rawMarkdown": "Great information. Thanks.",
      "votes": null
    },
    {
      "id": "1675420",
      "postDate": "02/04/2022 09:00:12",
      "content": "<p>Hi, i stand with same error<br>\ncan you give me advice? </p>\n<pre><code>def format_prediction(bboxes):\n    annot = ''\n    bboxes=np.array(bboxes)\n    bboxes=bboxes[bboxes[:,4]&gt;CONF]\n    if len(bboxes)&gt;0:\n        for bb in bboxes:\n            annot += f'{bb[4]:.2f} {int(bb[0])} {int(bb[1])} {int(bb[2])} {int(bb[3])}'\n            annot +=' '\n        annot = annot.strip(' ')\n    return annot\n</code></pre>\n<pre><code>for idx, (img, pred_df) in tqdm(enumerate(iter_test)):\n    bb_pred = get_img_predict_multi(models,img, sizes, flips)\n    annot = format_prediction(bb_pred)\n    pred_df['annotations'] = annot\n    env.predict(pred_df)\n</code></pre>",
      "rawMarkdown": "Hi, i stand with same error\ncan you give me advice? \n```\ndef format_prediction(bboxes):\n    annot = ''\n    bboxes=np.array(bboxes)\n    bboxes=bboxes[bboxes[:,4]>CONF]\n    if len(bboxes)>0:\n        for bb in bboxes:\n            annot += f'{bb[4]:.2f} {int(bb[0])} {int(bb[1])} {int(bb[2])} {int(bb[3])}'\n            annot +=' '\n        annot = annot.strip(' ')\n    return annot\n```\n\n```\nfor idx, (img, pred_df) in tqdm(enumerate(iter_test)):\n    bb_pred = get_img_predict_multi(models,img, sizes, flips)\n    annot = format_prediction(bb_pred)\n    pred_df['annotations'] = annot\n    env.predict(pred_df)\n```",
      "votes": null
    },
    {
      "id": "1675510",
      "postDate": "02/04/2022 10:11:08",
      "content": "<p><a href=\"https://www.kaggle.com/nicksergievskiy\" target=\"_blank\">@nicksergievskiy</a> I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.</p>\n<p>What I can say generally is just said in the below thread:<br>\n<a href=\"https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\" target=\"_blank\">https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598</a></p>\n<p>To be short, just make sure your submission is O.K. on your local before submit your code.</p>",
      "rawMarkdown": "nicksergievskiy I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.\n\nWhat I can say generally is just said in the below thread:\nhttps://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\n\nTo be short, just make sure your submission is O.K. on your local before submit your code.",
      "votes": null
    },
    {
      "id": "1675535",
      "postDate": "02/04/2022 10:38:16",
      "content": "<p>Thank you answering<br>\nFor me its ok and looks same as public code, And results formating is ok too</p>",
      "rawMarkdown": "Thank you answering\nFor me its ok and looks same as public code, And results formating is ok too",
      "votes": null
    },
    {
      "id": "1675543",
      "postDate": "02/04/2022 10:45:10",
      "content": "<p><a href=\"https://www.kaggle.com/tatamikenn\" target=\"_blank\">@tatamikenn</a> <br>\nCan you look at non runeble code (not open private datases and code)?<br>\n<a href=\"https://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error\" target=\"_blank\">https://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error</a></p>",
      "rawMarkdown": "tatamikenn \nCan you look at non runeble code (not open private datases and code)?\nhttps://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error",
      "votes": null
    },
    {
      "id": "1675570",
      "postDate": "02/04/2022 11:15:46",
      "content": "<p><a href=\"https://www.kaggle.com/nicksergievskiy\" target=\"_blank\">@nicksergievskiy</a> Sorry, I don't have much time. Hope you find the error.</p>",
      "rawMarkdown": "nicksergievskiy Sorry, I don't have much time. Hope you find the error.",
      "votes": null
    },
    {
      "id": "1675601",
      "postDate": "02/04/2022 11:27:17",
      "content": "<p>For quick look, your submission code looks O.K. Maybe some edge case in your prediction code might matters.<br>\ne.g. blank box - <code>bbox==[]</code>, <code>nan</code> prediction etc.</p>",
      "rawMarkdown": "For quick look, your submission code looks O.K. Maybe some edge case in your prediction code might matters.\ne.g. blank box - `bbox==[]`, `nan` prediction etc.",
      "votes": null
    },
    {
      "id": "1675606",
      "postDate": "02/04/2022 11:31:43",
      "content": "<p>For example, your check_result function doesn't work for blank array.<br>\nQuick fix is replacing blank array to zero-lengh numpy array.</p>\n<pre><code>&gt;&gt;&gt; check_result([], (100, 20)) # &lt;-- this does't work\nTraceback (most recent call last):\n  File \"&lt;stdin&gt;\", line 1, in &lt;module&gt;\n  File \"&lt;stdin&gt;\", line 3, in check_result\nIndexError: too many indices for array: array is 1-dimensional, but 2 were indexed\n&gt;&gt;&gt; check_result(np.zeros((0, 5)), (100, 20)) # &lt;-- this works\narray([], shape=(0, 5), dtype=float64)\n</code></pre>",
      "rawMarkdown": "For example, your check_result function doesn't work for blank array.\nQuick fix is replacing blank array to zero-lengh numpy array.\n\n```\n>>> check_result([], (100, 20)) # <-- this does't work\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"<stdin>\", line 3, in check_result\nIndexError: too many indices for array: array is 1-dimensional, but 2 were indexed\n>>> check_result(np.zeros((0, 5)), (100, 20)) # <-- this works\narray([], shape=(0, 5), dtype=float64)\n```",
      "votes": null
    },
    {
      "id": "1675620",
      "postDate": "02/04/2022 11:38:35",
      "content": "<p>One more quick advice: make your code as robust as possible.<br>\nAvoid any possible failure of your code.</p>\n<p>e.g.</p>\n<ul>\n<li>use try-catch at your suspicious code and gently handle error</li>\n<li>replacing all possible irregular values(<code>nan</code>) into regular value (0) etc.</li>\n</ul>",
      "rawMarkdown": "One more quick advice: make your code as robust as possible.\nAvoid any possible failure of your code.\n\ne.g.\n\n* use try-catch at your suspicious code and gently handle error\n* replacing all possible irregular values(`nan`) into regular value (0) etc.",
      "votes": null
    },
    {
      "id": "1676470",
      "postDate": "02/05/2022 02:22:17",
      "content": "<p>Thank you <a href=\"https://www.kaggle.com/tatamikenn\" target=\"_blank\">@tatamikenn</a> <br>\nboth of your advice is correct! <br>\nNow with skip errors my code is working</p>",
      "rawMarkdown": "Thank you @tatamikenn \nboth of your advice is correct! \nNow with skip errors my code is working",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1637236,
      "author_name": "hkrsmk",
      "author_url": "",
      "post_date": "01/03/2022 17:11:33",
      "content": "<p>Do you mind sharing if your submission csv has NaN in it? My team is having difficulty getting it to submit.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1637471,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/03/2022 23:14:50",
          "content": "<p><a href=\"https://www.kaggle.com/hkrsmk\" target=\"_blank\">@hkrsmk</a> Do you mean the annotation column of submission.csv contains nan or not? In my case, no. My notebook outputs blank string when zero detection.</p>\n<p>But some public notebook[1], it seems to contain nan, so it might not be the cause of submission error, if you show one.<br>\n[1] <a href=\"https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507\" target=\"_blank\">https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507</a></p>\n<p>Why don’t you check if a simple nan only submission pass the evaluation If you want to be sure? I think it will take only 10 minutes or so.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1637563,
          "author_name": "hkrsmk",
          "author_url": "",
          "post_date": "01/04/2022 02:51:33",
          "content": "<p>Yeah that's what my code does as well… I'll put in a string of '0 0 0 0 0' to see if that changes things.</p>\n<p>You'll notice that empty string is evaluated to NaN when we put it in a pandas dataframe from a csv, and I think that's where it comes from.</p>\n<p>Edit: 0 0 0 0 0 doesn't work either. No idea where the issue is.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1637598,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/04/2022 04:03:44",
          "content": "<p>My basic idea is like this:</p>\n<ol>\n<li>check the infer script runs over train set and verify if the result does’t contain any unusual data.</li>\n<li>If you can’t find anything wrong, probing hack like [1] may help to check where your script fails.</li>\n</ol>\n<p>Hope you success.</p>\n<p>[1] <a href=\"https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046\" target=\"_blank\">https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1637605,
          "author_name": "hkrsmk",
          "author_url": "",
          "post_date": "01/04/2022 04:12:51",
          "content": "<ol>\n<li>Yeah, maybe more extensive testing is needed…</li>\n</ol>\n<p>Would 2. work even for submission scoring error? Because for that case at least a score is coming back in the submission and they're using that to debug instead.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1637664,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/04/2022 05:30:53",
          "content": "<p>(edited)</p>\n<blockquote>\n  <p>Because for that case at least a score is coming back in the submission and they're using that to debug instead.</p>\n</blockquote>\n<p>I agree with that. In my understanding, this error usually come upon during evaluation step (but I'm not 100% sure).<br>\nIf you are confident on your script never fails, I think checking your submission result is easier.</p>\n<p>I don't think you need complicated test. In most of the cases, the cause is simple: format error, value error, invalid bbox, length of submissions is inconsistent, etc.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1637851,
          "author_name": "hkrsmk",
          "author_url": "",
          "post_date": "01/04/2022 08:58:00",
          "content": "<p>Hmm alright, thanks!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675112,
          "author_name": "eugeneryu",
          "author_url": "",
          "post_date": "02/04/2022 03:44:11",
          "content": "<p>Great information. Thanks.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1638408,
      "author_name": "sohier",
      "author_url": "",
      "post_date": "01/04/2022 17:34:54",
      "content": "<p>I would strongly recommend changing your setup so you can run a traditional pipeline. Interacting directly with the submission gets you flagged for a cheat ban review at the end of the competition. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1638697,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/04/2022 23:54:09",
          "content": "<p>Hi. Thank you for commenting.</p>\n<p>But I don't get what <code>traditional pipeline</code> and <code>Interacting directly with the submission</code> mean.<br>\nDoes the latter mean modifying <code>submission.csv</code> directly?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1638706,
          "author_name": "sohier",
          "author_url": "",
          "post_date": "01/05/2022 00:05:48",
          "content": "<p>Yes, I mean directly modifying the submission file.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1638718,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/05/2022 00:19:48",
          "content": "<p>I see. Thank you for letting me know.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1638719,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/05/2022 00:25:37",
          "content": "<p>By the way, my current configuration is not modifying <code>submission.csv</code>. At the first time I thought <code>submission.csv</code> is just a dummy file because we already have an interface to submit with API.<br>\nNow I understands it is not correct, I already modified my infer notebook.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1638722,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "01/05/2022 00:37:04",
          "content": "<p>Wait, do you mean just moving <code>submission.csv</code> touches the rule?</p>\n<p>My inference script have to run under the specific directory, and submission API seems to create <code>submission.csv</code> in the current directory. So I have to move the file to <code>/kaggle/working</code> to correctly scores. I don't touch any of the file contents.<br>\nDoes Kaggle considers this is against rule?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1675420,
      "author_name": "nicksergievskiy",
      "author_url": "",
      "post_date": "02/04/2022 09:00:12",
      "content": "<p>Hi, i stand with same error<br>\ncan you give me advice? </p>\n<pre><code>def format_prediction(bboxes):\n    annot = ''\n    bboxes=np.array(bboxes)\n    bboxes=bboxes[bboxes[:,4]&gt;CONF]\n    if len(bboxes)&gt;0:\n        for bb in bboxes:\n            annot += f'{bb[4]:.2f} {int(bb[0])} {int(bb[1])} {int(bb[2])} {int(bb[3])}'\n            annot +=' '\n        annot = annot.strip(' ')\n    return annot\n</code></pre>\n<pre><code>for idx, (img, pred_df) in tqdm(enumerate(iter_test)):\n    bb_pred = get_img_predict_multi(models,img, sizes, flips)\n    annot = format_prediction(bb_pred)\n    pred_df['annotations'] = annot\n    env.predict(pred_df)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1675510,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "02/04/2022 10:11:08",
          "content": "<p><a href=\"https://www.kaggle.com/nicksergievskiy\" target=\"_blank\">@nicksergievskiy</a> I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.</p>\n<p>What I can say generally is just said in the below thread:<br>\n<a href=\"https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\" target=\"_blank\">https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598</a></p>\n<p>To be short, just make sure your submission is O.K. on your local before submit your code.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675535,
          "author_name": "nicksergievskiy",
          "author_url": "",
          "post_date": "02/04/2022 10:38:16",
          "content": "<p>Thank you answering<br>\nFor me its ok and looks same as public code, And results formating is ok too</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675543,
          "author_name": "nicksergievskiy",
          "author_url": "",
          "post_date": "02/04/2022 10:45:10",
          "content": "<p><a href=\"https://www.kaggle.com/tatamikenn\" target=\"_blank\">@tatamikenn</a> <br>\nCan you look at non runeble code (not open private datases and code)?<br>\n<a href=\"https://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error\" target=\"_blank\">https://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675570,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "02/04/2022 11:15:46",
          "content": "<p><a href=\"https://www.kaggle.com/nicksergievskiy\" target=\"_blank\">@nicksergievskiy</a> Sorry, I don't have much time. Hope you find the error.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675601,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "02/04/2022 11:27:17",
          "content": "<p>For quick look, your submission code looks O.K. Maybe some edge case in your prediction code might matters.<br>\ne.g. blank box - <code>bbox==[]</code>, <code>nan</code> prediction etc.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675606,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "02/04/2022 11:31:43",
          "content": "<p>For example, your check_result function doesn't work for blank array.<br>\nQuick fix is replacing blank array to zero-lengh numpy array.</p>\n<pre><code>&gt;&gt;&gt; check_result([], (100, 20)) # &lt;-- this does't work\nTraceback (most recent call last):\n  File \"&lt;stdin&gt;\", line 1, in &lt;module&gt;\n  File \"&lt;stdin&gt;\", line 3, in check_result\nIndexError: too many indices for array: array is 1-dimensional, but 2 were indexed\n&gt;&gt;&gt; check_result(np.zeros((0, 5)), (100, 20)) # &lt;-- this works\narray([], shape=(0, 5), dtype=float64)\n</code></pre>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1675620,
          "author_name": "tatamikenn",
          "author_url": "",
          "post_date": "02/04/2022 11:38:35",
          "content": "<p>One more quick advice: make your code as robust as possible.<br>\nAvoid any possible failure of your code.</p>\n<p>e.g.</p>\n<ul>\n<li>use try-catch at your suspicious code and gently handle error</li>\n<li>replacing all possible irregular values(<code>nan</code>) into regular value (0) etc.</li>\n</ul>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1676470,
          "author_name": "nicksergievskiy",
          "author_url": "",
          "post_date": "02/05/2022 02:22:17",
          "content": "<p>Thank you <a href=\"https://www.kaggle.com/tatamikenn\" target=\"_blank\">@tatamikenn</a> <br>\nboth of your advice is correct! <br>\nNow with skip errors my code is working</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1632331": "# Note for someone who encounters the same error\n\nI’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.\n\nWhat I can say generally is just said in the below thread:\nhttps://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\n\nTo be short, just make sure your submission is O.K. on your local before submit your code.\nHope you success in detecting error.\n\n----------------\n\n# Original Contents\n\nMaybe almost all of you are not in the case, but, for some reason, I have to call test data providing API from python script like this:\n\n```bash\ncd /tmp/my_project\npython /tmp/infer.py\n```\n\nin this case, `submission.csv` is created in directory `/tmp/my_project`, so the evaluation fails after completed inference over whole test data.\n\nIn this case, don't forget to copy `submission.csv` to `/kaggle/working` like this:\n\n```bash\ncd /tmp/my_project\npython /tmp/infer.py\ncp submission.csv /kaggle/working/.\n```\n\nIt took me some hours to find out this. (At first time, I just copied `sample_submission.csv` as `submission.csv`. Clearly this is wrong. API creates the file `submission.csv`. Don't place the other file.)\n\nI guess it is as usual in In the kernel competition, but the crew why the notebook failed is too few. it is really frustrating.\n\nHope this tips helps someone.\n\nBTW, I share a useful tips for debugging in kernel competition:\nhttps://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046",
    "1637236": "Do you mind sharing if your submission csv has NaN in it? My team is having difficulty getting it to submit.",
    "1637471": "hkrsmk Do you mean the annotation column of submission.csv contains nan or not? In my case, no. My notebook outputs blank string when zero detection.\n\nBut some public notebook[1], it seems to contain nan, so it might not be the cause of submission error, if you show one.\n[1] https://www.kaggle.com/remekkinas/yolox-inference-on-kaggle-for-cots-lb-0-507\n\nWhy don’t you check if a simple nan only submission pass the evaluation If you want to be sure? I think it will take only 10 minutes or so.",
    "1637563": "Yeah that's what my code does as well... I'll put in a string of '0 0 0 0 0' to see if that changes things.\n\nYou'll notice that empty string is evaluated to NaN when we put it in a pandas dataframe from a csv, and I think that's where it comes from.\n\nEdit: 0 0 0 0 0 doesn't work either. No idea where the issue is.",
    "1637598": "My basic idea is like this:\n\n1. check the infer script runs over train set and verify if the result does’t contain any unusual data.\n2. If you can’t find anything wrong, probing hack like [1] may help to check where your script fails.\n\nHope you success.\n\n[1] https://www.kaggle.com/c/nfl-health-and-safety-helmet-assignment/discussion/279046",
    "1637605": "1. Yeah, maybe more extensive testing is needed...\n\nWould 2. work even for submission scoring error? Because for that case at least a score is coming back in the submission and they're using that to debug instead.",
    "1637664": "(edited)\n\n> Because for that case at least a score is coming back in the submission and they're using that to debug instead.\n\nI agree with that. In my understanding, this error usually come upon during evaluation step (but I'm not 100% sure).\nIf you are confident on your script never fails, I think checking your submission result is easier.\n\nI don't think you need complicated test. In most of the cases, the cause is simple: format error, value error, invalid bbox, length of submissions is inconsistent, etc.",
    "1637851": "Hmm alright, thanks!",
    "1638408": "I would strongly recommend changing your setup so you can run a traditional pipeline. Interacting directly with the submission gets you flagged for a cheat ban review at the end of the competition.",
    "1638697": "Hi. Thank you for commenting.\n\nBut I don't get what `traditional pipeline` and `Interacting directly with the submission` mean.\nDoes the latter mean modifying `submission.csv` directly?",
    "1638706": "Yes, I mean directly modifying the submission file.",
    "1638718": "I see. Thank you for letting me know.",
    "1638719": "By the way, my current configuration is not modifying `submission.csv`. At the first time I thought `submission.csv` is just a dummy file because we already have an interface to submit with API.\nNow I understands it is not correct, I already modified my infer notebook.",
    "1638722": "Wait, do you mean just moving `submission.csv` touches the rule?\n\nMy inference script have to run under the specific directory, and submission API seems to create `submission.csv` in the current directory. So I have to move the file to `/kaggle/working` to correctly scores. I don't touch any of the file contents.\nDoes Kaggle considers this is against rule?",
    "1675112": "Great information. Thanks.",
    "1675420": "Hi, i stand with same error\ncan you give me advice? \n```\ndef format_prediction(bboxes):\n    annot = ''\n    bboxes=np.array(bboxes)\n    bboxes=bboxes[bboxes[:,4]>CONF]\n    if len(bboxes)>0:\n        for bb in bboxes:\n            annot += f'{bb[4]:.2f} {int(bb[0])} {int(bb[1])} {int(bb[2])} {int(bb[3])}'\n            annot +=' '\n        annot = annot.strip(' ')\n    return annot\n```\n\n```\nfor idx, (img, pred_df) in tqdm(enumerate(iter_test)):\n    bb_pred = get_img_predict_multi(models,img, sizes, flips)\n    annot = format_prediction(bb_pred)\n    pred_df['annotations'] = annot\n    env.predict(pred_df)\n```",
    "1675510": "nicksergievskiy I’m sorry but this error is too general error, and I can’t say the reason of failure only by reading your submission code.\n\nWhat I can say generally is just said in the below thread:\nhttps://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/297774#1637598\n\nTo be short, just make sure your submission is O.K. on your local before submit your code.",
    "1675535": "Thank you answering\nFor me its ok and looks same as public code, And results formating is ok too",
    "1675543": "tatamikenn \nCan you look at non runeble code (not open private datases and code)?\nhttps://www.kaggle.com/nicksergievskiy/cots-ens-yolov5-submission-scoring-error",
    "1675570": "nicksergievskiy Sorry, I don't have much time. Hope you find the error.",
    "1675601": "For quick look, your submission code looks O.K. Maybe some edge case in your prediction code might matters.\ne.g. blank box - `bbox==[]`, `nan` prediction etc.",
    "1675606": "For example, your check_result function doesn't work for blank array.\nQuick fix is replacing blank array to zero-lengh numpy array.\n\n```\n>>> check_result([], (100, 20)) # <-- this does't work\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"<stdin>\", line 3, in check_result\nIndexError: too many indices for array: array is 1-dimensional, but 2 were indexed\n>>> check_result(np.zeros((0, 5)), (100, 20)) # <-- this works\narray([], shape=(0, 5), dtype=float64)\n```",
    "1675620": "One more quick advice: make your code as robust as possible.\nAvoid any possible failure of your code.\n\ne.g.\n\n* use try-catch at your suspicious code and gently handle error\n* replacing all possible irregular values(`nan`) into regular value (0) etc.",
    "1676470": "Thank you @tatamikenn \nboth of your advice is correct! \nNow with skip errors my code is working"
  },
  "source": "meta"
}