GithubHelp home page GithubHelp logo

aadv1k / octetocr Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 188 KB

Octet is an exploratory OCR or text recognition library to prepare and train upon raw data

License: GNU General Public License v3.0

Batchfile 0.16% C 99.67% Shell 0.17%
c machine-learning ocr ocr-engine text-recognition

octetocr's Introduction

OctetOCR

Octet is an OCR model training system, this includes functionality for both preparing and training the data.

This system implements a rudimentary K-NN function to predict the similarity of an OctetCharacter which contains the raw image data (unsigned char*) against a pre-computed array of characters derived from dataset/

NOTE Library under active development, things may change or break. I also appreciate any input on the code, cheers!

See:

Examples

See example.c for how you might use this library

Prepare

Loading a dataset from a folder is slow since everytime pre-processing has to be applied. Hence it is adviced that the data be serialized as a CSV and read from there instead, here is what that may look like :-

#include <octet.h>
  /* ... */

  OctetData* data;

  if (!dataFileExists) {
    data = octet_load_training_data_from_dir("./dataset");
    octet_write_training_data_to_csv("./data.csv");
  } else {
    data = octet_load_training_data_from_csv("./data.csv");
  }

  octet_free_training_data(data);

  /* ... */

Train

#include <octet.h>

  /* ... */

  OctetData* trainingData = octet_load_training_data_from_dir("./dataset");
  OctetCharacter testCharacter = octet_load_character_from_image("./tests/test_data/test-A.jpg");

  char predictedLabel = octet_k_nearest_neighbour(testCharacter, trainingData, /* k */ 3);
  assert(predictedLabel == 'A');

  octet_free_character(testCharacter);
  octet_free_training_data(trainingData);

  /* ... */

Gallery

The program has been tested against the following samples, feel free to add to the ./dataset, if you want an alt version of "A" in the dataset, jut name it something like A1.jpg

Input Training Data Match
A
B

Test

Win32

.\build.bat TEST
.\octet_test.exe

Unix

Credit to rarafael for the shell script

./build.sh TEST
./octet_test

Credits

Credit to rarafael for

  • Providing the build.sh script
  • Implementing octet_load_training_data_from_csv at src/prep.c
  • General quality of life improvements

octetocr's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.