未验证 提交 5c4646d1 编写于 作者: J Jason 提交者: GitHub

Merge pull request #269 from biyuruofeng/paddlex-gu

格式转换中的几个错误
...@@ -147,7 +147,7 @@ class LabelMe2COCO(X2COCO): ...@@ -147,7 +147,7 @@ class LabelMe2COCO(X2COCO):
img_name_part = osp.splitext(img_file)[0] img_name_part = osp.splitext(img_file)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(osp.join(image_dir, img_file)) os.remove(osp.join(img_dir, img_file))
continue continue
image_id = image_id + 1 image_id = image_id + 1
with open(json_file, mode='r', \ with open(json_file, mode='r', \
...@@ -220,7 +220,7 @@ class EasyData2COCO(X2COCO): ...@@ -220,7 +220,7 @@ class EasyData2COCO(X2COCO):
img_name_part = osp.splitext(img_file)[0] img_name_part = osp.splitext(img_file)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(osp.join(image_dir, img_file)) os.remove(osp.join(img_dir, img_file))
continue continue
image_id = image_id + 1 image_id = image_id + 1
with open(json_file, mode='r', \ with open(json_file, mode='r', \
...@@ -317,7 +317,7 @@ class JingLing2COCO(X2COCO): ...@@ -317,7 +317,7 @@ class JingLing2COCO(X2COCO):
img_name_part = osp.splitext(img_file)[0] img_name_part = osp.splitext(img_file)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(osp.join(image_dir, img_file)) os.remove(osp.join(img_dir, img_file))
continue continue
image_id = image_id + 1 image_id = image_id + 1
with open(json_file, mode='r', \ with open(json_file, mode='r', \
......
...@@ -23,6 +23,7 @@ import shutil ...@@ -23,6 +23,7 @@ import shutil
import numpy as np import numpy as np
import PIL.Image import PIL.Image
from .base import MyEncoder, is_pic, get_encoding from .base import MyEncoder, is_pic, get_encoding
import math
class X2Seg(object): class X2Seg(object):
def __init__(self): def __init__(self):
...@@ -140,7 +141,7 @@ class JingLing2Seg(X2Seg): ...@@ -140,7 +141,7 @@ class JingLing2Seg(X2Seg):
img_name_part = osp.splitext(img_name)[0] img_name_part = osp.splitext(img_name)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(os.remove(osp.join(image_dir, img_name))) os.remove(osp.join(image_dir, img_name))
continue continue
with open(json_file, mode="r", \ with open(json_file, mode="r", \
encoding=get_encoding(json_file)) as j: encoding=get_encoding(json_file)) as j:
...@@ -226,7 +227,7 @@ class LabelMe2Seg(X2Seg): ...@@ -226,7 +227,7 @@ class LabelMe2Seg(X2Seg):
img_name_part = osp.splitext(img_name)[0] img_name_part = osp.splitext(img_name)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(os.remove(osp.join(image_dir, img_name))) os.remove(osp.join(image_dir, img_name))
continue continue
img_file = osp.join(image_dir, img_name) img_file = osp.join(image_dir, img_name)
img = np.asarray(PIL.Image.open(img_file)) img = np.asarray(PIL.Image.open(img_file))
...@@ -260,7 +261,7 @@ class EasyData2Seg(X2Seg): ...@@ -260,7 +261,7 @@ class EasyData2Seg(X2Seg):
img_name_part = osp.splitext(img_name)[0] img_name_part = osp.splitext(img_name)[0]
json_file = osp.join(json_dir, img_name_part + ".json") json_file = osp.join(json_dir, img_name_part + ".json")
if not osp.exists(json_file): if not osp.exists(json_file):
os.remove(os.remove(osp.join(image_dir, img_name))) os.remove(osp.join(image_dir, img_name))
continue continue
with open(json_file, mode="r", \ with open(json_file, mode="r", \
encoding=get_encoding(json_file)) as j: encoding=get_encoding(json_file)) as j:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册