OCR Single Output
OCR Output used to gather information about the output of any OCR model
OcrSingleOutput
Class for keeping track of ONLY ONE OCR extracted information from an image
Source code in otary/vision/ocr/ocr_single_output.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
succeeded
property
Check if an OCR extraction has been possible
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
if True, and OCR extraction has been possible and thus we have attached to this object a valid bounding box. If False, no OCR extraction was possible and no bounding box is available. |
__init__(bbox, text=None, confidence=None, objectness=None)
Initialize an OcrSingleOutput object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
Rectangle
|
bounding boxes |
required |
text
|
Optional[str]
|
text extracted by OCR within the bounding box. It can be None if no text was extracted. Imagine only using this after a simple text detection model. No text recognition model. In that case, we would have only the bounding box and no text. Defaults to None. |
None
|
confidence
|
Optional[float]
|
text confidence score. Defaults to None. |
None
|
objectness
|
Optional[float]
|
bounding box objectness score. which can be seen as the bounding box confidence score. Defaults to None. |
None
|
Source code in otary/vision/ocr/ocr_single_output.py
contains_regex(regex)
Check if OCR single output text contains the regex pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regex
|
str
|
regex to search in the OCR single output text. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True or False |
Source code in otary/vision/ocr/ocr_single_output.py
contains_string(string, cond='any')
Check if the OCR single output contains a given string or list of strings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
list[str] | str
|
list of strings to be found in the OCR single output text. Can be a single string or a list of strings. |
required |
cond
|
str
|
condition. Must be in [any, all]. If any, the method returns true if any of the strings is in the OCR single output text. If all, returns true only if all strings values are found in OCR single output text. Defaults to "any". |
'any'
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if text contains strings. |
Source code in otary/vision/ocr/ocr_single_output.py
copy()
Return a copy of the OcrSingleOutput object.
Returns:
| Name | Type | Description |
|---|---|---|
OcrSingleOutput |
OcrSingleOutput
|
a copy of the current OcrSingleOutput object. |
Source code in otary/vision/ocr/ocr_single_output.py
is_complete(with_bbox=True)
Check whether this OcrSingleOutput object is complete or not. Complete means that it is valid with no inappropriate values whatsoever.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
with_bbox
|
bool
|
Whether to consider the bounding boxes or not. If False, we just verify if the text and confidence are ok. Defaults to False. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
if True the MultiVectorExtract object is complete without any inappropriate values. |