{
  "id": 152595,
  "title": "Please Help me,Got a astonishing error",
  "url": "/competitions/global-wheat-detection/discussion/152595",
  "author_name": "",
  "post_date": "2020-05-20T16:06:54.079488300Z",
  "votes": null,
  "comment_count": 7,
  "views": 0,
  "content": "<p>While I trained for six epochs there was no error but on seventh epoch I got this error--</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F4155898%2F4895d0034d5cb8eab19b2c542a4bcb5f%2FWhatsApp%20Image%202020-05-20%20at%206.18.10%20PM.jpeg?generation=1589990796222278&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": "855126",
      "postDate": "05/20/2020 16:06:54",
      "content": "<p>While I trained for six epochs there was no error but on seventh epoch I got this error--</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F4155898%2F4895d0034d5cb8eab19b2c542a4bcb5f%2FWhatsApp%20Image%202020-05-20%20at%206.18.10%20PM.jpeg?generation=1589990796222278&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "While I trained for six epochs there was no error but on seventh epoch I got this error--\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F4155898%2F4895d0034d5cb8eab19b2c542a4bcb5f%2FWhatsApp%20Image%202020-05-20%20at%206.18.10%20PM.jpeg?generation=1589990796222278&amp;alt=media)",
      "votes": null
    },
    {
      "id": "855154",
      "postDate": "05/20/2020 16:30:51",
      "content": "<p>Instead of that long <code>target['boxes] = torch.stack....</code> line you can do this:</p>\n\n<p><code>\n            if len(sample['bboxes']) &gt; 0:\n                target['boxes'] = torch.tensor(sample['bboxes'], dtype=torch.float32)\n            else:\n                target['boxes'] = torch.zeros((0, 4))\n</code></p>",
      "rawMarkdown": "Instead of that long `target['boxes] = torch.stack....` line you can do this:\n\n```\n            if len(sample['bboxes']) &gt; 0:\n                target['boxes'] = torch.tensor(sample['bboxes'], dtype=torch.float32)\n            else:\n                target['boxes'] = torch.zeros((0, 4))\n```",
      "votes": null
    },
    {
      "id": "855529",
      "postDate": "05/21/2020 02:40:31",
      "content": "<p>Sir I have used ur notebook for reference ,I am wondering why this error came to me only..\nWhat exactly is happening??</p>",
      "rawMarkdown": "Sir I have used ur notebook for reference ,I am wondering why this error came to me only..\nWhat exactly is happening??",
      "votes": null
    },
    {
      "id": "855535",
      "postDate": "05/21/2020 02:43:34",
      "content": "<p>What's happening is after augmentations are applied to the image and boxes in the dataloader, it resulted in no boxes being within the frame. Perhaps due to a crop or filtering of those boxes. If it happens once every ~6 epochs, I wouldn't worry about it, the negative samples may actually improve your model.</p>",
      "rawMarkdown": "What's happening is after augmentations are applied to the image and boxes in the dataloader, it resulted in no boxes being within the frame. Perhaps due to a crop or filtering of those boxes. If it happens once every ~6 epochs, I wouldn't worry about it, the negative samples may actually improve your model.",
      "votes": null
    },
    {
      "id": "855540",
      "postDate": "05/21/2020 02:50:31",
      "content": "<p>I haven't used any crop albumentation,just simple flip and RandomBrightness</p>",
      "rawMarkdown": "I haven't used any crop albumentation,just simple flip and RandomBrightness",
      "votes": null
    },
    {
      "id": "855596",
      "postDate": "05/21/2020 03:56:24",
      "content": "<p>Can anyone explain me why to replace with torch.zeros((0,4))</p>",
      "rawMarkdown": "Can anyone explain me why to replace with torch.zeros((0,4))",
      "votes": null
    },
    {
      "id": "855693",
      "postDate": "05/21/2020 05:49:05",
      "content": "<p>I don't know why you would get this error other than no bounding boxes are present. The issue is that torch.stack expects a tensorlist of bounding boxes but the list is empty. Replacing with torch.zeros works because it avoids running \"line 53\" and sets the variable to the expected input for when no boxes are present.</p>",
      "rawMarkdown": "I don't know why you would get this error other than no bounding boxes are present. The issue is that torch.stack expects a tensorlist of bounding boxes but the list is empty. Replacing with torch.zeros works because it avoids running \"line 53\" and sets the variable to the expected input for when no boxes are present.",
      "votes": null
    },
    {
      "id": "855738",
      "postDate": "05/21/2020 06:51:40",
      "content": "<p>Thanks a lot !!A lot of new stuffs I learnt today.</p>",
      "rawMarkdown": "Thanks a lot !!A lot of new stuffs I learnt today.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 855154,
      "author_name": "pestipeti",
      "author_url": "",
      "post_date": "05/20/2020 16:30:51",
      "content": "<p>Instead of that long <code>target['boxes] = torch.stack....</code> line you can do this:</p>\n\n<p><code>\n            if len(sample['bboxes']) &gt; 0:\n                target['boxes'] = torch.tensor(sample['bboxes'], dtype=torch.float32)\n            else:\n                target['boxes'] = torch.zeros((0, 4))\n</code></p>",
      "votes": null,
      "replies": [
        {
          "id": 855529,
          "author_name": "",
          "author_url": "",
          "post_date": "05/21/2020 02:40:31",
          "content": "<p>Sir I have used ur notebook for reference ,I am wondering why this error came to me only..\nWhat exactly is happening??</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 855535,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/21/2020 02:43:34",
          "content": "<p>What's happening is after augmentations are applied to the image and boxes in the dataloader, it resulted in no boxes being within the frame. Perhaps due to a crop or filtering of those boxes. If it happens once every ~6 epochs, I wouldn't worry about it, the negative samples may actually improve your model.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 855540,
          "author_name": "",
          "author_url": "",
          "post_date": "05/21/2020 02:50:31",
          "content": "<p>I haven't used any crop albumentation,just simple flip and RandomBrightness</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 855596,
          "author_name": "",
          "author_url": "",
          "post_date": "05/21/2020 03:56:24",
          "content": "<p>Can anyone explain me why to replace with torch.zeros((0,4))</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 855693,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/21/2020 05:49:05",
          "content": "<p>I don't know why you would get this error other than no bounding boxes are present. The issue is that torch.stack expects a tensorlist of bounding boxes but the list is empty. Replacing with torch.zeros works because it avoids running \"line 53\" and sets the variable to the expected input for when no boxes are present.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 855738,
          "author_name": "",
          "author_url": "",
          "post_date": "05/21/2020 06:51:40",
          "content": "<p>Thanks a lot !!A lot of new stuffs I learnt today.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "855126": "While I trained for six epochs there was no error but on seventh epoch I got this error--\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F4155898%2F4895d0034d5cb8eab19b2c542a4bcb5f%2FWhatsApp%20Image%202020-05-20%20at%206.18.10%20PM.jpeg?generation=1589990796222278&amp;alt=media)",
    "855154": "Instead of that long `target['boxes] = torch.stack....` line you can do this:\n\n```\n            if len(sample['bboxes']) &gt; 0:\n                target['boxes'] = torch.tensor(sample['bboxes'], dtype=torch.float32)\n            else:\n                target['boxes'] = torch.zeros((0, 4))\n```",
    "855529": "Sir I have used ur notebook for reference ,I am wondering why this error came to me only..\nWhat exactly is happening??",
    "855535": "What's happening is after augmentations are applied to the image and boxes in the dataloader, it resulted in no boxes being within the frame. Perhaps due to a crop or filtering of those boxes. If it happens once every ~6 epochs, I wouldn't worry about it, the negative samples may actually improve your model.",
    "855540": "I haven't used any crop albumentation,just simple flip and RandomBrightness",
    "855596": "Can anyone explain me why to replace with torch.zeros((0,4))",
    "855693": "I don't know why you would get this error other than no bounding boxes are present. The issue is that torch.stack expects a tensorlist of bounding boxes but the list is empty. Replacing with torch.zeros works because it avoids running \"line 53\" and sets the variable to the expected input for when no boxes are present.",
    "855738": "Thanks a lot !!A lot of new stuffs I learnt today."
  },
  "source": "meta"
}