Git Product home page Git Product logo

doubangotelecom / ultimatecreditcard-sdk Goto Github PK

View Code? Open in Web Editor NEW
94.0 10.0 33.0 282.16 MB

Bank credit card deep layout analysis, fields extraction and recognition/OCR (ScanToPay) using deep learning

Home Page: https://www.doubango.org/webapps/credit-card-ocr

License: Other

CMake 0.03% C++ 73.67% C# 9.47% Java 11.33% Perl 1.81% Python 3.56% Batchfile 0.13%
ocr ocr-recognition tensorflow deep-learning fintech credit-card ai sdk ocr-sdk scan-tool

ultimatecreditcard-sdk's Introduction


This is a state-of-the-art DeepLayout Analysis implementation based on Tensorflow to accurately detect, qualify, extract and recognize/OCR every field from a bank credit card using a single image: Number, Holder's name, Validity, Company...

Our implementation works with all cards (credit, debit, travel, prepaid, corporate...) from all payment networks (Visa, MasterCard, American Express, RuPay, Discover...).

Both Embossed and UnEmbossed formats are supported.

Unlike other implementations we're not doing brute force OCR (trying multiple images/parameters until match). You only need a single image to get the correct result. There is no template matching which means the data could be malformed or at any position and you'll still have the correct result (WYSIWYG).

Next video (https://youtu.be/BBI_3AJIc1c) shows CCardVideoRecognizer sample Running on Android:
CCardVideoRecognizer Running on Android


You can reach 100% precision on the credit card number recognition using validation process.

The number of use cases in FinTech industry are countless: Scan To Pay, Helping visually impaired users, Online shopping speed-up, payment forms auto-filling, better user experience, reducing typing errors, process automation...

Don't take our word for it, come check our implementation. No registration, license key or internet connection is required, just clone the code and start coding/testing. Everything runs on the device, no data is leaving your computer. The code released here comes with many ready-to-use samples for Android, Raspberry Pi, Windows and Linux to help you get started easily.

You can also check our online cloud-based implementation (no registration required) to check out the accuracy and precision before starting to play with the SDK.

Please check full documentation at https://www.doubango.org/SDKs/credit-card-ocr/docs/

Getting started

The SDK works on many platforms and comes with support for many programming languages but the next sections focus on Android and Raspberry pi.

Android

The next sections are about Android and Java API.

Sample applications (Android)

The source code comes with #2 Android sample applications: Benchmark and CCardVideoRecognizer.

Benchmark (Android)

This application is used to check everything is ok and running as fast as expected. The information about the maximum frame rate (27fps) on Snapdragon 855 devices could be checked using this application. It's open source and doesn't require registration or license key.

CCardVideoRecognizer (Android)

This application should be used as reference code by any developer trying to add ultimateCreditCard to their products. It shows how to detect and recognize credit cards in realtime using live video stream from the camera.


CCardVideorecognizer sample application on Android

Trying the samples (Android)

To try the sample applications on Android:

  1. Open Android Studio and select "Open an existing Android Studio project" alt text

  2. Navigate to ultimateCreditCard-SDK/samples, select android folder and click OK alt text

  3. Select the sample you want to try (e.g. ccardvideorecognizer) and press run. alt text

Adding the SDK to your project (Android)

The SDK is distributed as an Android Studio module and you can add it as reference or you can also build it and add the AAR to your project. But, the easiest way to add the SDK to your project is by directly including the source.

In your build.gradle file add:

android {

      # This is the block to add within "android { } " section
      sourceSets {
         main {
             jniLibs.srcDirs += ['path-to-your-ultimateCreditCard-SDK/binaries/android/jniLibs']
             java.srcDirs += ['path-to-your-ultimateCreditCard-SDK/java/android']
             assets.srcDirs += ['path-to-your-ultimateCreditCard-SDK/assets/models']
         }
      }
}

Using the Java API (Android)

It's hard to be lost when you try to use the API as there are only 3 useful functions: init, process and deInit.

The C++ API is defined here.

	import org.doubango.ultimateAlpr.Sdk.ULTCCARD_SDK_IMAGE_TYPE;
	import org.doubango.ultimateAlpr.Sdk.UltCreditCardSdkEngine;
	import org.doubango.ultimateAlpr.Sdk.UltCreditCardSdkResult;

	final static String CONFIG = "{" +
		"\"debug_level\": \"info\"," + 
		"\"gpgpu_enabled\": true," + 

		"\"detect_minscore\": 0.5," + 
		"\"detect_quantization_enabled\": true," + 

		"\"recogn_score_type\": \"min\"," + 
		"\"recogn_minscore\": 0.2," + 
		"\"recogn_rectify_enabled\": false," + 
		"\"recogn_quantization_enabled\": true" + 
	"}";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Initialize the engine
		assert UltCreditCardSdkEngine.init(
				getAssets(),
				CONFIG
		).isOK();
	}

	// Camera listener: https://developer.android.com/reference/android/media/ImageReader.OnImageAvailableListener
	final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() {

		@Override
		public void onImageAvailable(ImageReader reader) {
				try {
				    final Image image = reader.acquireLatestImage();
				    if (image == null) {
				        return;
				    }

				    // Credit card detection and recognition
				    final Image.Plane[] planes = image.getPlanes();
				    final UltCreditCardSdkResult result = UltCreditCardSdkEngine.process(
				        ULTCCARD_SDK_IMAGE_TYPE.ULTCCARD_SDK_IMAGE_TYPE_YUV420P,
				        planes[0].getBuffer(),
				        planes[1].getBuffer(),
				        planes[2].getBuffer(),
				        image.getWidth(),
				        image.getHeight(),
				        planes[0].getRowStride(),
				        planes[1].getRowStride(),
				        planes[2].getRowStride(),
				        planes[1].getPixelStride()
				    );
				    assert result.isOK();

				    // The result contains JSON string to parse in order to get recognitions
				    // result.json();

				    image.close();

				} catch (final Exception e) {
				   e.printStackTrace();
				}
		}
	};

	@Override
	public void onDestroy() {
		// DeInitialize the engine
		assert UltCreditCardSdkEngine.deInit().isOK();

		super.onDestroy();
	}

Again, please check the sample applications for Android and Raspberry Pi and full documentation for more information.

Raspberry Pi (Raspbian OS), Linux, Windows and others

Sample applications (Others)

The source code comes with #2 C++ sample applications: Benchmark and Recognizer. These sample applications can be used on all supported platforms: Android, Windows, Raspberry pi, iOS, OSX, Linux...

Benchmark (Others)

This application is used to check everything is ok and running as fast as expected. The information about the maximum frame rate could be checked using this application. It's open source and doesn't require registration or license key.

For more information on how to build and run this sample please check samples/c++/benchmark.

Recognizer (Others)

This is a command line application used to detect and recognize a license plate from any JPEG/PNG/BMP image.

For more information on how to build and run this sample please check samples/c++/recognizer.

Using the C++ API

The C++ API is defined at https://www.doubango.org/SDKs/credit-card-ocr/docs/cpp-api.html.

	#include <ultimateCreditCard-SDK-API-PUBLIC.h> // Include the API header file

	// JSON configuration string
	// More info at https://www.doubango.org/SDKs/credit-card-ocr/docs/Configuration_options.html
	static const char* __jsonConfig =
	"{"
	"\"debug_level\": \"info\","
	"\"debug_write_input_image_enabled\": false,"
	"\"debug_internal_data_path\": \".\","
	""
	"\"num_threads\": -1,"
	"\"gpgpu_enabled\": true,"
	""
	"\"detect_roi\": [0, 0, 0, 0],"
	"\"detect_minscore\": 0.5,"
	""
	"\"recogn_minscore\": 0.2,"
	"\"recogn_score_type\": \"min\""
	"}";

	// Local variable
	UltCreditCardSdkResult result;

	// Initialize the engine (should be done once)
	ULTCCARD_SDK_ASSERT((result = UltCreditCardSdkEngine::init(
		__jsonConfig
	)).isOK());

	// Processing (detection + recognition)
	// Call this function for every video frame
	const void* imageData = nullptr;
	ULTCCARD_SDK_ASSERT((*result_ = UltCreditCardSdkEngine::process(
			ULTCCARD_SDK_IMAGE_TYPE_RGB24,
			imageData,
			imageWidth,
			imageHeight
		)).isOK());

	// DeInit
	// Call this function before exiting the app to free the allocate resources
	// You must not call process() after calling this function
	ULTCCARD_SDK_ASSERT((result = UltCreditCardSdkEngine::deInit()).isOK());

Again, please check the sample applications for more information on how to use the API.

Technical questions

Please check our discussion group or twitter account

ultimatecreditcard-sdk's People

Contributors

doubangotelecom 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ultimatecreditcard-sdk's Issues

SDK for python

Hi, I didn't find some docs to build the binaries using python

Server recommendation for Android app

I would be having between 5000 to 20,000 simultaneous calls to the api from android app.
What server /cloud infrastructure do you recommend for these many calls.

Detection Bounding Box

Thanks for your repo first !
The online demo of credit card result seems very good. I'm interesting about your method. Is there any method to get the
text bounding box of detection result ? Thanks.

libtensorflow.so.1: cannot open shared object file: No such file or director

When running samples on python 3.7.9. Writes an error.

./run_linux_x64.sh Traceback (most recent call last): File "recognizer.py", line 24, in <module> import ultimateCreditCardSdk File "/home/joefox/Documents/00000001/ultimateCreditCard-SDK/python/ultimateCreditCardSdk.py", line 26, in <module> _ultimateCreditCardSdk = swig_import_helper() File "/home/joefox/Documents/00000001/ultimateCreditCard-SDK/python/ultimateCreditCardSdk.py", line 22, in swig_import_helper _mod = imp.load_module('_ultimateCreditCardSdk', fp, pathname, description) File "/home/joefox/.pyenv/versions/3.7.9/lib/python3.7/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/joefox/.pyenv/versions/3.7.9/lib/python3.7/imp.py", line 342, in load_dynamic return _load(spec) ImportError: libtensorflow.so.1: cannot open shared object file: No such file or directory

SDK for iOS is missing

Hi, i saw that this SDK support iOS, but i don't see any lib for iOS. Have some folder ios inside this project, but it don't have anything inside. So you guys drop iOS support?

Sample app failing in android studio

Sample app is failing to run with following error :
A/org.doubango.compv: ****[COMPV FATAL]: function: "newPtr()"
file: "..\source\ultimate_ocr_tensorflowlite_interpreter.cxx"
line: "514"
message: Assertion failed!
A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5490 (imateCreditCard), pid 5490 (imateCreditCard)

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.