in ocr/utils/iam_dataset.py [0:0]
def _get_output_data(self, item, height, width):
''' Function to obtain the output data (both text and bounding boxes).
Note that the bounding boxes are rescaled based on the rescale_ratio parameter.
Parameter
---------
item: xml.etree
XML object for a word/line/form.
height: int
Height of the form to calculate percentages of bounding boxes
width: int
Width of the form to calculate percentages of bounding boxes
Returns
-------
np.array
A numpy array ouf the output requested (text or the bounding box)
'''
output_data = []
if self._output_data == "text":
if self._parse_method in ["form", "form_bb", "form_original"]:
text = ""
for line in item.iter('line'):
text += line.attrib["text"] + "\n"
output_data.append(text)
else:
output_data.append(item.attrib['text'])
else:
for item_output in item.iter(self._output_parse_method):
bb = self._get_bb_of_item(item_output, height, width)
if bb == None: # Account for words with no letters
continue
output_data.append(bb)
output_data = np.array(output_data)
return output_data