Looks like a for loop iterating over each pixel one row at a time. What makes this fast?
Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
21–30 of 66 posts
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#22Earlier quoted context omitted.
Were you comparing two identical image? Could you try two different image?
To really see how these algorithms perform, you should compare the worst case for the algorithm. In order to see if a picture is identical, you’d have to loop through every single pixel, which is the worst case. But you can shortcut on the first pixel which is different, which I imagine happens pretty quickly on many generic pictures. So testing performance with two different images is probably not best for compariso…
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#23Earlier quoted context omitted.
Considering the source material is a file, that needs to be loaded up by the CPU first, and the operation itself is dead simple, the real constraint is RAM bandwidth. I would guess that the time of getting the data out to the GPU and back, is about the same as just calculating the difference on the CPU. So, the quickest solution is probably to use the CPUs vector operations, and read ahead into the registers so you c…
I recently tried this with a 19 megabyte .tiff file in PyTorch. Uploading the tensor took (i think) around 1 or 2 seconds, wall-clock time. So I quickly dismissed the GPU solution to my problem. But I'm still wondering... is this normal?
The actual file transfer is comparable to the GPU doing a memcpy. (You could also use pinned host memory if the GPU program is just doing a one-off read.)
GPU processing for simple operations really shines if your data is already on the GPU and your code is hot. Otherwise, it's more useful if the process is significantly complex enough to make the overhead of a cold startup insignificant.
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#24What are some of the common applications for diffing an image?
https://github.com/python-needle/needle
Depending on your needs, detecting duplicates can also be useful – especially if you’re using some kind of CV tool which quickly assesses similarity and you want a second check to confirm that the highly similarity matches aren’t hitting some edge case failure mode.
One challenge is that you sometimes want to allow minor differences - think things like text aliasing or slight differences in the pixel values produced by different compression/color handling/etc. implementations - so there are some neat tools like pdiff which try to emphasize differences which the human visual system is sensitive to:
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#25What are some of the common applications for diffing an image?
I've put a few simple examples in Node.js here: https://github.com/umaar/learn-browser-testing/tree/master/3... (just as learning material)
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#26I'm skeptical about it's high claims. Looking at the code its just using the Go standard library image package, looping over the bounds and calculating delta? Doesn't seem like there's anything special here? It's roughly what any novice would build if asked to diff two images in Go?
I just skimmed through the code, but as far as I can tell, the main point is that this code is multi-threaded. Which, sure, gets the job done faster than the single-thread `odiff` on a single image, but is quite irrelevant for a tool marketed for tests/CI where many images are likely to be compared in parallel already (and maybe a single core is even available).
Yep, uses as many goroutines as the number of CPUs, that's about it. Saying it's 3x faster or whatever in "benchmarks" without even saying what CPU is used in the benchmarks is just sketchy.
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#27Years ago I worked with image processing and thought of writing a CLI image diff tool. I then thought meh, anyone can quickly roll their own. Turns out it seems to be something people care about. I should just start writing the CLI tools I think of, without dismissing their utility.
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#28Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#29Why not use the GPU? This is exactly the kind of tasks GPUs were designed for. Gimp can do this in real time using the difference layer mode.
Considering the source material is a file, that needs to be loaded up by the CPU first, and the operation itself is dead simple, the real constraint is RAM bandwidth. I would guess that the time of getting the data out to the GPU and back, is about the same as just calculating the difference on the CPU. So, the quickest solution is probably to use the CPUs vector operations, and read ahead into the registers so you c…
Re: Imgdiff: Faster than the fastest pixel-by-pixel image difference tool
#30I am really used to just being able to do go build from the root directory of the repository.