{
  "id": 290675,
  "title": "Bounding box exceeding image height",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/290675",
  "author_name": "",
  "post_date": "2021-11-25T18:03:53.209573200Z",
  "votes": 39,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hello everyone.</p>\n<p>After spending some hours not understanding why my code was not working, I finally managed to understand the cause.<br>\nThere is one image (video_id=0, video_frame=8235) which seems to have a bounding box exceeding the image heigth.<br>\nSpecifically, the second bounding box:<br>\n{'x': 894, 'y': 694, 'width': 28, 'height': 33}<br>\nhas y=694 and height=33, which give 727, and that exceeds the image height of 720.<br>\nThere might be more images like that.</p>\n<p>I'm saying this with the hope that someone else don't waste hours :)</p>",
  "messages": [
    {
      "id": "1595478",
      "postDate": "11/25/2021 18:03:53",
      "content": "<p>Hello everyone.</p>\n<p>After spending some hours not understanding why my code was not working, I finally managed to understand the cause.<br>\nThere is one image (video_id=0, video_frame=8235) which seems to have a bounding box exceeding the image heigth.<br>\nSpecifically, the second bounding box:<br>\n{'x': 894, 'y': 694, 'width': 28, 'height': 33}<br>\nhas y=694 and height=33, which give 727, and that exceeds the image height of 720.<br>\nThere might be more images like that.</p>\n<p>I'm saying this with the hope that someone else don't waste hours :)</p>",
      "rawMarkdown": "Hello everyone.\n\nAfter spending some hours not understanding why my code was not working, I finally managed to understand the cause.\nThere is one image (video_id=0, video_frame=8235) which seems to have a bounding box exceeding the image heigth.\nSpecifically, the second bounding box:\n{'x': 894, 'y': 694, 'width': 28, 'height': 33}\nhas y=694 and height=33, which give 727, and that exceeds the image height of 720.\nThere might be more images like that.\n\nI'm saying this with the hope that someone else don't waste hours :)",
      "votes": null
    },
    {
      "id": "1595500",
      "postDate": "11/25/2021 18:27:11",
      "content": "<pre><code>video_0/8234.jpg - clip bbox ymax from 721 to image height 720 \nvideo_0/8235.jpg - clip bbox ymax from 727 to image height 720 \nvideo_0/9470.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/490.jpg  - clip bbox ymax from 734 to image height 720 \nvideo_1/4157.jpg - clip bbox xmax from 1292 to image width 1280\nvideo_1/4186.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5307.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5498.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5515.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/6273.jpg - clip bbox ymax from 742 to image height 720 \nvideo_1/8864.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/8865.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/9105.jpg - clip bbox ymax from 729 to image height 720 \nvideo_1/9286.jpg - clip bbox ymax from 727 to image height 720 \nvideo_1/9287.jpg - clip bbox ymax from 725 to image height 720 \nvideo_1/9288.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/9289.jpg - clip bbox ymax from 722 to image height 720 \nvideo_1/9379.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5780.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5786.jpg - clip bbox ymax from 725 to image height 720 \n</code></pre>",
      "rawMarkdown": "```\nvideo_0/8234.jpg - clip bbox ymax from 721 to image height 720 \nvideo_0/8235.jpg - clip bbox ymax from 727 to image height 720 \nvideo_0/9470.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/490.jpg  - clip bbox ymax from 734 to image height 720 \nvideo_1/4157.jpg - clip bbox xmax from 1292 to image width 1280\nvideo_1/4186.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5307.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5498.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5515.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/6273.jpg - clip bbox ymax from 742 to image height 720 \nvideo_1/8864.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/8865.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/9105.jpg - clip bbox ymax from 729 to image height 720 \nvideo_1/9286.jpg - clip bbox ymax from 727 to image height 720 \nvideo_1/9287.jpg - clip bbox ymax from 725 to image height 720 \nvideo_1/9288.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/9289.jpg - clip bbox ymax from 722 to image height 720 \nvideo_1/9379.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5780.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5786.jpg - clip bbox ymax from 725 to image height 720 \n```",
      "votes": null
    },
    {
      "id": "1597415",
      "postDate": "11/27/2021 13:45:26",
      "content": "<p>yeah we have to do clipping :)</p>",
      "rawMarkdown": "yeah we have to do clipping :)",
      "votes": null
    },
    {
      "id": "1597796",
      "postDate": "11/27/2021 22:48:54",
      "content": "<p>The same for me.<br>\nI solved the issue by fixing <code>albumentation</code> library according to <a href=\"https://github.com/albumentations-team/albumentations/issues/459#issuecomment-734454278\" target=\"_blank\">this github issue</a></p>\n<p>This is the snipet from the above site. I hope it will help someone.</p>\n<pre><code>def check_bbox(bbox):\n    \"\"\"Check if bbox boundaries are in range 0, 1 and minimums are lesser then maximums\"\"\"\n   #my added block \n    bbox=list(bbox)\n    for i in range(4):\n      if (bbox[i]&lt;0) :\n        bbox[i]=0\n      elif (bbox[i]&gt;1) :\n        bbox[i]=1\n    bbox=tuple(bbox)\n   #end of block\n   #rest of the code as it is\n</code></pre>",
      "rawMarkdown": "The same for me.\nI solved the issue by fixing `albumentation` library according to [this github issue](https://github.com/albumentations-team/albumentations/issues/459#issuecomment-734454278)\n\nThis is the snipet from the above site. I hope it will help someone.\n```\ndef check_bbox(bbox):\n    \"\"\"Check if bbox boundaries are in range 0, 1 and minimums are lesser then maximums\"\"\"\n   #my added block \n    bbox=list(bbox)\n    for i in range(4):\n      if (bbox[i]<0) :\n        bbox[i]=0\n      elif (bbox[i]>1) :\n        bbox[i]=1\n    bbox=tuple(bbox)\n   #end of block\n   #rest of the code as it is\n```",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1595500,
      "author_name": "drhabib",
      "author_url": "",
      "post_date": "11/25/2021 18:27:11",
      "content": "<pre><code>video_0/8234.jpg - clip bbox ymax from 721 to image height 720 \nvideo_0/8235.jpg - clip bbox ymax from 727 to image height 720 \nvideo_0/9470.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/490.jpg  - clip bbox ymax from 734 to image height 720 \nvideo_1/4157.jpg - clip bbox xmax from 1292 to image width 1280\nvideo_1/4186.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5307.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5498.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5515.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/6273.jpg - clip bbox ymax from 742 to image height 720 \nvideo_1/8864.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/8865.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/9105.jpg - clip bbox ymax from 729 to image height 720 \nvideo_1/9286.jpg - clip bbox ymax from 727 to image height 720 \nvideo_1/9287.jpg - clip bbox ymax from 725 to image height 720 \nvideo_1/9288.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/9289.jpg - clip bbox ymax from 722 to image height 720 \nvideo_1/9379.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5780.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5786.jpg - clip bbox ymax from 725 to image height 720 \n</code></pre>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1597415,
      "author_name": "lukaszborecki",
      "author_url": "",
      "post_date": "11/27/2021 13:45:26",
      "content": "<p>yeah we have to do clipping :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1597796,
      "author_name": "osamurai",
      "author_url": "",
      "post_date": "11/27/2021 22:48:54",
      "content": "<p>The same for me.<br>\nI solved the issue by fixing <code>albumentation</code> library according to <a href=\"https://github.com/albumentations-team/albumentations/issues/459#issuecomment-734454278\" target=\"_blank\">this github issue</a></p>\n<p>This is the snipet from the above site. I hope it will help someone.</p>\n<pre><code>def check_bbox(bbox):\n    \"\"\"Check if bbox boundaries are in range 0, 1 and minimums are lesser then maximums\"\"\"\n   #my added block \n    bbox=list(bbox)\n    for i in range(4):\n      if (bbox[i]&lt;0) :\n        bbox[i]=0\n      elif (bbox[i]&gt;1) :\n        bbox[i]=1\n    bbox=tuple(bbox)\n   #end of block\n   #rest of the code as it is\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1595478": "Hello everyone.\n\nAfter spending some hours not understanding why my code was not working, I finally managed to understand the cause.\nThere is one image (video_id=0, video_frame=8235) which seems to have a bounding box exceeding the image heigth.\nSpecifically, the second bounding box:\n{'x': 894, 'y': 694, 'width': 28, 'height': 33}\nhas y=694 and height=33, which give 727, and that exceeds the image height of 720.\nThere might be more images like that.\n\nI'm saying this with the hope that someone else don't waste hours :)",
    "1595500": "```\nvideo_0/8234.jpg - clip bbox ymax from 721 to image height 720 \nvideo_0/8235.jpg - clip bbox ymax from 727 to image height 720 \nvideo_0/9470.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/490.jpg  - clip bbox ymax from 734 to image height 720 \nvideo_1/4157.jpg - clip bbox xmax from 1292 to image width 1280\nvideo_1/4186.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5307.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5498.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/5515.jpg - clip bbox ymax from 721 to image height 720 \nvideo_1/6273.jpg - clip bbox ymax from 742 to image height 720 \nvideo_1/8864.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/8865.jpg - clip bbox ymax from 739 to image height 720 \nvideo_1/9105.jpg - clip bbox ymax from 729 to image height 720 \nvideo_1/9286.jpg - clip bbox ymax from 727 to image height 720 \nvideo_1/9287.jpg - clip bbox ymax from 725 to image height 720 \nvideo_1/9288.jpg - clip bbox ymax from 723 to image height 720 \nvideo_1/9289.jpg - clip bbox ymax from 722 to image height 720 \nvideo_1/9379.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5780.jpg - clip bbox ymax from 721 to image height 720 \nvideo_2/5786.jpg - clip bbox ymax from 725 to image height 720 \n```",
    "1597415": "yeah we have to do clipping :)",
    "1597796": "The same for me.\nI solved the issue by fixing `albumentation` library according to [this github issue](https://github.com/albumentations-team/albumentations/issues/459#issuecomment-734454278)\n\nThis is the snipet from the above site. I hope it will help someone.\n```\ndef check_bbox(bbox):\n    \"\"\"Check if bbox boundaries are in range 0, 1 and minimums are lesser then maximums\"\"\"\n   #my added block \n    bbox=list(bbox)\n    for i in range(4):\n      if (bbox[i]<0) :\n        bbox[i]=0\n      elif (bbox[i]>1) :\n        bbox[i]=1\n    bbox=tuple(bbox)\n   #end of block\n   #rest of the code as it is\n```"
  },
  "source": "meta"
}