Handwritten Text and Signature Detection

Description

Object detection model trained to detect handwritten text one of the foremost architectures in the state-of-the-art, meticulously selected through benchmark evaluations and comparative analyses. Trained on an extensive and diverse dataset, this model has been finely tuned for precise handwritten text detection within documents. Its efficacy has been verified through rigorous testing, demonstrating exceptional performance in handwritten text detection across a spectrum of document formats.

Predicted Entities

Live Demo Open in Colab Copy S3 URI

How to use

binary_to_image = BinaryToImage() \
    .setImageType(ImageType.TYPE_3BYTE_BGR)

text_detector = ImageDocumentRegionDetector \
    .pretrained("image_handwritten_detector_jsl", "en", "clinical/ocr") \
    .setInputCol("image") \
    .setOutputCol("regions") \
    .setScoreThreshold(0.25)

draw_regions = ImageDrawRegions() \
    .setInputCol("image") \
    .setInputRegionsCol("regions") \
    .setOutputCol("image_with_regions") \
    .setFilledRect(False) \
    .setRectColor(Color.gray)

pipeline = PipelineModel(stages=[
    binary_to_image,
    text_detector,
    draw_regions
])

img_path = '/content/image_hw.jpeg'
image_df = spark.read.format("binaryFile").load(img_path).sort("path")

result = pipeline.transform(image_df)
val binary_to_image = BinaryToImage() 
    .setImageType(ImageType.TYPE_3BYTE_BGR)

val text_detector = ImageDocumentRegionDetector 
    .pretrained("image_handwritten_detector_jsl", "en", "clinical/ocr") 
    .setInputCol("image") 
    .setOutputCol("regions") 
    .setScoreThreshold(0.25)

val draw_regions = ImageDrawRegions() 
    .setInputCol("image") 
    .setInputRegionsCol("regions") 
    .setOutputCol("image_with_regions")
    .setFilledRect(False)
    .setRectColor(Color.gray)

val pipeline = new PipelineModel().setStages(Array(
    binary_to_image,
    text_detector,
    draw_regions))

val img_path = "/content/image_hw.jpeg"
val image_df = spark.read.format("binaryFile").load(img_path).sort("path")

val result = pipeline.transform(image_df)

Example

Input image

Screenshot

Output image

Screenshot

Model Information

Model Name: image_handwritten_detector_jsl
Type: ocr
Compatibility: Visual NLP 5.2.0+
License: Licensed
Edition: Official
Language: en