Modern CRAFT Library
Overview
This Python library provides an interface for using the CRAFT (Character Region Awareness For Text Detection) algorithm for text detection in images. The library is based on the CRAFT implementation in Python.
This is an adaptation of the CRAFT-python library allowing for use on modern packages (pytorch 2 > opencv-python > 3.4).
ToDo
This library will need refactoring with respect to performance as the previous library introduced unneeded overhead.
Requirements
- Python 3.x
- PyTorch
- OpenCV
- NumPy
Installation
You can install the library via pip:
pip install mcraft
Usage
from mcraft import TNet
# Load an image
image_path = "path/to/your/image.jpg"
# Initialize the network
tnet = TNet() # Adjust parameters as needed
# Run a test
tnet.test(image_path)
# Perform text detection
tnet.test(image_path)
# After running test, the result will be saved as "res_image_mask.jpg" in the same directory as the input image
Features
- Text detection in images produced as heat-maps bounding boxes and per-character polygons.
- Adjustable parameters such as text threshold, link threshold, etc.
Important Notes
- Preexisting or hand compiled instances of opencv, pytorch, and torchvision will not be replaced during setup.
- The necessary model files (
craft_mlt_25k.pthandcraft_refiner_CTW1500.pth) will be downloaded to ~/.cache/mcraft. - GPU operations, whilst implemented, remain untested until I get back from abroad and regain access to my compute systems.
- Official CRAFT PyTorch repository
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for mcraft 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcraft-0.0.3.tar.gz | 13.1 kB | Without provenance | Details for mcraft-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcraft-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for mcraft-0.0.3-py3-none-any.whl |
Total release size: 27.4 kB
Release files / mcraft-0.0.3.tar.gz
| Download URL | mcraft-0.0.3.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1300ae8a18bef54af6faab8ae2108105600bf7fd0e128212724d68c6f039463e
|
|
BLAKE2b-256 checksum How to use checksums |
7c67e102c4c9d54f75dd901de6ef2a4497bd3da4e9b549d4d50b464257d28b38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / mcraft-0.0.3-py3-none-any.whl
| Download URL | mcraft-0.0.3-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d73abd1291b7f207bfe6c09ce341158cab289d9417470e350e41d952f297c544
|
|
BLAKE2b-256 checksum How to use checksums |
ff3e0b085d106285f766ed2b4f2d8d856e726c85e28070fbcfd99f4891b50459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for mcraft 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.