Skip to content

Commit

Permalink
Serialization of segmentation results in XML
Browse files Browse the repository at this point in the history
Fixes #597
  • Loading branch information
mittagessen committed May 10, 2024
1 parent 3899b49 commit fb773ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kraken/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def serialize(results: 'Segmentation',
# addition to bounding boxes
line = {'id': record.id,
'bbox': max_bbox([record.boundary]) if record.type == 'baselines' else record.bbox,
'cuts': [list(x) for x in record.cuts],
'confidences': record.confidences,
'cuts': [list(x) for x in getattr(record, 'cuts', [])],
'confidences': getattr(record, 'confidences', []),
'recognition': [],
'boundary': [list(x) for x in record.boundary] if record.type == 'baselines' else [[record.bbox[0], record.bbox[1]],
[record.bbox[2], record.bbox[1]],
Expand All @@ -179,7 +179,7 @@ def serialize(results: 'Segmentation',
if record.type == 'baselines':
line['baseline'] = [list(x) for x in record.baseline]

splits = regex.split(r'(\s+)', record.prediction)
splits = regex.split(r'(\s+)', getattr(record, 'prediction', ''))
line_offset = 0
logger.debug(f'Record contains {len(splits)} segments')
for segment in splits:
Expand Down

0 comments on commit fb773ea

Please sign in to comment.