Ver Fonte

格式转换中的几个错误

guchenliang há 5 anos atrás
pai
commit
a3c36b82da
2 ficheiros alterados com 7 adições e 6 exclusões
  1. 3 3
      paddlex/tools/x2coco.py
  2. 4 3
      paddlex/tools/x2seg.py

+ 3 - 3
paddlex/tools/x2coco.py

@@ -147,7 +147,7 @@ class LabelMe2COCO(X2COCO):
             img_name_part = osp.splitext(img_file)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             if not osp.exists(json_file):
-                os.remove(osp.join(image_dir, img_file))
+                os.remove(osp.join(img_dir, img_file))
                 continue
             image_id = image_id + 1
             with open(json_file, mode='r', \
@@ -220,7 +220,7 @@ class EasyData2COCO(X2COCO):
             img_name_part = osp.splitext(img_file)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             if not osp.exists(json_file):
-                os.remove(osp.join(image_dir, img_file))
+                os.remove(osp.join(img_dir, img_file))
                 continue
             image_id = image_id + 1
             with open(json_file, mode='r', \
@@ -317,7 +317,7 @@ class JingLing2COCO(X2COCO):
             img_name_part = osp.splitext(img_file)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             if not osp.exists(json_file):
-                os.remove(osp.join(image_dir, img_file))
+                os.remove(osp.join(img_dir, img_file))
                 continue
             image_id = image_id + 1
             with open(json_file, mode='r', \

+ 4 - 3
paddlex/tools/x2seg.py

@@ -23,6 +23,7 @@ import shutil
 import numpy as np
 import PIL.Image
 from .base import MyEncoder, is_pic, get_encoding
+import math
 
 class X2Seg(object):
     def __init__(self):
@@ -140,7 +141,7 @@ class JingLing2Seg(X2Seg):
             img_name_part = osp.splitext(img_name)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             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
             with open(json_file, mode="r", \
                               encoding=get_encoding(json_file)) as j:
@@ -226,7 +227,7 @@ class LabelMe2Seg(X2Seg):
             img_name_part = osp.splitext(img_name)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             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
             img_file = osp.join(image_dir, img_name)
             img = np.asarray(PIL.Image.open(img_file))
@@ -260,7 +261,7 @@ class EasyData2Seg(X2Seg):
             img_name_part = osp.splitext(img_name)[0]
             json_file = osp.join(json_dir, img_name_part + ".json")
             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
             with open(json_file, mode="r", \
                               encoding=get_encoding(json_file)) as j: