diff --git a/kraken/rpred.py b/kraken/rpred.py index d41a11f67..179d9e872 100644 --- a/kraken/rpred.py +++ b/kraken/rpred.py @@ -285,8 +285,8 @@ def _recognize_baseline_line(self, line): pos = [] conf = [] for _, start, end, c in preds: - pos.append((self._scale_val(start, 0, self.box.size[0]), - self._scale_val(end, 0, self.box.size[0]))) + pos.append([self._scale_val(start, 0, self.box.size[0]), + self._scale_val(end, 0, self.box.size[0])]) conf.append(c) rec = BaselineOCRRecord(pred, pos, conf, line) if self.bidi_reordering: @@ -307,7 +307,7 @@ def __len__(self): def _scale_val(self, val, min_val, max_val): return int(round(min(max(((val*self.net_scale)-self.pad)*self.in_scale, min_val), max_val-1))) - + def _choose_legacy_polygon_extractor(self, net) -> bool: # grouping the checks here to display warnings only once if net.nn.use_legacy_polygons: diff --git a/kraken/serialization.py b/kraken/serialization.py index cb335a71b..b1e7ab9e8 100644 --- a/kraken/serialization.py +++ b/kraken/serialization.py @@ -165,7 +165,7 @@ 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': record.cuts, + 'cuts': [list(x) for x in record.cuts], 'confidences': record.confidences, 'recognition': [], 'boundary': [list(x) for x in record.boundary] if record.type == 'baselines' else [[record.bbox[0], record.bbox[1]],