sparkocr.utils.craft.predict#
Module Contents#
Functions#
|
|
- get_prediction(image, craft_net, refine_net=None, text_threshold: float = 0.7, link_threshold: float = 0.4, low_text: float = 0.4, cuda: bool = False, long_size: int = 1280, poly: bool = True)#
- Parameters:
image – path to the image to be processed or numpy array or PIL image
output_dir – path to the results to be exported
craft_net – craft net model
refine_net – refine net model
text_threshold – text confidence threshold
link_threshold – link confidence threshold
low_text – text low-bound score
cuda – Use cuda for inference
canvas_size – image size for inference
long_size – desired longest image size for inference
poly – enable polygon type
- Output:
- {“masks”: lists of predicted masks 2d as bool array,
“boxes”: list of coords of points of predicted boxes, “boxes_as_ratios”: list of coords of points of predicted boxes as ratios of image size, “polys_as_ratios”: list of coords of points of predicted polys as ratios of image size, “heatmaps”: visualizations of the detected characters/links, “times”: elapsed times of the sub modules, in seconds}