Skip to main content

A boiler plate to make pip package for AI model

Project description

KALAPA OCR Package

This is a Package kalapaocr Model ONNX. The package will simply load onnx model and init an ocr engine. Give an image path and the engine will return text result.

Install Locally

After git clone, you can access the codebase and simply run the following command line:

conda create -n kalapa_env python=3.8
conda activate kalapa_env
pip install -e .

After installed, you can import kalapaocr package at anywhere when you are in kalapa_env environment

Download models

python src/kalapaocr/tool/model_downloads.py -p cached/

Basic Usage

After installing, You can view examples/sample.py to get usage of kalapaocr lib

You can run examples/sample.py file as following:

python example/sample.py -cnn cached/cnn.onnx -en cached/encoder.onnx -de cached/decoder.onnx -i 'image/test.jpg'

You can run examples/create_submission.py file as following for creating submission:

python example/create_submisson.py -cnn cached/cnn.onnx -en cached/encoder.onnx -de cached/decoder.onnx -i "your local data path/OCR/public_test" -o "your local path/your file name.csv"

Config TextRecognitor

You can initialize TextRecognitor from kalapaocr.

Let us show you:

from kalapaocr import TextRecognitor
# Using Deep Learning Models to Extract ocr results
predictor = TextRecognitor(
                        cnn_path="your cnn model path",
                        encoder_path="your encoder model path",
                        decoder_path="your decoder model path",
                    )
img = cv2.imread("your image path")
s = predictor(img)
print(s)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kalapaocr-0.0.6.tar.gz (154.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalapaocr-0.0.6-py3-none-any.whl (158.8 kB view details)

Uploaded Python 3

File details

Details for the file kalapaocr-0.0.6.tar.gz.

File metadata

  • Download URL: kalapaocr-0.0.6.tar.gz
  • Upload date:
  • Size: 154.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for kalapaocr-0.0.6.tar.gz
Algorithm Hash digest
SHA256 fc11c74920a7e7b2a5fe9c688eeaa2f2bfced05b18504acbd9ba675f8f3c8aff
MD5 4be8d304977e37c17fd2107f84d02a52
BLAKE2b-256 3a0e7d92a57f3b204594c7c82b541a7155b75d2300a2f9455b44b0cea039f942

See more details on using hashes here.

File details

Details for the file kalapaocr-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: kalapaocr-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 158.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for kalapaocr-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7b1d6e292939fe4c9918b1f95682d14c1438f477a5f5159ad982e77e3fc90611
MD5 e6cc9540a6094bb4e7746c309d745b6d
BLAKE2b-256 f63dd892c211455c6adefe823f68cde4bf9d2da46a2548c796d0026ea17681c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page