Checkbox Detection

Description

Object detection model trained to detect document checkboxes 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 document checkbox detection and classification within documents. Its efficacy has been verified through rigorous testing, demonstrating exceptional performance in document checkbox 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)

check_box_detector = ImageCheckBoxDetector \
    .pretrained("checkbox_detector_v1", "en", "clinical/ocr") \
    .setInputCol("image") \
    .setLabels(["No", "Yes"]) \
    .setOutputLabels(["No", "Yes"]) \
    .setScoreThreshold(0.1) \
    .setOutputCol("regions") \
    .setOutputFormat(DetectorOutputFormat.REGIONS)

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

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

imagePath = 'cboxes.png'
image_df = spark.read.format("binaryFile").load(imagePath).sort("path")

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

val check_box_detector = ImageCheckBoxDetector
    .pretrained("checkbox_detector_v1", "en", "clinical/ocr")
    .setInputCol("image") 
    .setLabels(Array("No", "Yes")) 
    .setOutputLabels(Array("No", "Yes")) 
    .setScoreThreshold(0.1) 
    .setOutputCol("regions") 
    .setOutputFormat(DetectorOutputFormat.REGIONS)

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

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

val imagePath = "cboxes.png"
val image_df = spark.read.format("binaryFile").load(imagePath).sort("path")

val result = pipeline.transform(image_df)

Example

Input:

Screenshot

Checkbox Detection:

Screenshot

Checkbox to text:

Screenshot

Model Information

Model Name: checkbox_detector_v1
Type: ocr
Compatibility: Visual NLP 5.1.2+
License: Licensed
Edition: Official
Language: en