MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / load_data

Method load_data

anyword_data.py:137–156  ·  view source on GitHub ↗
(self, json_path)

Source from the content-addressed store, hash-verified

135 return info
136
137 def load_data(self, json_path):
138 content = load_json(json_path)
139 data_list = content['data_list']
140 data_root = content['data_root']
141 d = []
142 for item in data_list:
143 if 'annotations' in item:
144 img_name = os.path.join(data_root, item['img_name'])
145 for annotation in item['annotations']:
146 if len(annotation['polygon']) == 0 or len(annotation['text']) < 1:
147 continue
148 if 'language' in annotation and self.language is not None and annotation['language'] != self.language:
149 continue
150 gt = {}
151 gt['img_name'] = img_name
152 gt['polygon'] = annotation['polygon']
153 gt['text'] = annotation['text']
154 d.append(gt)
155
156 return d
157
158 def draw_text(self, text, font_path="AlibabaPuHuiTi-3-85-Bold.ttf"):
159 R = self.ttf_size

Callers 1

__init__Method · 0.95

Calls 1

load_jsonFunction · 0.70

Tested by

no test coverage detected