Giter VIP home page Giter VIP logo

blur-and-clear-classification's Introduction

Blur-and-Clear Images Classification

Classifying the Blur and Clear Images

Introduction

In day to day Life, we encounter the poor images clicked from our Camera due to poor focus, a motion of objects in the frame or handshaking motion while capturing the Images.

Blur is typically the thing which **suppress the high-frequency** of our Images, therefore can be detected by using various low-pass filter eg. Laplacian Filter.

As a smart person(myself a CS guy) we doesn't want to manually filter out the Clear and Blurred Images, so we need some smart way to delete the unnecessary Images.

LoG Filter

I also applied the Laplacian of gaussian(LoG) filter to detect the blur images, but it was difficult to find the exact value of the threshold needed to differentiate images; despite that results were not fascinating.

Used variance of LoG filter

Some of its discussions

https://stackoverflow.com/questions/7765810/is-there-a-way-to-detect-if-an-image-is-blurry

https://stackoverflow.com/questions/5180327/detection-of-blur-in-images-video-sequences

LoG Ref:

http://aishack.in/tutorials/sift-scale-invariant-feature-transform-log-approximation/

Repo which implemented LoG filter in Python: https://github.com/WillBrennan/BlurDetection2

As the Now, the era of Deep Conv Nets has suppressed the Standard Computer Vision Techniques, Thus I focussed on the root of it which is Neural Nets. Neural Nets learn very Quickly the complex features, therefore can be used much easily then std. CV technique. Tuning ANN efficiently can provide me the results much better than CV TEchnique.

Neural Network Model

Model has 3 Layers Containing

 1 Input Layer -> 100*100 U
 
 1 Hidden Layer -> 300 HU
 
 1 Output Layer -> 2 U

I have used the Backprop Algorithm for Training ANN using the SGD Optimizer with Momentum. Rescaled the Images to 100 x 100 Pixels in Grayscale Coding and done median filtering to filter out the noise from Images.

Quick Start

Need the Images that are clear in the separate folder and one with blurred in another folder.

# Python3+ user install Tkinter package (Python 3.5.xx)
# Currently code is supported for Python 3.5.xx version only
sudo apt-get install python3-tk
# Clone the repo
git clone https://github.com/aditya9211/Blur-and-Clear-Classification.git
# Change the working Directory
cd Blur-and-Clear-Classification/
# Install the requirements
pip install -r requirements.txt
# Train the Network
python train.py  --good_path  '/home/......good/'  --bad_path  '/home/......./bad/'
# Test the Network 
python test.py
# Predict output 
python predict.py --img '/home/....../laptop.png'

Code Structure

Code is segmented as follows:

  1. Training Part :

    train.py

    which train the neural network with given images and stores the trained parameters and splitted train, test set to disk

  2. Testing Part :

    test.py

    test the neural network with test data stored by train.py

  3. Predict Part :

    predict.py

    predict the label of images(Good/Bad) provided by argument while calling

  4. Config File :

    config.py

    contains the list of constant used by files or hyper-parameters which can be changed by editing this file

  5. Utiltities Part :

    utils.py

    helper functions or common function among used in train/test and predict

  6. Requirement Package :

    requirements.txt

    packages required for running scripts

blur-and-clear-classification's People

Contributors

aditya9211 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blur-and-clear-classification's Issues

predict.py?

want to add predict.py for 1 image to predict blur or clear

and addition to test on the user-defined dataset, not from trained splitter one.

Blur image classification accuracy does not increase.

Hello? I'm working on blur image classification using the network on this site.
I have 2,500 images, and I have blur image and clean image for classification, but when I train,
the validation dataset accuracy is not more than 70% and I have a stagnant problem
Please tell us how can improve our validation accuracy. and I want to know the hyper parameter setting
for your neural network you set.
Thank you

Could you please share which database the repertory had used?

Dear
I am working on distinguishing blurred images problem. And I think this repertory is interesting and it must be helpful for my work. But I have not yet seen the database used. Could you please tell me which database the repertory had used?

Appreciate your help.

Thanks and regards.

Jasonsey

about sample collect ??

Hi, where are your blur images samples from? Is blur images from some algorithm generated or download a collected image dataset or by google crawler?
Thanks.

multiple image predictions via folder or *

Hi - this is great! I've trained my model with 100 blurry and 100 clear and everything seems to be doing well - 96% accuracy, but now for the prediction I can only get it to run one image at a time to give me the good or bad label - am I missing something? I have about 7,000 images to label and I'm looking to set it up for an influx of daily imagery.

The IMAGE_PATH doesn't accept *.jpg or directing it to a folder of images... can you advise?

And then is there an easy way to move the predicted image to a folder based on its label? Trying to get the non-blurry photos to be sent into another NN to be put into a classification model.

Thanks!

Memory Error

Hi thanks for sharing your work.

but i get this error when running train.py

Train Data Path Success .....
Train Label Path Success .....  
Test Data Path Success .....
Test Label Path Success .....

Saving the splitting results......

Traceback (most recent call last):
 File "train.py", line 564, in <module>
  main()
 File "train.py", line 532, in main
 train_images = np.insert(train_images, 0, 1, axis=1) 
 File "/home/jeniffer/.local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 4431, in   insert
new = empty(newshape, arr.dtype, arrorder)
  MemoryError`

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.