From 9cd0d1ee60d9f91c22f11fbae7ffbee20bba0993 Mon Sep 17 00:00:00 2001 From: SunAhong1993 <48579383+SunAhong1993@users.noreply.github.com> Date: Tue, 17 Dec 2019 14:08:16 +0800 Subject: [PATCH] fix the cityscape bug when split dataset (#116) * 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 5e4e5d46e..4d743c926 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