Classification of Blurred and Non-Blurred Images
Test Accuracy: 87.57%
CERTH Image Blur Dataset
E. Mavridaki, V. Mezaris, "No-Reference blur assessment in natural images using Fourier transform and spatial pyramids", Proc. IEEE International Conference on Image Processing (ICIP 2014), Paris, France, October 2014.
The dataset consists of undistorted, naturally-blurred and artificially-blurred images for image quality assessment purposes.
- Download the dataset from here: http://mklab.iti.gr/files/imageblur/CERTH_ImageBlurDataset.zip
- Unzip and load the files into a directory named CERTH_ImageBlurDataset
- Run
pip install -r requirements.txt
to install dependencies - Run
python train_script.py
to train the Model - Run
python test_script.py
to evaluate the Model on Evaluation Set - Run
python -W ignore predict_an_img.py [Image Path]
to check Individual Image - If you have run the above commands Train Features, Test Features would be saved in
data
folder and model inmodel
folder. You can use it further for any reference and evaluate without again calculating all the features of Train and Test Data and could save some time.
- use Laplace filter to find edges in the input image
- compute the variance and the maximum over the pixel values of the filtered image.
- high variance (and a high maximum) suggest clearly distinguished edges, i.e. a sharp image. Low variance suggests a blurred image
- use a classifier (SVM) to discriminate the features of a Blurred and non-Blurred
Laplace Filter: It is an edge detection operator based on gradient methods. it calculates the second derivative of the data. It internally calls the sobel operator for first derivative.
Sobel operator: It is also an edge detection operator based on gradient method. i.e., the first order derivative method. Along x or along y or bi-directional. The edges are detected by convolving the kernel with actual image.
Note: Sobel filter is not used here. Because, By performing EDA it is founded that Laplace filter are (much) better in discriminating between the sharp and blurry images in our data set.
A support vector machine is an algorithm that computes a best separating line for us. The line is optimal in the sense that the margin between the two classes along the line is maximal.
python train_script.py
first of all extract the features [laplacian variance and maximum] and then trains the SVM model and save in the model folder.python test_script.py
evaluates the Model on Evaluation Set by the model saved in the model folder
Note: A more compact and illustrative Jupyter Notebook is attached named main.ipynb
for further reference.