Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accurate binary image classification

I'm trying to extract letters from a game board for a project. Currently, I can detect the game board, segment it into the individual squares and extract images of every square.

The input I'm getting is like this (these are individual letters):

enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

At first, I was counting the number of black pixels per image and using that as a way of identifying the different letters, which worked somewhat well for controlled input images. The problem I have, though, is that I can't make this work for images that differ slightly from these.

I have around 5 samples of each letter to work with for training, which should be good enough.

Does anybody know what would be a good algorithm to use for this?

My ideas were (after normalizing the image):

  • Counting the difference between an image and every letter image to see which one produces the least amount of error. This won't work for large datasets, though.
  • Detecting corners and comparing relative locations.
  • ???

Any help would be appreciated!

like image 497
Blender Avatar asked Apr 04 '12 20:04

Blender


People also ask

How to evaluate the accuracy of a binary classifier?

The binary classifier can be evaluated based on the following parameters. After obtaining these values, Accuracy score of the binary classification is calculated as follows: a c c u r a c y = T P + T N T P + F P + T N + F N A confusion matrix is created to represent the parameters for binary classification.

Where can I find the data and algorithm for binary classification?

Both the data and the algorithm are available in the sklearn library. We'll print the target variable, target names, and frequency of each unique value: In this dataset, we have two classes: malignant denoted as 0 and benign denoted as 1, making this a binary classification problem.

How to implement binary image classification with CNNs on PyTorch?

This notebook takes you through the implementation of binary image classification with CNNs using the hot-dog/not-dog dataset on PyTorch. Set the random seed. Set Seaborn style. Let’s define the path for our data. Let’s define a dictionary to hold the image transformations for train/test sets.

What is image classification in Computer Science?

Put simply, image classification in a computer’s view is the analysis of this statistical data using algorithms. In digital image processing, image classification is done by automatically grouping pixels into specified categories, so-called “classes.”


2 Answers

I had a similar problem few days back. But it was digit recognition. Not for alphabets.

And i implemented a simple OCR for this using kNearestNeighbour in OpenCV.

Below is the link and code :

Simple Digit Recognition OCR in OpenCV-Python

Implement it for alphabets. Hopes it works.

like image 72
Abid Rahman K Avatar answered Sep 30 '22 17:09

Abid Rahman K


You can try building a model by uploading your training data (~50 images of 1s,2s,3s....9s) to demo.nanonets.ai (free to use)

1) Upload your training data here:

demo.nanonets.ai

2) Then query the API using the following (Python Code):

import requests
import json
import urllib
model_name = "Enter-Your-Model-Name-Here"
url = "http://images.clipartpanda.com/number-one-clipart-847-blue-number-one-clip-art.png"
files = {'uploadfile': urllib.urlopen(url).read()}
url = "http://demo.nanonets.ai/classify/?appId="+model_name
r = requests.post(url, files=files)
print json.loads(r.content)

3) the response looks like:

{
  "message": "Model trained",
  "result": [
    {
      "label": "1",
      "probability": 0.95
    },
    {
      "label": "2",
      "probability": 0.01
    },

     ....

    {
      "label": "9",
      "probability": 0.005
    }
  ]
}
like image 29
sj7 Avatar answered Sep 30 '22 18:09

sj7