Live data from Hacker News

Show HN: Imagededup – Finding duplicate images made easy

github.com

41–50 of 60 posts

Re: Show HN: Imagededup – Finding duplicate images made easy

#41
post #10

Earlier quoted context omitted.

This looks really interesting. Can you give us an idea of the performance? E.g. roughly how long would it take to process 1 million 1920×1080 JPEGS, without GPU and with GPU? What is the scaling like? E.g. what if it was 10 million?

I use Cython (CPU) to brute force 400,000 pHash's of images. It takes somewhere between 100 and 200ms to search.

That sounds good! Would be great if you can share the code, or even better, make a PR to the repo.

Re: Show HN: Imagededup – Finding duplicate images made easy

#42
post #34

Earlier quoted context omitted.

Retrieval using CNNs requires computing a cosine similarity matrix. So, for 'n' images, a matrix of size n x n would need to be stored in the memory. As you can see, the storage requirements blow up quadratically as 'n' increases. We have already made some optimizations to reduce the memory footprint but there would be clear upper limits to it (We haven't experimented). As for the numbers, the cifar10 dataset example…

Use approximate nearest neighbor. The FAISS library is good.

Thanks for the pointer, will check it out.

Re: Show HN: Imagededup – Finding duplicate images made easy

#43

Earlier quoted context omitted.

I use Cython (CPU) to brute force 400,000 pHash's of images. It takes somewhere between 100 and 200ms to search.

That sounds good! Would be great if you can share the code, or even better, make a PR to the repo.

The implementation is trivial, for speed we use:

cdef extern int __builtin_popcountll(unsigned long long) nogil

dist = __builtin_popcountll(key ^ phash)

It would only take a couple of minutes to fill out the rest.

Re: Show HN: Imagededup – Finding duplicate images made easy

#44
post #3

We've just open-sourced our library imagededup, a Python package that simplifies the task of finding exact and near duplicates in an image collection. It includes several hashing algorithms (PHash, DHash etc) and convolutional neural networks. Secondly, an evaluation framework to judge the quality of deduplication. Finally easy plotting functionality of duplicates and a simple API. We're really excited about this lib…

Did you consider using the PhotoDNA hash algo for finding duplicates? If you’ve heard of it and ruled it out, love to know why. While designed for a very different (and dark) purpose, seems like it might do well for the task.

Just had a look, thanks for the pointer. And yes, it was designed for a dark purpose. Will try to find the comparisons with the currently implemented hashing methods and see if there's merit to implementing it.

Re: Show HN: Imagededup – Finding duplicate images made easy

#45

Could this be used to order a large set of images by similarity?

The API does not seem to support this, but it should be easy to hack this (return not only a list of duplicates but the actual distance to the target image along with it, then sort results by distance).

Re: Show HN: Imagededup – Finding duplicate images made easy

#46

Could this be used to order a large set of images by similarity?

As I pointed in other comments, the current implementation does not focus on the scale problem. However, using the 'scores' attribute of the 'find_duplicates' function, one could obtain the hamming distance/cosine similarity and then use that to sort. For more, please refer the docs.

Re: Show HN: Imagededup – Finding duplicate images made easy

#47
post #29

This came a bit late. I recently decided I had to sort all my photos which I usually just dump in a big photos folder. Using the camera on my phone a lot and also getting a lot of media through whatsapp the collection was getting a bit big. I made a script to calculate the hash of every file and if it found a double it would move it to another duplicate folder. This worked reasonably well but I couldn't stop thinking…

quicker than hashing the file, you might want to compare exif data (extract with exiftool), i have been comparing image date/time (to the second) as tagged by the camera, and when i find a duplicate, i keep the one with the largest image size. I've not worked out how to deal with those without exiftags. I understand ShotWell hashes the thumbnail to find dupes. The security camera software motion has some image comparison and to determine if the camera image has changed since the last image, i think it was visual in nature, rather than hashing, since webcams are "noisy".

Re: Show HN: Imagededup – Finding duplicate images made easy

#50
post #48

did you evaluate the 'imagehash' [1] library prior to working on this-- any limitations/concerns? the additional CNN seems to be the difference between the two libraries [1] https://github.com/JohannesBuchner/imagehash

Yes, before developing the package, we were also using this great library for hash generation. There are a bunch of differences we have compared to imagehash: 1. Added CNN as you mentioned 2. Took care of housekeeping functions like efficient retrieval (using bktree, also parallelized) 3. Added plotting abilities for visualizing duplicates 4. Added possibilities to do evaluation of deduplication algorithm so that the user can judge the deduplication performance on a custom dataset (with classification and information retrieval metrics) 5. Allow possibility to change thresholds to better capture the idea of 'duplicate' for specific user cases
Post reply on HN