From 6024fc9f39a9766eb08e92c52ca17801cebf4014 Mon Sep 17 00:00:00 2001 From: Double_V Date: Thu, 12 May 2022 16:14:08 +0800 Subject: [PATCH] Update label_ops.py --- ppocr/data/imaug/label_ops.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index c9bc2e77..8b017b32 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -438,7 +438,12 @@ class KieLabelEncode(object): texts.append(ann['transcription']) text_ind = [self.dict[c] for c in text if c in self.dict] text_inds.append(text_ind) - labels.append(ann['label']) + if 'label' in ann.keys(): + labels.append(ann['label']) + elif 'key_cls' in ann.keys(): + labels.append(ann['key_cls']) + else: + raise ValueError("Cannot found 'key_cls' in ann.keys(), please check your training annotation.") edges.append(ann.get('edge', 0)) ann_infos = dict( image=data['image'], -- GitLab