Skip to main content

Fast and accurate text detection library built on PSENet implementation

Project description

PyPI version CI

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.

teaser

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psenet_text_detector-0.1.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file psenet-text-detector-0.1.1.tar.gz.

File metadata

  • Download URL: psenet-text-detector-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for psenet-text-detector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fb60b4a470cef1e70a7605aaee2dd18ee9bf4666d5ee4c7ebeddc8db2f823e69
MD5 3b21e072625924a563445c7cd14f6f62
BLAKE2b-256 6dd0b98ac60cdda6333536cee41fd07b4adb0e7206ef0bc8c54087587e3ad04c

See more details on using hashes here.

File details

Details for the file psenet_text_detector-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: psenet_text_detector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for psenet_text_detector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e1d7a4cd7e129822ac64b4479435c9cf0d7ce062648d3c5c209e5302cbd9502
MD5 3bec9aaf7cb355e6bcfcf33014077d76
BLAKE2b-256 69c834d17eb93a202ee03e9d3506c58cfd875132e505091fe02f3a5fd176266b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page