From fc5bb5e2328fca7be48f0d7e81ce83aea9cbc4f1 Mon Sep 17 00:00:00 2001 From: SunAhong1993 <48579383+SunAhong1993@users.noreply.github.com> Date: Tue, 17 Dec 2019 14:08:43 +0800 Subject: [PATCH] fix the cityscape bug when split dataset (#115) * Update x2coco.py to fix the cityscape bug when split dataset --- ppdet/data/tools/x2coco.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ppdet/data/tools/x2coco.py b/ppdet/data/tools/x2coco.py index 1fd840bd4..88ccb8548 100644 --- a/ppdet/data/tools/x2coco.py +++ b/ppdet/data/tools/x2coco.py @@ -26,6 +26,10 @@ import numpy as np import PIL.ImageDraw +label_to_num = {} +categories_list = [] +labels_list = [] + class MyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.integer): @@ -124,11 +128,8 @@ def get_bbox(height, width, points): def deal_json(ds_type, img_path, json_path): data_coco = {} - label_to_num = {} images_list = [] - categories_list = [] annotations_list = [] - labels_list = [] image_num = -1 object_num = -1 for img_file in os.listdir(img_path): -- GitLab