CNN vs. Laplacian · nothing leaves your browser
Is it blurry?
Start with one of the pictures below, or drop your own. A small convolutional network, trained on images blurred with blur-generator, and the classic Laplacian variance both take a look, window by window.
Drop it like it's hot.
…or paste an image, or
Stress test
Blur the current picture a little more at every step and watch both detectors change their minds. The blurs are simulated in your browser on a copy at most 512 px wide.
Pick a kind of blur and press Run.
Show as a table
How it works
Same model, same maths, from the training script to this page.
- Sharp picturesdrawn by code into data/train and data/test, folder
nonblur(or your own) - blur-generatora lens, Gaussian or motion blur for every one, into
blur - Keras CNN3 conv blocks → 2 dense layers, 100k weights, trained on whole pictures and crops
- ONNXexported and checked against Keras by GitHub Actions
- Your browserONNX Runtime Web; the pixels stay on your machine
The CNN
Every picture is prepared exactly like the training data: each colour channel's histogram is equalized, the picture is squeezed to 256 × 256 and scaled to 0–1. The network answers with two probabilities, sharp and blurry. For the heat map it looks at square windows, half as wide as the picture's shorter side, which is the smallest crop it saw in training.
The Laplacian variance
The Laplacian filter lights up wherever brightness changes abruptly, so a sharp picture has a wildly varying Laplacian and a blurry one a flat, quiet one. Its variance is a one-line blur score with no training at all. Its weak spot: flat areas such as sky look "blurry" even when they are in focus.
Model card
- status
- loading…
The model learned from a hundred illustrations of this project and their copies blurred with blur-generator, so it is most at home with drawings and less sure about photos.
The sample pictures are part of this project, under its MIT licence. Your own pictures never leave your browser.