Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

reverse image search via perceptual hashing #74

Open
jeremybmerrill opened this issue Jun 19, 2018 · 8 comments
Open

reverse image search via perceptual hashing #74

jeremybmerrill opened this issue Jun 19, 2018 · 8 comments

Comments

@jeremybmerrill
Copy link
Contributor

it would be really neat to be able to search for ads that use an image (e.g. a news photo or a meme) OR group ads that use the same image.

The way to do this would likely be to -- at some point -- record each image's perceptual hash, then at search time, compare the given image to all images in the DB, returning those that are similar. dhash and phash are both perceptual hashing algorithms, but there may be other good choices.

For instance, hopefully, we could determine which ads use the Distracted Boyfriend meme like this one .

@jeremybmerrill
Copy link
Contributor Author

any interest, @imalsogreg ?

@jeremybmerrill
Copy link
Contributor Author

Since my understanding is that these perceptual hash algorithms are primarily architected in Python, this could either happen as part of the classifier classify step in Python in this repo, or in a similar, but new, separate script that's also run on a frequent cron.

@imalsogreg
Copy link

That sounds like a lot of fun :) Let me see if I can get a proof of concept up.

@jeremybmerrill
Copy link
Contributor Author

Awesome, holler if you have Qs or if there's anything I can help with.

@yinleon
Copy link

yinleon commented Aug 1, 2018

Hi, I just stumbled on this.

I have experience making reverse image search engines using features extracted from pre-trained neural networks, and then calculating distance using KNN. There's some more info (code, presentation, video) in this repo:
https://github.com/yinleon/pydata2017

Let me know if this method sounds interesting for this project
(sorry for the shameless self-promotion).

@jeremybmerrill
Copy link
Contributor Author

Hi @yinleon, that sounds amazing. In my response to your other comment, I posted a link to download the entire dataset of US political ads.

This sounds potentially really promising. Are the extracted features interpretable (e.g. "this one has a picture of Nancy Pelosi")? Can you describe how well it works identifying nearly-identical images versus more heavily modified or cropped images? What about images with text overlays, like memes?

I'm not super familiar with Keras. Would it be possible for me or a colleague to test your implementation on an ordinary MacBook Pro? Or is it easier to set it up on a GPU-enabled AWS instance?

I really appreciate your taking the time to share about your research. You're of course welcome to download and check out our data and I'd love if we could find a way to work together. Happy to talk more about my qualitative observations of the ad images, if that'd be helpful.

@yinleon
Copy link

yinleon commented Aug 1, 2018

@jeremybmerrill I sent you an email to talk in depth about this.

@imalsogreg
Copy link

This sounds awesome!

Pre-trained ResNet probably has lots of features that are relevant for general image search (common objects, body parts), and lacks some that would specifically help categorize political ads (Nancy Pelosi neurons, e.g.). I wonder how hard it would be to retrain ResNet with lots of extra labeled examples, with those labels drawn from politically relevant topics. Your google image scraper could be useful there?

I'd always assumed image classifiers would be terrible for image search, but from your video, apparently it can work great, when you don't throw away all features but the strongest one :P Cool result with KNN search.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants