|
|
@@ -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:
|