{
  "id": 28137,
  "title": "Evaluation Exception: KeyNotFoundException",
  "url": "/competitions/dstl-satellite-imagery-feature-detection/discussion/28137",
  "author_name": "",
  "post_date": "2017-01-26T10:18:35.203Z",
  "votes": 2,
  "comment_count": 15,
  "views": 211,
  "content": "<p>Hi,</p>\n\n<p>I got a \"KeyNotFoundException\" exception with following message:</p>\n\n<blockquote>\n  <p>Evaluation Exception: For image 6150_3_4, class 1, there's an\n  exception in geometry System.Collections.Generic.KeyNotFoundException:\n  The given key was not present in the dictionary. at\n  System.Collections.Generic.Dictionary<code>2.get_Item(TKey key) at\n  Kaggle.Metrics.Custom.JaccardDSTL.calculateIoUVector(Dictionary</code>2\n  submission, Dictionary`2 solution)..</p>\n</blockquote>\n\n<p>It seems there are invalid polygons for image 6150_3_4, class 1, but the solution for image 6150_3_4, class 1 is \"GEOMETRYCOLLECTION EMPTY\".</p>\n\n<pre><code>$ zcat my_answer.csv.gz | grep \"6150_3_4,1,\"\n6150_3_4,1,GEOMETRYCOLLECTION EMPTY\n\n$ ipython\nIn [1]: import pandas as pd\nIn [2]: df = pd.read_csv(\"my_answer.csv.gz\")\nIn [3]: df[(df.ImageId == '6150_3_4') &amp; (df.ClassType == 1)]\nOut[3]:\n       ImageId  ClassType           MultipolygonWKT\n1004  6150_3_4          1  GEOMETRYCOLLECTION EMPTY\n</code></pre>\n\n<p>(Note that I got same error when I add a MULTIPOLYGON for image 6150_3_4, class 1.)</p>\n\n<p>I have completely no idea on how to resolve this issue. Could anybody help me to solve this problem? Is the evaluation system still alive?</p>",
  "messages": [
    {
      "id": "158220",
      "postDate": "01/26/2017 10:18:35",
      "content": "<p>Hi,</p>\n\n<p>I got a \"KeyNotFoundException\" exception with following message:</p>\n\n<blockquote>\n  <p>Evaluation Exception: For image 6150_3_4, class 1, there's an\n  exception in geometry System.Collections.Generic.KeyNotFoundException:\n  The given key was not present in the dictionary. at\n  System.Collections.Generic.Dictionary<code>2.get_Item(TKey key) at\n  Kaggle.Metrics.Custom.JaccardDSTL.calculateIoUVector(Dictionary</code>2\n  submission, Dictionary`2 solution)..</p>\n</blockquote>\n\n<p>It seems there are invalid polygons for image 6150_3_4, class 1, but the solution for image 6150_3_4, class 1 is \"GEOMETRYCOLLECTION EMPTY\".</p>\n\n<pre><code>$ zcat my_answer.csv.gz | grep \"6150_3_4,1,\"\n6150_3_4,1,GEOMETRYCOLLECTION EMPTY\n\n$ ipython\nIn [1]: import pandas as pd\nIn [2]: df = pd.read_csv(\"my_answer.csv.gz\")\nIn [3]: df[(df.ImageId == '6150_3_4') &amp; (df.ClassType == 1)]\nOut[3]:\n       ImageId  ClassType           MultipolygonWKT\n1004  6150_3_4          1  GEOMETRYCOLLECTION EMPTY\n</code></pre>\n\n<p>(Note that I got same error when I add a MULTIPOLYGON for image 6150_3_4, class 1.)</p>\n\n<p>I have completely no idea on how to resolve this issue. Could anybody help me to solve this problem? Is the evaluation system still alive?</p>",
      "rawMarkdown": "Hi,\r\n\r\nI got a \"KeyNotFoundException\" exception with following message:\r\n\r\n> Evaluation Exception: For image 6150_3_4, class 1, there's an\r\n> exception in geometry System.Collections.Generic.KeyNotFoundException:\r\n> The given key was not present in the dictionary. at\r\n> System.Collections.Generic.Dictionary`2.get_Item(TKey key) at\r\n> Kaggle.Metrics.Custom.JaccardDSTL.calculateIoUVector(Dictionary`2\r\n> submission, Dictionary`2 solution)..\r\n\r\nIt seems there are invalid polygons for image 6150_3_4, class 1, but the solution for image 6150_3_4, class 1 is \"GEOMETRYCOLLECTION EMPTY\".\r\n\r\n    $ zcat my_answer.csv.gz | grep \"6150_3_4,1,\"\r\n    6150_3_4,1,GEOMETRYCOLLECTION EMPTY\r\n    \r\n    $ ipython\r\n    In [1]: import pandas as pd\r\n    In [2]: df = pd.read_csv(\"my_answer.csv.gz\")\r\n    In [3]: df[(df.ImageId == '6150_3_4') & (df.ClassType == 1)]\r\n    Out[3]:\r\n           ImageId  ClassType           MultipolygonWKT\r\n    1004  6150_3_4          1  GEOMETRYCOLLECTION EMPTY\r\n\r\n(Note that I got same error when I add a MULTIPOLYGON for image 6150_3_4, class 1.)\r\n\r\nI have completely no idea on how to resolve this issue. Could anybody help me to solve this problem? Is the evaluation system still alive?",
      "votes": null
    },
    {
      "id": "158239",
      "postDate": "01/26/2017 13:20:18",
      "content": "<p>I have the exact same error for the same image and class....\nSounds to me that the bug is on kaggle side :-/</p>",
      "rawMarkdown": "I have the exact same error for the same image and class....\r\nSounds to me that the bug is on kaggle side :-/",
      "votes": null
    },
    {
      "id": "158242",
      "postDate": "01/26/2017 13:34:09",
      "content": "<p>Try using <strong>MULTIPOLYGON EMPTY</strong>.</p>",
      "rawMarkdown": "Try using **MULTIPOLYGON EMPTY**.",
      "votes": null
    },
    {
      "id": "158247",
      "postDate": "01/26/2017 14:04:19",
      "content": "<p>Thank you for the comment. <strong>MULTIPOLYGON EMPTY</strong> doesn't help. I get the same error.</p>",
      "rawMarkdown": "Thank you for the comment. **MULTIPOLYGON EMPTY** doesn't help. I get the same error.",
      "votes": null
    },
    {
      "id": "158248",
      "postDate": "01/26/2017 14:14:24",
      "content": "<p>I tried:\n6150_3_4,1,\"MULTIPOLYGON EMPTY\"\nbut it doesn't work any better</p>",
      "rawMarkdown": "I tried:\r\n6150_3_4,1,\"MULTIPOLYGON EMPTY\"\r\nbut it doesn't work any better",
      "votes": null
    },
    {
      "id": "158249",
      "postDate": "01/26/2017 14:22:55",
      "content": "<p>What if you try without quotes?</p>",
      "rawMarkdown": "What if you try without quotes?",
      "votes": null
    },
    {
      "id": "158251",
      "postDate": "01/26/2017 14:40:17",
      "content": "<p>I haven't tried for this empty one, but for the others, if you don't put quotes, it complains that they are too many comas on the line.</p>\n\n<p>Did anybody succeed submitting empty polygons?</p>",
      "rawMarkdown": "I haven't tried for this empty one, but for the others, if you don't put quotes, it complains that they are too many comas on the line.\r\n\r\nDid anybody succeed submitting empty polygons?",
      "votes": null
    },
    {
      "id": "158252",
      "postDate": "01/26/2017 14:41:04",
      "content": "<p>At least \"6040_2_2,3,MULTIPOLYGON EMPTY\" once worked to me.</p>\n\n<p>Shooting in the dark, but if you have a huge file size, it can cause anything. </p>",
      "rawMarkdown": "At least \"6040_2_2,3,MULTIPOLYGON EMPTY\" once worked to me.\r\n\r\nShooting in the dark, but if you have a huge file size, it can cause anything.",
      "votes": null
    },
    {
      "id": "158256",
      "postDate": "01/26/2017 14:52:03",
      "content": "<p>My file unzip is about 500MB.\nIs that too much?</p>",
      "rawMarkdown": "My file unzip is about 500MB.\r\nIs that too much?",
      "votes": null
    },
    {
      "id": "158261",
      "postDate": "01/26/2017 15:04:54",
      "content": "<p>Doesn't seem so. My 600MB submission was accepted before. </p>",
      "rawMarkdown": "Doesn't seem so. My 600MB submission was accepted before.",
      "votes": null
    },
    {
      "id": "158262",
      "postDate": "01/26/2017 15:07:10",
      "content": "<p>I tried to reduce the size of my file by doing a \"simplify\" over my polygons\nand I tried to replace my faulty line by\n6150_3_4,1,\"POLYGON ((0 0, 0.0091798000258612 0, 0.0091798000258612 -0.009039803075576299, 0 -0.009039803075576299, 0 0))\"</p>\n\n<p>which is a copy paste from the submission example file...\nStill I get the same error... it really seems there is something fishy in the evaluation board code.</p>\n\n<p>But I am running out of idea to find a workaround to this.</p>",
      "rawMarkdown": "I tried to reduce the size of my file by doing a \"simplify\" over my polygons\r\nand I tried to replace my faulty line by\r\n6150_3_4,1,\"POLYGON ((0 0, 0.0091798000258612 0, 0.0091798000258612 -0.009039803075576299, 0 -0.009039803075576299, 0 0))\"\r\n\r\nwhich is a copy paste from the submission example file...\r\nStill I get the same error... it really seems there is something fishy in the evaluation board code.\r\n\r\nBut I am running out of idea to find a workaround to this.",
      "votes": null
    },
    {
      "id": "158270",
      "postDate": "01/26/2017 15:30:24",
      "content": "<p>KeyNotFoundException probably means that the order of files and polygon types does not match the order in sample_submission: <a href=\"https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424\">https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424</a></p>",
      "rawMarkdown": "KeyNotFoundException probably means that the order of files and polygon types does not match the order in sample_submission: https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424",
      "votes": null
    },
    {
      "id": "158275",
      "postDate": "01/26/2017 15:54:21",
      "content": "<p>thanks Konstantin, it's what I've just found out by digging the forum  :-)\nIt's really ridiculous that this thing is ordered dependent.\nBut at least, now that I know the cause, I can reorder and move on</p>",
      "rawMarkdown": "thanks Konstantin, it's what I've just found out by digging the forum  :-)\r\nIt's really ridiculous that this thing is ordered dependent.\r\nBut at least, now that I know the cause, I can reorder and move on",
      "votes": null
    },
    {
      "id": "158276",
      "postDate": "01/26/2017 15:58:38",
      "content": "<p>Thanks Konstantin! It helps me to resolve the issue. Also, I've just found it is described on the evaluation page :-0</p>\n\n<blockquote>\n  <p>Please submit all the rows in exactly the same order as\n  sample_submission.csv, otherwise you might get a \"key not found\n  error\".\n   (<a href=\"https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation\">https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation</a>)</p>\n</blockquote>",
      "rawMarkdown": "Thanks Konstantin! It helps me to resolve the issue. Also, I've just found it is described on the evaluation page :-0\r\n\r\n> Please submit all the rows in exactly the same order as\r\n> sample_submission.csv, otherwise you might get a \"key not found\r\n> error\".\r\n (https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation)",
      "votes": null
    },
    {
      "id": "159171",
      "postDate": "02/01/2017 05:29:12",
      "content": "<p>I have been fighting this for 2 days. I hope this fixes the problem, but it is absurd that order of rows matter.</p>",
      "rawMarkdown": "I have been fighting this for 2 days. I hope this fixes the problem, but it is absurd that order of rows matter.",
      "votes": null
    },
    {
      "id": "159945",
      "postDate": "02/04/2017 23:40:36",
      "content": "<p>By the way changing the row order did fix the  \"key not found error\" problem. Then I... Submitted... waited ... waited... waited... Timeout error.  The next problem I faced was the file was too big(true it was over a gig), the solution was to simplify the polygons... Submitted... waited ... waited... waited... then all of the sudden done.. it worked, and the results are pretty good for a first submission. </p>\n\n<p>So, I guess what I can say is that so far I have had some real submission file issues, but now it is working, so for those still struggling do not give up hope. There is a working solution out there.</p>",
      "rawMarkdown": "By the way changing the row order did fix the  \"key not found error\" problem. Then I... Submitted... waited ... waited... waited... Timeout error.  The next problem I faced was the file was too big(true it was over a gig), the solution was to simplify the polygons... Submitted... waited ... waited... waited... then all of the sudden done.. it worked, and the results are pretty good for a first submission. \n\nSo, I guess what I can say is that so far I have had some real submission file issues, but now it is working, so for those still struggling do not give up hope. There is a working solution out there.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 158239,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 13:20:18",
      "content": "<p>I have the exact same error for the same image and class....\nSounds to me that the bug is on kaggle side :-/</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158242,
      "author_name": "aamaia",
      "author_url": "",
      "post_date": "01/26/2017 13:34:09",
      "content": "<p>Try using <strong>MULTIPOLYGON EMPTY</strong>.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158247,
      "author_name": "confirm",
      "author_url": "",
      "post_date": "01/26/2017 14:04:19",
      "content": "<p>Thank you for the comment. <strong>MULTIPOLYGON EMPTY</strong> doesn't help. I get the same error.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158248,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 14:14:24",
      "content": "<p>I tried:\n6150_3_4,1,\"MULTIPOLYGON EMPTY\"\nbut it doesn't work any better</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158249,
      "author_name": "aamaia",
      "author_url": "",
      "post_date": "01/26/2017 14:22:55",
      "content": "<p>What if you try without quotes?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158251,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 14:40:17",
      "content": "<p>I haven't tried for this empty one, but for the others, if you don't put quotes, it complains that they are too many comas on the line.</p>\n\n<p>Did anybody succeed submitting empty polygons?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158252,
      "author_name": "ckomaki",
      "author_url": "",
      "post_date": "01/26/2017 14:41:04",
      "content": "<p>At least \"6040_2_2,3,MULTIPOLYGON EMPTY\" once worked to me.</p>\n\n<p>Shooting in the dark, but if you have a huge file size, it can cause anything. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158256,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 14:52:03",
      "content": "<p>My file unzip is about 500MB.\nIs that too much?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158261,
      "author_name": "ckomaki",
      "author_url": "",
      "post_date": "01/26/2017 15:04:54",
      "content": "<p>Doesn't seem so. My 600MB submission was accepted before. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158262,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 15:07:10",
      "content": "<p>I tried to reduce the size of my file by doing a \"simplify\" over my polygons\nand I tried to replace my faulty line by\n6150_3_4,1,\"POLYGON ((0 0, 0.0091798000258612 0, 0.0091798000258612 -0.009039803075576299, 0 -0.009039803075576299, 0 0))\"</p>\n\n<p>which is a copy paste from the submission example file...\nStill I get the same error... it really seems there is something fishy in the evaluation board code.</p>\n\n<p>But I am running out of idea to find a workaround to this.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158270,
      "author_name": "lopuhin",
      "author_url": "",
      "post_date": "01/26/2017 15:30:24",
      "content": "<p>KeyNotFoundException probably means that the order of files and polygon types does not match the order in sample_submission: <a href=\"https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424\">https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158275,
      "author_name": "loicus",
      "author_url": "",
      "post_date": "01/26/2017 15:54:21",
      "content": "<p>thanks Konstantin, it's what I've just found out by digging the forum  :-)\nIt's really ridiculous that this thing is ordered dependent.\nBut at least, now that I know the cause, I can reorder and move on</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 158276,
      "author_name": "confirm",
      "author_url": "",
      "post_date": "01/26/2017 15:58:38",
      "content": "<p>Thanks Konstantin! It helps me to resolve the issue. Also, I've just found it is described on the evaluation page :-0</p>\n\n<blockquote>\n  <p>Please submit all the rows in exactly the same order as\n  sample_submission.csv, otherwise you might get a \"key not found\n  error\".\n   (<a href=\"https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation\">https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation</a>)</p>\n</blockquote>",
      "votes": null,
      "replies": []
    },
    {
      "id": 159171,
      "author_name": "joexjmmvhm",
      "author_url": "",
      "post_date": "02/01/2017 05:29:12",
      "content": "<p>I have been fighting this for 2 days. I hope this fixes the problem, but it is absurd that order of rows matter.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 159945,
      "author_name": "joexjmmvhm",
      "author_url": "",
      "post_date": "02/04/2017 23:40:36",
      "content": "<p>By the way changing the row order did fix the  \"key not found error\" problem. Then I... Submitted... waited ... waited... waited... Timeout error.  The next problem I faced was the file was too big(true it was over a gig), the solution was to simplify the polygons... Submitted... waited ... waited... waited... then all of the sudden done.. it worked, and the results are pretty good for a first submission. </p>\n\n<p>So, I guess what I can say is that so far I have had some real submission file issues, but now it is working, so for those still struggling do not give up hope. There is a working solution out there.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "158220": "Hi,\r\n\r\nI got a \"KeyNotFoundException\" exception with following message:\r\n\r\n> Evaluation Exception: For image 6150_3_4, class 1, there's an\r\n> exception in geometry System.Collections.Generic.KeyNotFoundException:\r\n> The given key was not present in the dictionary. at\r\n> System.Collections.Generic.Dictionary`2.get_Item(TKey key) at\r\n> Kaggle.Metrics.Custom.JaccardDSTL.calculateIoUVector(Dictionary`2\r\n> submission, Dictionary`2 solution)..\r\n\r\nIt seems there are invalid polygons for image 6150_3_4, class 1, but the solution for image 6150_3_4, class 1 is \"GEOMETRYCOLLECTION EMPTY\".\r\n\r\n    $ zcat my_answer.csv.gz | grep \"6150_3_4,1,\"\r\n    6150_3_4,1,GEOMETRYCOLLECTION EMPTY\r\n    \r\n    $ ipython\r\n    In [1]: import pandas as pd\r\n    In [2]: df = pd.read_csv(\"my_answer.csv.gz\")\r\n    In [3]: df[(df.ImageId == '6150_3_4') & (df.ClassType == 1)]\r\n    Out[3]:\r\n           ImageId  ClassType           MultipolygonWKT\r\n    1004  6150_3_4          1  GEOMETRYCOLLECTION EMPTY\r\n\r\n(Note that I got same error when I add a MULTIPOLYGON for image 6150_3_4, class 1.)\r\n\r\nI have completely no idea on how to resolve this issue. Could anybody help me to solve this problem? Is the evaluation system still alive?",
    "158239": "I have the exact same error for the same image and class....\r\nSounds to me that the bug is on kaggle side :-/",
    "158242": "Try using **MULTIPOLYGON EMPTY**.",
    "158247": "Thank you for the comment. **MULTIPOLYGON EMPTY** doesn't help. I get the same error.",
    "158248": "I tried:\r\n6150_3_4,1,\"MULTIPOLYGON EMPTY\"\r\nbut it doesn't work any better",
    "158249": "What if you try without quotes?",
    "158251": "I haven't tried for this empty one, but for the others, if you don't put quotes, it complains that they are too many comas on the line.\r\n\r\nDid anybody succeed submitting empty polygons?",
    "158252": "At least \"6040_2_2,3,MULTIPOLYGON EMPTY\" once worked to me.\r\n\r\nShooting in the dark, but if you have a huge file size, it can cause anything.",
    "158256": "My file unzip is about 500MB.\r\nIs that too much?",
    "158261": "Doesn't seem so. My 600MB submission was accepted before.",
    "158262": "I tried to reduce the size of my file by doing a \"simplify\" over my polygons\r\nand I tried to replace my faulty line by\r\n6150_3_4,1,\"POLYGON ((0 0, 0.0091798000258612 0, 0.0091798000258612 -0.009039803075576299, 0 -0.009039803075576299, 0 0))\"\r\n\r\nwhich is a copy paste from the submission example file...\r\nStill I get the same error... it really seems there is something fishy in the evaluation board code.\r\n\r\nBut I am running out of idea to find a workaround to this.",
    "158270": "KeyNotFoundException probably means that the order of files and polygon types does not match the order in sample_submission: https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/forums/t/26661/submission-errors?forumMessageId=151424#post151424",
    "158275": "thanks Konstantin, it's what I've just found out by digging the forum  :-)\r\nIt's really ridiculous that this thing is ordered dependent.\r\nBut at least, now that I know the cause, I can reorder and move on",
    "158276": "Thanks Konstantin! It helps me to resolve the issue. Also, I've just found it is described on the evaluation page :-0\r\n\r\n> Please submit all the rows in exactly the same order as\r\n> sample_submission.csv, otherwise you might get a \"key not found\r\n> error\".\r\n (https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/details/evaluation)",
    "159171": "I have been fighting this for 2 days. I hope this fixes the problem, but it is absurd that order of rows matter.",
    "159945": "By the way changing the row order did fix the  \"key not found error\" problem. Then I... Submitted... waited ... waited... waited... Timeout error.  The next problem I faced was the file was too big(true it was over a gig), the solution was to simplify the polygons... Submitted... waited ... waited... waited... then all of the sudden done.. it worked, and the results are pretty good for a first submission. \n\nSo, I guess what I can say is that so far I have had some real submission file issues, but now it is working, so for those still struggling do not give up hope. There is a working solution out there."
  },
  "source": "meta"
}