Skip to content(if available)orjump to list(if available)

Show HN: Fashion Shopping with Nearest Neighbors

Show HN: Fashion Shopping with Nearest Neighbors

16 comments

·March 15, 2025

I made this website with my wife in mind; it makes it possible to browse for similar fashion products over many different retailers at once.

The backend is written in Swift, and is hosted on a single Mac Mini. It performs nearest neighbors on the GPU over ~3M product images.

No vector DB, just pure matrix multiplications. Since we aren't just doing approximate nearest neighbors but rather sorting all results by distance, it's possible to show different "variety" levels by changing the stride over the sorted search results.

Nearest neighbors are computed in a latent vector space. The model which produces the vectors is also something I trained in pure Swift.

The underlying data is about 2TB scraped from https://www.shopltk.com/.

All the code is at https://github.com/unixpickle/LTKlassifier

abeppu

It's interesting to see how some ideas keep looping around. When I see this I'm reminded of a startup Modista from ~2008 which did visual-similarity for browsing fashion products. Here's a writeup from a point when they did only shoes, but I know they expanded beyond shoes at somepoint: https://thenoisychannel.com/2008/11/05/modista-similarity-br...

I think they died over legal issues with rights to product images.

But in the vibewall demo, I wonder if the embedding is capturing the right similarity concept for this application. E.g. in the results most similar to this men's polo, I see a bunch of henleys, a women's quarter-zip pull-over, a women's full-zip fleece, a men's tank, a women's top with a plunging neckline, even a baby wrap! These are appropriate to be worn by different people in different social contexts and in different seasons. The main visual similarity seems to be that they include human upper bodies on white backgrounds? https://vibewall.shop/?id=c43bc222-e68b-11ef-8208-0242ac1100...

unixpickle

You definitely highlighted a shortcoming of the feature vector model in this case. Indeed it's quite a small model trained on a single Mac for about a week, so it's not very "smart".

I'd expect that this is a problem that could be solved by using larger off the shelf models for image similarity. For this project, I thought it would be cooler to train the model end-to-end myself, but doing so has negative consequences for sure.

crusty

This is interesting but seems price independent. I get that since nothing is final, they're all just more nodes, artificial restrictions based on price might limit the pathways to a match that might fit the users price parameters. But if a user has a budget, some items will only ever be intermediary nodes, while others are also potential purchases. I wonder if it would be computational trivial to highlight this distinction visually, so a user can easily distinguish between items to consider for purchase and items they will only see as refinement.

Our feels like there's a bit of a gamification in just clicking one more time, like "I like this, but if I click one more, maybe I'll like something in the next set even more." And repeat forever - like a great (window) shopping tool that doesn't result in much buying. But I'm not a shopper/consumer, so maybe my impression is not representative.

IgorPartola

I love this kind of “reaction decision” process. I have a hard time styling things until I see them and importantly when I see examples of what I don’t like.

Also this is what I imagine Stitch Fix uses for their stylists. I wish there was a polished stylist service that didn’t also have me buying clothes from them. I don’t need a $60 white T shirt or a $120 basic jean jacket but I do want to have styles that look good specially for me.

fashion-at-cost

General idea behind https://wishi.me. You pay a decent chunk of change for time with an actual industry professional stylist, they give you some “mood boards” you can pull from at-will and request changes to if desired. They’re all affiliate links ofc, but nothing stopping you from just searching for the item separately and buying it wherever you have the best deal.

The intro price is probably too much for most of the “tech bros” that make a point of putting the least effort into their appearance possible, but if you want to be the kind of person that gets daily outfit compliments from strangers, it’s worth a shot.

binarymax

This is really cool. You might be interested in this talk which shows you can incrementally add some preference vectors as a way to improve the recommendation.

https://haystackconf.com/us2023/talk-20/

lavela

Visiting the site first I was quite annoyed it always pushed me towards women's fashion, which obviously makes sense reading your statement.

If anyone reimplements this for men's fashion let me know! I think this tool is great for anyone who isn't well educated in terms of fashion and I guess it is safe to say that this applies to men more often than to women.

ResearchAtPlay

This is great! I've forwarded the site to my wife.

Would you mind sharing how you trained the model to produce the vectors? Are you using a vision transformer under the hood with contrastive training against price, product category, etc.?

EDIT: I see that the training script is included in the repo and you are using a CNN. Inspiring work!

unixpickle

Yup, it's a small model I trained on my Mac mini! The model itself just classifies product attributes like keywords, price, retailer, etc. The features it learns are then used as embeddings

thinkingemote

Nice! I was going to ask about if the nearest neighbour algorithm gives less distance if a model has the same pose and then I realised that similar products (like a t-shirt) are shown with the same pose, so it shouldn't be an issue.

"hat" gives a range of poses

unixpickle

Ideally pose and lighting wouldn't matter as much as it currently does.

I think using a better model to produce feature vectors could achieve this, or perhaps even finetuning the feature model to match human preferences.

whiplash451

Very cool. Have you considered adding text-based search using CLIP-like embeddings?

unixpickle

I think it would be a useful feature. For the sake of being a fun project, I didn't use CLIP because I only wanted to use models that I trained myself on a single Mac. However, to make this more useful, text search would be quite helpful.

6stringmerc

So it just automatically uses location data fed by the user and doesn’t prompt? What are the terms of service on data collection?

aeontech

Not your physical nearest neighbors, rather, product neighbors in similarity space.

porridgeraisin

I would love a shopping site that tells me what my neighbours are buying. Bonus points if it uses my camera to peek through the windows.