Fast and accurate text detection library built on PSENet implementation
Project description
PSENet: Shape Robust Text Detection with Progressive Scale Expansion Network
Packaged Version of the Pytorch implementation of PSENet text detector
Overview
PSENet is designed as a segmentation-based detector with multiple predictions for each text instance. These predictions correspond to different `kernels' produced by shrinking the original text instance into various scales. Consequently, the final detection can be conducted through our progressive scale expansion algorithm which gradually expands the kernels with minimal scales to the text instances with maximal and complete shapes.
Getting started
Installation
- Install using conda for Linux, Mac and Windows (preferred):
conda install -c fcakyon psenet-text-detector
- Install using pip for Linux and Mac:
pip install psenet-text-detector
Basic Usage
# import package
import psenet_text_detector as psenet
# set image path and export folder directory
image_path = 'figures/idcard.png'
output_dir = 'outputs/'
# apply craft text detection and export detected regions to output directory
prediction_result = psenet.detect_text(image_path, output_dir, cuda=False)
Advanced Usage
# import package
import psenet_text_detector as psenet
# set image path and export folder directory
image_path = 'figures/idcard.png'
output_dir = 'outputs/'
# read image
image = psenet.read_image(image_path)
# load model
psenet_model = psenet.load_psenet_model()
# perform prediction
prediction_result = psenet.get_prediction(image=image,
model=psenet_model,
binary_th=1.0,
kernel_num=3,
upsample_scale=1,
long_size=1280,
min_kernel_area=10.0,
min_area=300.0,
min_score=0.93,
cuda=True)
# export detected text regions
exported_file_paths = psenet.export_detected_regions(image_path,
image,
boxes=prediction_result["boxes"],
output_dir=output_dir)
# export box visualization
_ = psenet.visualize_detection(image_path,
image=image,
quads=prediction_result["boxes"],
output_dir=output_dir)
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
psenet-text-detector-0.1.1.tar.gz
(10.8 kB
view hashes)
Built Distribution
Close
Hashes for psenet-text-detector-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb60b4a470cef1e70a7605aaee2dd18ee9bf4666d5ee4c7ebeddc8db2f823e69 |
|
MD5 | 3b21e072625924a563445c7cd14f6f62 |
|
BLAKE2b-256 | 6dd0b98ac60cdda6333536cee41fd07b4adb0e7206ef0bc8c54087587e3ad04c |
Close
Hashes for psenet_text_detector-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e1d7a4cd7e129822ac64b4479435c9cf0d7ce062648d3c5c209e5302cbd9502 |
|
MD5 | 3bec9aaf7cb355e6bcfcf33014077d76 |
|
BLAKE2b-256 | 69c834d17eb93a202ee03e9d3506c58cfd875132e505091fe02f3a5fd176266b |