Code Monkey home page Code Monkey logo

captcha-recognition's Introduction

Classification for Digital Image

This is an Matlab project for recognizing noised digital image. What we want is a programme that could automatically recognize several noised digital image. The inputs are some images like the following picture, the exception is [2, 0, 2].

中文介绍

In this project, we introduced a classification example for number images.

sample

They are similar to Google CAPTCHAs.

There are totally 1200 images in folder 'imagedata', and ground truth in file 'labels.txt'.

The task is to make a function called my_classifier.m that decodes three digits in an image.

Environment

Matlab and Image Processing Toolbox are ready for your computer.

Run

  1. New a folder named ‘labeledImage’ and run ‘DeNoise.m’
  2. New a folder named ‘SplitLabeledImage’ with 3 sub-folders named ‘0’, ‘1’ and ‘2’, then run ‘Split.m’
  3. Run ‘trainer.m’ to get trained network ‘net.mat’
  4. Run ‘evaluate_classifier.m’

How does it work

  1. An original image is I

  2. We firstly use threshold to convert image into binary image.
    Ibinary

  3. Then we use imclose to remove noises. IbinaryAfterClosing

  4. We split the denoised image into three parts. In each part, there is a single number. split

  5. We do the same thing for each image and save the split images into the sub-folder 0 , 1 , 2

  6. We desgin a CNN like this

    layers = [
        imageInputLayer([50 35 1])
        
        convolution2dLayer(3,8,'Padding','same')
        batchNormalizationLayer
        reluLayer
        
        maxPooling2dLayer(2,'Stride',2)
        
        convolution2dLayer(3,16,'Padding','same')
        batchNormalizationLayer
        reluLayer
        
        maxPooling2dLayer(2,'Stride',2)
        
        convolution2dLayer(3,32,'Padding','same')
        batchNormalizationLayer
        reluLayer
        
        fullyConnectedLayer(3)
        softmaxLayer
        classificationLayer];
  7. We write a script for test images to split them into the size that our clissifer can test. In this project, it is myclassifier.m.

  8. At last, in evaluate_classifier.m, we evaluate our classifier. Note, you may see that the code in this file about the test data is our training data, but you can replace them by yourself.

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.