add shell
Showing
2 changed files
with
11 additions
and
16 deletions
... | @@ -60,8 +60,6 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save | ... | @@ -60,8 +60,6 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save |
60 | # else: | 60 | # else: |
61 | # os.makedirs(save_dir, exist_ok=True) | 61 | # os.makedirs(save_dir, exist_ok=True) |
62 | 62 | ||
63 | count = 0 | ||
64 | un_count = 0 | ||
65 | top_text_count = len(top_text_list) | 63 | top_text_count = len(top_text_list) |
66 | for img_name in sorted(os.listdir(img_dir)): | 64 | for img_name in sorted(os.listdir(img_dir)): |
67 | if img_name in skip_list: | 65 | if img_name in skip_list: |
... | @@ -153,22 +151,18 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save | ... | @@ -153,22 +151,18 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save |
153 | 151 | ||
154 | input_label = copy.deepcopy(src_label_list) | 152 | input_label = copy.deepcopy(src_label_list) |
155 | input_label[idx] = 1 | 153 | input_label[idx] = 1 |
156 | # with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, find_go_key)))), 'w') as fp: | 154 | with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, find_go_key)))), 'w') as fp: |
157 | # json.dump([input_list, input_label], fp) | 155 | json.dump([input_list, input_label], fp) |
158 | count += 1 | ||
159 | 156 | ||
160 | for go_key, ((x0, y0, x1, y1, x2, y2, x3, y3), _) in go_res.items(): | 157 | # for go_key, ((x0, y0, x1, y1, x2, y2, x3, y3), _) in go_res.items(): |
161 | if go_key in go_key_set: | 158 | # if go_key in go_key_set: |
162 | continue | 159 | # continue |
163 | input_list = copy.deepcopy(input_key_list) | 160 | # input_list = copy.deepcopy(input_key_list) |
164 | input_list.append([x0/w, y0/h, x1/w, y1/h, x2/w, y2/h, x3/w, y3/h]) | 161 | # input_list.append([x0/w, y0/h, x1/w, y1/h, x2/w, y2/h, x3/w, y3/h]) |
165 | # with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, go_key)))), 'w') as fp: | 162 | # with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, go_key)))), 'w') as fp: |
166 | # json.dump([input_list, src_label_list], fp) | 163 | # json.dump([input_list, src_label_list], fp) |
167 | un_count += 1 | ||
168 | 164 | ||
169 | # break | 165 | # break |
170 | print(count) | ||
171 | print(un_count) | ||
172 | 166 | ||
173 | 167 | ||
174 | if __name__ == '__main__': | 168 | if __name__ == '__main__': |
... | @@ -246,7 +240,7 @@ if __name__ == '__main__': | ... | @@ -246,7 +240,7 @@ if __name__ == '__main__': |
246 | 240 | ||
247 | # build_dataset(train_image_path, train_go_path, train_label_path, filter_from_top_text_list, skip_list_train, train_dataset_dir) | 241 | # build_dataset(train_image_path, train_go_path, train_label_path, filter_from_top_text_list, skip_list_train, train_dataset_dir) |
248 | 242 | ||
249 | build_dataset(valid_image_path, valid_go_path, valid_label_path, filter_from_top_text_list, skip_list_valid, valid_dataset_dir) | 243 | # build_dataset(valid_image_path, valid_go_path, valid_label_path, filter_from_top_text_list, skip_list_valid, valid_dataset_dir) |
250 | 244 | ||
251 | # build_anno_file(train_dataset_dir, train_anno_file_path) | 245 | # build_anno_file(train_dataset_dir, train_anno_file_path) |
252 | # build_anno_file(valid_dataset_dir, valid_anno_file_path) | 246 | # build_anno_file(valid_dataset_dir, valid_anno_file_path) | ... | ... |
-
Please register or sign in to post a comment