提交 9cd0d1ee 编写于 作者: S SunAhong1993 提交者: qingqing01

fix the cityscape bug when split dataset (#116)

* Update x2coco.py to fix the cityscape bug when split dataset  
上级 b42cfe46
...@@ -26,6 +26,10 @@ import numpy as np ...@@ -26,6 +26,10 @@ import numpy as np
import PIL.ImageDraw import PIL.ImageDraw
label_to_num = {}
categories_list = []
labels_list = []
class MyEncoder(json.JSONEncoder): class MyEncoder(json.JSONEncoder):
def default(self, obj): def default(self, obj):
if isinstance(obj, np.integer): if isinstance(obj, np.integer):
...@@ -124,11 +128,8 @@ def get_bbox(height, width, points): ...@@ -124,11 +128,8 @@ def get_bbox(height, width, points):
def deal_json(ds_type, img_path, json_path): def deal_json(ds_type, img_path, json_path):
data_coco = {} data_coco = {}
label_to_num = {}
images_list = [] images_list = []
categories_list = []
annotations_list = [] annotations_list = []
labels_list = []
image_num = -1 image_num = -1
object_num = -1 object_num = -1
for img_file in os.listdir(img_path): for img_file in os.listdir(img_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册