Dulu
Dulu is a small python library for doing OCR on image. Under the hood it uses florence model from microsoft, which is a state of the art vision model for many downstream tasks including OCR.
Installation
pip install dulu
Example Code
Here is a snippet of the code used in the notebook:
from dulu import OCR
from PIL import Image
# Load the image
image = Image.open("./sample_image.png")
image
# Initialize the OCR object
ocr = OCR()
# Recognize text without bounding boxes
text = ocr.recognize_text("./sample_image.png", bbox=False)
print(text)
# Recognize text with bounding boxes
text_with_bbox = ocr.recognize_text("./sample_image.png")
print(text_with_bbox)
List of models
| Model Id | Model size | Model Description |
|---|---|---|
| Florence-2-base | 0.23B | Pretrained model with FLD-5B |
| Florence-2-large | 0.77B | Pretrained model with FLD-5B |
| Florence-2-base-ft | 0.23B | Finetuned model on a collection of downstream tasks |
| Florence-2-large-ft | 0.77B | Finetuned model on a collection of downstream tasks |
By default we use Florence-2-base-ft model, you can over ride this with any other above in the list when
instantiating OCR(model_name="microsoft/{model_id})
Acknowledgments
Release files for dulu 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dulu-0.1.4.tar.gz | 292.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dulu-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 300.0 kB
Release files / dulu-0.1.4.tar.gz
| Download URL | dulu-0.1.4.tar.gz |
|---|---|
| Size | 292.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ab9289c32d19088b312cb3adf2dfb8a065fd5dedce80451290df99c13aa8dcc
|
|
BLAKE2b-256 checksum How to use checksums |
78d699a06f4403468ba9901028f5389ff7805cabead150053937e972aeed2e7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / dulu-0.1.4-py3-none-any.whl
| Download URL | dulu-0.1.4-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e81e6783bec204320cbe9be5bc344683b0394cc79dc3890fd28a155f413c7f2
|
|
BLAKE2b-256 checksum How to use checksums |
ab5e0aff1aae96ad8b4c2d9c18948a378808c671a6c301afcf5dd923d7c3f138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|