A modern version of CRAFT-pytorch using the latest versions
Project description
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 modern-craft
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.pth
andcraft_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.
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
File details
Details for the file mcraft-0.0.1.tar.gz
.
File metadata
- Download URL: mcraft-0.0.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b2ca230ffb5db62b37dbe194cfc45c62382cf816c23cd70cadb44bc8616628b |
|
MD5 | 060f5513524382a2be7facac45fb4a87 |
|
BLAKE2b-256 | 7fabe407f95c4c4102747618a759064d4f49b2b2d077244d7df182aa57257d56 |
File details
Details for the file mcraft-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: mcraft-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70b458b37413c36d95b87c097e083326265db4765063657f1f8dcb1841dc9670 |
|
MD5 | 9fdf0ec1fa21b6fa95b0bd8076c843b0 |
|
BLAKE2b-256 | e735691cf215c147a0e9fe312bff63d6109020f2281d775f92bc2fcb537efae3 |