{
  "id": 307725,
  "title": "How about clustering methods like DBSCAN?",
  "url": "/competitions/happy-whale-and-dolphin/discussion/307725",
  "author_name": "",
  "post_date": "2022-02-15T11:43:59.814042200Z",
  "votes": 10,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Since we can model this as a similarity search unsupervised problem, I tried to cluster the images given in the training set.<br>\nI used DBSCAN for detecting clusters in the presence of noise. I choose the parameters to have the same number of clusters as the unique individual ids. (Not sure if that's the best way to do it.).<br>\n[See Notebook : <a href=\"https://www.kaggle.com/yerramvarun/happywhale-dbscan-efficientnet-baseline\" target=\"_blank\">HappyWhale : DBSCAN + EfficientNet baseline 🔥</a> ] .</p>\n<p>I used RAPIDS DBSCAN for faster clustering.<br>\nRAPIDS DBSCAN doesn't have inbuilt support for using cosine distance as a metric, so I used a mathematical <a href=\"https://medium.com/ai-for-real/relationship-between-cosine-similarity-and-euclidean-distance-7e283a277dff\" target=\"_blank\">trick</a> to make it work.</p>\n<p>My guess for not getting great results is that the model is not trained to generate embeddings that can be clustered (e.g., with ArcFace loss).<br>\nIf you have any other ideas to improve this baseline, do mention them.</p>",
  "messages": [
    {
      "id": "1691397",
      "postDate": "02/15/2022 11:43:59",
      "content": "<p>Since we can model this as a similarity search unsupervised problem, I tried to cluster the images given in the training set.<br>\nI used DBSCAN for detecting clusters in the presence of noise. I choose the parameters to have the same number of clusters as the unique individual ids. (Not sure if that's the best way to do it.).<br>\n[See Notebook : <a href=\"https://www.kaggle.com/yerramvarun/happywhale-dbscan-efficientnet-baseline\" target=\"_blank\">HappyWhale : DBSCAN + EfficientNet baseline 🔥</a> ] .</p>\n<p>I used RAPIDS DBSCAN for faster clustering.<br>\nRAPIDS DBSCAN doesn't have inbuilt support for using cosine distance as a metric, so I used a mathematical <a href=\"https://medium.com/ai-for-real/relationship-between-cosine-similarity-and-euclidean-distance-7e283a277dff\" target=\"_blank\">trick</a> to make it work.</p>\n<p>My guess for not getting great results is that the model is not trained to generate embeddings that can be clustered (e.g., with ArcFace loss).<br>\nIf you have any other ideas to improve this baseline, do mention them.</p>",
      "rawMarkdown": "Since we can model this as a similarity search unsupervised problem, I tried to cluster the images given in the training set.\nI used DBSCAN for detecting clusters in the presence of noise. I choose the parameters to have the same number of clusters as the unique individual ids. (Not sure if that's the best way to do it.).\n[See Notebook : [HappyWhale : DBSCAN + EfficientNet baseline 🔥](https://www.kaggle.com/yerramvarun/happywhale-dbscan-efficientnet-baseline) ] .\n\nI used RAPIDS DBSCAN for faster clustering.\nRAPIDS DBSCAN doesn't have inbuilt support for using cosine distance as a metric, so I used a mathematical [trick](https://medium.com/ai-for-real/relationship-between-cosine-similarity-and-euclidean-distance-7e283a277dff) to make it work.\n\nMy guess for not getting great results is that the model is not trained to generate embeddings that can be clustered (e.g., with ArcFace loss).\nIf you have any other ideas to improve this baseline, do mention them.",
      "votes": null
    },
    {
      "id": "1691499",
      "postDate": "02/15/2022 12:47:02",
      "content": "<p>Similar scenario is that face detection and recognition.  but then you need to  annotate and crop the targets?</p>",
      "rawMarkdown": "Similar scenario is that face detection and recognition.  but then you need to  annotate and crop the targets?",
      "votes": null
    },
    {
      "id": "1691620",
      "postDate": "02/15/2022 14:04:32",
      "content": "<p>Yes! cropping should give better embedding predictions. I did it for the original images to check the performance.<br>\nWill try with a cropped version too.</p>",
      "rawMarkdown": "Yes! cropping should give better embedding predictions. I did it for the original images to check the performance.\nWill try with a cropped version too.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1691499,
      "author_name": "dragonzhang",
      "author_url": "",
      "post_date": "02/15/2022 12:47:02",
      "content": "<p>Similar scenario is that face detection and recognition.  but then you need to  annotate and crop the targets?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1691620,
          "author_name": "yerramvarun",
          "author_url": "",
          "post_date": "02/15/2022 14:04:32",
          "content": "<p>Yes! cropping should give better embedding predictions. I did it for the original images to check the performance.<br>\nWill try with a cropped version too.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1691397": "Since we can model this as a similarity search unsupervised problem, I tried to cluster the images given in the training set.\nI used DBSCAN for detecting clusters in the presence of noise. I choose the parameters to have the same number of clusters as the unique individual ids. (Not sure if that's the best way to do it.).\n[See Notebook : [HappyWhale : DBSCAN + EfficientNet baseline 🔥](https://www.kaggle.com/yerramvarun/happywhale-dbscan-efficientnet-baseline) ] .\n\nI used RAPIDS DBSCAN for faster clustering.\nRAPIDS DBSCAN doesn't have inbuilt support for using cosine distance as a metric, so I used a mathematical [trick](https://medium.com/ai-for-real/relationship-between-cosine-similarity-and-euclidean-distance-7e283a277dff) to make it work.\n\nMy guess for not getting great results is that the model is not trained to generate embeddings that can be clustered (e.g., with ArcFace loss).\nIf you have any other ideas to improve this baseline, do mention them.",
    "1691499": "Similar scenario is that face detection and recognition.  but then you need to  annotate and crop the targets?",
    "1691620": "Yes! cropping should give better embedding predictions. I did it for the original images to check the performance.\nWill try with a cropped version too."
  },
  "source": "meta"
}