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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for kalapaocr-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1d6e292939fe4c9918b1f95682d14c1438f477a5f5159ad982e77e3fc90611 |
|
MD5 | e6cc9540a6094bb4e7746c309d745b6d |
|
BLAKE2b-256 | f63dd892c211455c6adefe823f68cde4bf9d2da46a2548c796d0026ea17681c5 |