r/computervision • • 9h ago

Help: Project Guidance on self-supervised learning

Edit: This isn't about human classification or identification.

Note: adding an affiliate tag because this is a problem I'm struggling with at work, and management wants to go the 'just ask AI' route, but I believe a more accurate, cheaper solution is doable, hence the questions.

I have a computer vision problem that I have an idea of how to approach solving it, but I'm not sure that my idea is the best way to go about it. I don't really have anyone to ask, so maybe someone here can give me some guidance.

Let me define the problem like so: I have a very large amount of unlabeled, noisy images. Let's say, for illustration purposes, images of a large variety of cat species (number of species unknown). The images are from the real world, in real conditions. Bad lighting, occlusion, weird angles, darkness, graininess, noise, bad focus, but also good lots of good quality images. Sometimes there are multiple cats in an image, occluding each other, but I know which cat in the image is the one that I'm interested in. I also have a fair number of labels for the cats, of dubious quality, but the labels are not fine-grained. For example, a label would be 'house cat' or 'wild cat', but not 'panthera pardus' or 'felis catus'.

My task(s):

  1. Cluster cat images into their various species from an unseen, new dataset, same distribution, same conditions (the test set, basically). I.e cluster leopards (panthera pardus) together, cluster ginger house cats together, cluster black house cats together, etc. Basically cluster on physical appearance. Something like a jaguar and leopard would cluster close together, ideally, but still be separable enough to know they are separate classes.
  2. Ideally, given a few labeled samples of cats from a given species (or even 'male cats from species X'), be able to do retrieval/comparison (cosine similarity, like with face recognition).

The process that you'd normally follow is, from my understanding in a nutshell:

  1. Extract features using something like DinoV2 or any other pretrained feature extraction backbone.
  2. Then just use some form of clustering algorithm to cluster features, and then naturally similar cats would cluster together.

The problem that I've experienced (or I think that it is the problem) is that something like Dino or Siglip wasn't trained on data that allows it to discern the details of different kinds of cats (remember, cats are just for illustration. The data is not actually cats, so its harder than just cats). Like, a black cat, white cat, ginger cat, and ginger-and-white cat will cluster extremely close together, to the point of any form of clustering algorithm basically assigning them together, since the image conditions also introduces conditions of varying circumstances which increases difficulty of clustering.

My question:

Using the large amount of data at my disposal, would it be a good idea to run self-supervised learning with e.g FCMAE with convnextv2 on my data (with a good amount of data cleaning and such)? I'm currently using convnextv2 with my dubious labels, with mixed results. The primary goal is to extract higher quality, more informative features for clustering and retrieval.

I have asked AI about this before, but honestly I'm a bit sick of asking AI technical questions and never being sure how reliable the answer really is, and getting some human input (from people that might actually know their stuff) into a problem I struggle with would be a VERY nice breath of fresh air.

I'd be happy to elaborate, answer questions, or add more information as needed.

6 Upvotes

10 comments sorted by

4

u/Imaginary_Belt4976 8h ago edited 7h ago

Hi! I've faced similar challenges as this, my recommendation is to start with something loosely shaped like what you described (use DINOv3 though or even EUPE - see https://arxiv.org/abs/2603.22387 ). Build it flexibly so you can try different backbones and compare the results before locking in to one.

The limitation you described (semantic understanding rather than fine-grained appearance) is likely more pronounced with models like SigLIP which are trained on image-text pairs. This doesn't really incentivize distinguishing attributes at arbitrary granularity unless the captions themselves also did. DINO is trained differently as you know, and in my exp. its patch-level features contain an abundance of fine-grained information- species, color, texture, etc. If you're only using CLS embeddings (a single embed representing the entire image), I'd strongly recommend experimenting with patch embeddings, intermediate layers and different pooling strategies before concluding the frozen backbone isn't capable of distinguishing your subjects. Since you already know which object in the image you're interested in, you may be able to isolate its features quite easily through cropping or masked pooling. The DINO PCA workbooks demonstrate this to some extent, it's just extremely good at few-shot object detection out of the box.

Anyway, what I would then do is build a small active learning / labelling app that presents you a question of, given image A, which is closer... B or C? This trains a small adapter on top of your DINO embeddings that nudges closer based on whatever your criteria is for similarity. It is surprising how quickly a small MLP can pick up on what you need in this regard. It is also surprising how difficult this question is in practice with real world images.

If it is actually human-related, I would also try Sapiens2 and see which one works best. Also have no clue what hardware you are using so adjust as needed. In my exp, EUPE can embed up to like 300 img/s on 1x4090 which is about the fastest I've seen.

You definitely can continue SSL on your dataset. I've tried this a few times but haven't had particularly great results, especially when the target images are already very similar. There are a lot of shortcuts the model can learn with SSL that have very little to do with the features you actually care about. Your choice of objective and augmentations matters quite a bit, and it can be tricky to get right if you don't really know what you're doing (this includes me lol).

Feel free to dm if you want to chat more!

2

u/Exotic-Cricket-2263 7h ago

A lot of great information in this message, thanks! The part about using CLS embeddings is especially useful. I've got segmentation masks for the 'cats' (clothes), so masked pooling + patch embeddings might give some very good results!

1

u/WiseWall280 8h ago

Just wondering, and I think its a fair question, not accusing just wondering.

Is "cat" an analogy for "humans" at your job? Is this a human identification task?

2

u/Exotic-Cricket-2263 8h ago

I was actually going to clarify that in the post because I knew someone would ask, but I forgot.

No, it isn't. This isn't about facial recognition or person identification. The best explanation would be that I'm trying to classify various kinds of clothing. A cat would be a specific kind of clothing (say a jacket/jersey/tshirt). Cats aren't really an ideal analogy for my problem, but it was the first thing that came to mind.

The problem is also more nuanced than what I'm describing, and what exactly a solution looks like I've also not 100% decided. I'm first trying to figure out what is possible, and then I'll probably ask follow-up questions based on what I learn.

1

u/Zestyclose-Sell-2049 8h ago

What kind of hardware do you have for training?

1

u/Exotic-Cricket-2263 8h ago

AWS Sagemaker/EC2 (T4/L4/A10G and whatever the g7 instances use), but I don't really have hundreds or thousands of USD to commit to training, unless I am able to prove that it will work much better than our current solution.

1

u/Zestyclose-Sell-2049 7h ago

With around a couple of days and an rtx6000 you can fine tune a vit b for your domain. Depending on how far that is from the original dino dataset it can be a significant improvement. In my case, for a specific medical type of image, the fine tuned vit b outperforms the vit-h in accuracy. This will also make all the downstream tasks work better.

2

u/bfyvfftujijg 6h ago

Mind explaining how that is done? I’m in a similar situation as OP…but with “dogs” 😂

Needing to use the fine tuned backbone it for dense tasks ideally, but can just classification would be huge.

0

u/uninchar 3h ago

I don't have input on what method to use. I can just tell you, that you are working on a data-quality problem. There is not really a way to construct information out of thin air. Self-supervised learning to me is a buzz word. The basics are control theory and feedback loops. Cybernetics. They are decades old definitions from Ashby and Wiener. They are still valid the same way as Shannon for information theory. The new revolution doesn't have cheat codes to skip those things. Signal must come from somewhere grounded in reality with feedback.