{
  "id": 152423,
  "title": "Using negative samples in FasterRCNN",
  "url": "/competitions/global-wheat-detection/discussion/152423",
  "author_name": "Sergey Zlobin",
  "post_date": "2020-05-19T19:28:22.405000",
  "votes": 12,
  "comment_count": 2,
  "views": 0,
  "content": "<p>In torchvision 0.6 (along with pytorch 1.5.0) it is possible to use negative samples, i.e. images without boxes.</p>\n\n<p><a href=\"https://github.com/pytorch/vision/releases\">https://github.com/pytorch/vision/releases</a></p>\n\n<p>For those images, the annotations expect a tensor with 0 in the number of objects dimension, as follows:</p>\n\n<p><code>\ntarget = {\"boxes\": torch.zeros((0, 4), dtype=torch.float32),\n          \"labels\": torch.zeros(0, dtype=torch.int64),\n          \"image_id\": 4,\n          \"area\": torch.zeros(0, dtype=torch.float32),\n          \"iscrowd\": torch.zeros((0,), dtype=torch.int64)}\n</code></p>\n\n<p>It seems this gives a modest effect in this problem, but it is good to know you use all train images. :)</p>",
  "messages": [
    {
      "id": 854128,
      "postDate": "2020-05-19T19:28:22.407Z",
      "content": "<p>In torchvision 0.6 (along with pytorch 1.5.0) it is possible to use negative samples, i.e. images without boxes.</p>\n\n<p><a href=\"https://github.com/pytorch/vision/releases\">https://github.com/pytorch/vision/releases</a></p>\n\n<p>For those images, the annotations expect a tensor with 0 in the number of objects dimension, as follows:</p>\n\n<p><code>\ntarget = {\"boxes\": torch.zeros((0, 4), dtype=torch.float32),\n          \"labels\": torch.zeros(0, dtype=torch.int64),\n          \"image_id\": 4,\n          \"area\": torch.zeros(0, dtype=torch.float32),\n          \"iscrowd\": torch.zeros((0,), dtype=torch.int64)}\n</code></p>\n\n<p>It seems this gives a modest effect in this problem, but it is good to know you use all train images. :)</p>",
      "rawMarkdown": "In torchvision 0.6 (along with pytorch 1.5.0) it is possible to use negative samples, i.e. images without boxes.\n\n[https://github.com/pytorch/vision/releases](https://github.com/pytorch/vision/releases)\n\nFor those images, the annotations expect a tensor with 0 in the number of objects dimension, as follows:\n\n```\ntarget = {\"boxes\": torch.zeros((0, 4), dtype=torch.float32),\n          \"labels\": torch.zeros(0, dtype=torch.int64),\n          \"image_id\": 4,\n          \"area\": torch.zeros(0, dtype=torch.float32),\n          \"iscrowd\": torch.zeros((0,), dtype=torch.int64)}\n```\n\nIt seems this gives a modest effect in this problem, but it is good to know you use all train images. :)",
      "votes": 12
    },
    {
      "id": 854134,
      "postDate": "2020-05-19T19:31:51.947Z",
      "content": "<p>Ahh, thank you for this explanation. My approach was slightly different which led to errors</p>",
      "rawMarkdown": "Ahh, thank you for this explanation. My approach was slightly different which led to errors"
    },
    {
      "id": 910582,
      "postDate": "2020-07-01T08:22:12.993Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 854134,
      "author_name": "Matt",
      "author_url": "",
      "post_date": "2020-05-19T19:31:51.947000",
      "content": "<p>Ahh, thank you for this explanation. My approach was slightly different which led to errors</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 910582,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-07-01T08:22:12.993000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "854128": "In torchvision 0.6 (along with pytorch 1.5.0) it is possible to use negative samples, i.e. images without boxes.\n\n[https://github.com/pytorch/vision/releases](https://github.com/pytorch/vision/releases)\n\nFor those images, the annotations expect a tensor with 0 in the number of objects dimension, as follows:\n\n```\ntarget = {\"boxes\": torch.zeros((0, 4), dtype=torch.float32),\n          \"labels\": torch.zeros(0, dtype=torch.int64),\n          \"image_id\": 4,\n          \"area\": torch.zeros(0, dtype=torch.float32),\n          \"iscrowd\": torch.zeros((0,), dtype=torch.int64)}\n```\n\nIt seems this gives a modest effect in this problem, but it is good to know you use all train images. :)",
    "854134": "Ahh, thank you for this explanation. My approach was slightly different which led to errors",
    "910582": ""
  }
}