{
  "id": 268148,
  "title": "Using Yolo to clean up an image",
  "url": "/competitions/landmark-recognition-2021/discussion/268148",
  "author_name": "",
  "post_date": "2021-08-26T07:44:48.158882300Z",
  "votes": 20,
  "comment_count": 8,
  "views": 0,
  "content": "<p>Some images are heavily \"contaminated\" with foreign objects. For example:<br>\n<img src=\"http://77.232.23.74/scr1.jpg\" alt=\"\"></p>\n<p>You can use YOLO to detect such objects:</p>\n<p>import cv2<br>\nimport torch</p>\n<p>filename = \"ddea66b1102ade98.jpg\"<br>\nimg = cv2.imread(filename)</p>\n<p>model = torch.hub.load('ultralytics/yolov5', 'yolov5x6')  #  P6 model<br>\nresults = model(img, size=640) <br>\nresults.show()             </p>\n<p>and result:<br>\n<img src=\"http://77.232.23.74/scr2.png\" alt=\"\"></p>\n<p>and cut off:<br>\n<img src=\"http://77.232.23.74/scr3.png\" alt=\"\"></p>",
  "messages": [
    {
      "id": "1491169",
      "postDate": "08/26/2021 07:44:48",
      "content": "<p>Some images are heavily \"contaminated\" with foreign objects. For example:<br>\n<img src=\"http://77.232.23.74/scr1.jpg\" alt=\"\"></p>\n<p>You can use YOLO to detect such objects:</p>\n<p>import cv2<br>\nimport torch</p>\n<p>filename = \"ddea66b1102ade98.jpg\"<br>\nimg = cv2.imread(filename)</p>\n<p>model = torch.hub.load('ultralytics/yolov5', 'yolov5x6')  #  P6 model<br>\nresults = model(img, size=640) <br>\nresults.show()             </p>\n<p>and result:<br>\n<img src=\"http://77.232.23.74/scr2.png\" alt=\"\"></p>\n<p>and cut off:<br>\n<img src=\"http://77.232.23.74/scr3.png\" alt=\"\"></p>",
      "rawMarkdown": "Some images are heavily \"contaminated\" with foreign objects. For example:\n![](http://77.232.23.74/scr1.jpg)\n\nYou can use YOLO to detect such objects:\n\nimport cv2\nimport torch\n\nfilename = \"ddea66b1102ade98.jpg\"\nimg = cv2.imread(filename)\n\nmodel = torch.hub.load('ultralytics/yolov5', 'yolov5x6')  #  P6 model\nresults = model(img, size=640) \nresults.show()             \n\nand result:\n![](http://77.232.23.74/scr2.png)\n\nand cut off:\n![](http://77.232.23.74/scr3.png)",
      "votes": null
    },
    {
      "id": "1491830",
      "postDate": "08/26/2021 16:43:23",
      "content": "<p>This is interesting! Thanks</p>",
      "rawMarkdown": "This is interesting! Thanks",
      "votes": null
    },
    {
      "id": "1494335",
      "postDate": "08/28/2021 15:42:24",
      "content": "<p>never thought of it. thanks</p>",
      "rawMarkdown": "never thought of it. thanks",
      "votes": null
    },
    {
      "id": "1495001",
      "postDate": "08/29/2021 08:23:10",
      "content": "<p>Does this approach give any boost on LB?<br>\nSeems a little bit risky. For example: you have a photo of Kremlin with lots of people in front of it. After cutting of redundant objects you can loose needed information to recognise Kremlin<br>\nMaybe there is some workarounds to deal with such issues</p>",
      "rawMarkdown": "Does this approach give any boost on LB?\nSeems a little bit risky. For example: you have a photo of Kremlin with lots of people in front of it. After cutting of redundant objects you can loose needed information to recognise Kremlin\nMaybe there is some workarounds to deal with such issues",
      "votes": null
    },
    {
      "id": "1495025",
      "postDate": "08/29/2021 08:59:24",
      "content": "<p>That's good point. Model will totally fail in it. These context are really important.. I have seen some landmarks if we remove such scene by yolo you left with bad images of no recognised features. Picking one by one will be tedious process. In test dataset, we need e2e model who do it..</p>",
      "rawMarkdown": "That's good point. Model will totally fail in it. These context are really important.. I have seen some landmarks if we remove such scene by yolo you left with bad images of no recognised features. Picking one by one will be tedious process. In test dataset, we need e2e model who do it..",
      "votes": null
    },
    {
      "id": "1495026",
      "postDate": "08/29/2021 09:00:57",
      "content": "<p>Simple term, if human can fail, model will definately fail. But this method is useful in many multi model cases.. <a href=\"https://www.kaggle.com/strij2201\" target=\"_blank\">@strij2201</a> </p>",
      "rawMarkdown": "Simple term, if human can fail, model will definately fail. But this method is useful in many multi model cases.. @strij2201",
      "votes": null
    },
    {
      "id": "1495132",
      "postDate": "08/29/2021 10:19:00",
      "content": "<p>Yes, there is a certain risk. In the near future, I just want to try out the preprocessing images by Yolo + Midas (depth detection).<br>\nBy the way, here is an example of an image that (in my opinion) does not belong to landmarks:<br>\n<img src=\"http://77.232.23.74/59fc4b7c982ad18e.jpg\" alt=\"\"></p>\n<p>Do I need to consider such images as \"outliers\"?</p>",
      "rawMarkdown": "Yes, there is a certain risk. In the near future, I just want to try out the preprocessing images by Yolo + Midas (depth detection).\nBy the way, here is an example of an image that (in my opinion) does not belong to landmarks:\n![](http://77.232.23.74/59fc4b7c982ad18e.jpg)\n\nDo I need to consider such images as \"outliers\"?",
      "votes": null
    },
    {
      "id": "1495137",
      "postDate": "08/29/2021 10:31:38",
      "content": "<p>Yes.. what i do usually is… I keep the way it is used to be.  If data is good, model will be good. Noises should not get space in any domain. </p>",
      "rawMarkdown": "Yes.. what i do usually is... I keep the way it is used to be.  If data is good, model will be good. Noises should not get space in any domain.",
      "votes": null
    },
    {
      "id": "1499581",
      "postDate": "09/01/2021 18:14:29",
      "content": "<blockquote>\n  <p>The Google Landmarks Dataset v2 training set presents a<br>\n  realistic crowdsourced setting with diverse types of images<br>\n  for each landmark: e.g., for a specific museum there may be<br>\n  outdoor images showing the building facade, but also indoor<br>\n  images of paintings and sculptures that are on display. </p>\n</blockquote>\n<p>From the paper published with the landmark dataset. So, I believe those \"outliers\" may still have their correct label.</p>",
      "rawMarkdown": ">The Google Landmarks Dataset v2 training set presents a\nrealistic crowdsourced setting with diverse types of images\nfor each landmark: e.g., for a specific museum there may be\noutdoor images showing the building facade, but also indoor\nimages of paintings and sculptures that are on display. \n\nFrom the paper published with the landmark dataset. So, I believe those \"outliers\" may still have their correct label.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1491830,
      "author_name": "aditimulye",
      "author_url": "",
      "post_date": "08/26/2021 16:43:23",
      "content": "<p>This is interesting! Thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1494335,
      "author_name": "sauravsolanki",
      "author_url": "",
      "post_date": "08/28/2021 15:42:24",
      "content": "<p>never thought of it. thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1495001,
      "author_name": "podidiving",
      "author_url": "",
      "post_date": "08/29/2021 08:23:10",
      "content": "<p>Does this approach give any boost on LB?<br>\nSeems a little bit risky. For example: you have a photo of Kremlin with lots of people in front of it. After cutting of redundant objects you can loose needed information to recognise Kremlin<br>\nMaybe there is some workarounds to deal with such issues</p>",
      "votes": null,
      "replies": [
        {
          "id": 1495025,
          "author_name": "sauravsolanki",
          "author_url": "",
          "post_date": "08/29/2021 08:59:24",
          "content": "<p>That's good point. Model will totally fail in it. These context are really important.. I have seen some landmarks if we remove such scene by yolo you left with bad images of no recognised features. Picking one by one will be tedious process. In test dataset, we need e2e model who do it..</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1495026,
          "author_name": "sauravsolanki",
          "author_url": "",
          "post_date": "08/29/2021 09:00:57",
          "content": "<p>Simple term, if human can fail, model will definately fail. But this method is useful in many multi model cases.. <a href=\"https://www.kaggle.com/strij2201\" target=\"_blank\">@strij2201</a> </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1495132,
          "author_name": "strij2201",
          "author_url": "",
          "post_date": "08/29/2021 10:19:00",
          "content": "<p>Yes, there is a certain risk. In the near future, I just want to try out the preprocessing images by Yolo + Midas (depth detection).<br>\nBy the way, here is an example of an image that (in my opinion) does not belong to landmarks:<br>\n<img src=\"http://77.232.23.74/59fc4b7c982ad18e.jpg\" alt=\"\"></p>\n<p>Do I need to consider such images as \"outliers\"?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1495137,
          "author_name": "sauravsolanki",
          "author_url": "",
          "post_date": "08/29/2021 10:31:38",
          "content": "<p>Yes.. what i do usually is… I keep the way it is used to be.  If data is good, model will be good. Noises should not get space in any domain. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1499581,
          "author_name": "ilu000",
          "author_url": "",
          "post_date": "09/01/2021 18:14:29",
          "content": "<blockquote>\n  <p>The Google Landmarks Dataset v2 training set presents a<br>\n  realistic crowdsourced setting with diverse types of images<br>\n  for each landmark: e.g., for a specific museum there may be<br>\n  outdoor images showing the building facade, but also indoor<br>\n  images of paintings and sculptures that are on display. </p>\n</blockquote>\n<p>From the paper published with the landmark dataset. So, I believe those \"outliers\" may still have their correct label.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1491169": "Some images are heavily \"contaminated\" with foreign objects. For example:\n![](http://77.232.23.74/scr1.jpg)\n\nYou can use YOLO to detect such objects:\n\nimport cv2\nimport torch\n\nfilename = \"ddea66b1102ade98.jpg\"\nimg = cv2.imread(filename)\n\nmodel = torch.hub.load('ultralytics/yolov5', 'yolov5x6')  #  P6 model\nresults = model(img, size=640) \nresults.show()             \n\nand result:\n![](http://77.232.23.74/scr2.png)\n\nand cut off:\n![](http://77.232.23.74/scr3.png)",
    "1491830": "This is interesting! Thanks",
    "1494335": "never thought of it. thanks",
    "1495001": "Does this approach give any boost on LB?\nSeems a little bit risky. For example: you have a photo of Kremlin with lots of people in front of it. After cutting of redundant objects you can loose needed information to recognise Kremlin\nMaybe there is some workarounds to deal with such issues",
    "1495025": "That's good point. Model will totally fail in it. These context are really important.. I have seen some landmarks if we remove such scene by yolo you left with bad images of no recognised features. Picking one by one will be tedious process. In test dataset, we need e2e model who do it..",
    "1495026": "Simple term, if human can fail, model will definately fail. But this method is useful in many multi model cases.. @strij2201",
    "1495132": "Yes, there is a certain risk. In the near future, I just want to try out the preprocessing images by Yolo + Midas (depth detection).\nBy the way, here is an example of an image that (in my opinion) does not belong to landmarks:\n![](http://77.232.23.74/59fc4b7c982ad18e.jpg)\n\nDo I need to consider such images as \"outliers\"?",
    "1495137": "Yes.. what i do usually is... I keep the way it is used to be.  If data is good, model will be good. Noises should not get space in any domain.",
    "1499581": ">The Google Landmarks Dataset v2 training set presents a\nrealistic crowdsourced setting with diverse types of images\nfor each landmark: e.g., for a specific museum there may be\noutdoor images showing the building facade, but also indoor\nimages of paintings and sculptures that are on display. \n\nFrom the paper published with the landmark dataset. So, I believe those \"outliers\" may still have their correct label."
  },
  "source": "meta"
}