|
@@ -14,13 +14,13 @@
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
|
from __future__ import absolute_import
|
|
|
import os.path as osp
|
|
import os.path as osp
|
|
|
-import platform
|
|
|
|
|
import random
|
|
import random
|
|
|
import copy
|
|
import copy
|
|
|
import json
|
|
import json
|
|
|
import cv2
|
|
import cv2
|
|
|
import numpy as np
|
|
import numpy as np
|
|
|
import paddlex.utils.logging as logging
|
|
import paddlex.utils.logging as logging
|
|
|
|
|
+from paddlex.utils import path_normalization
|
|
|
from .dataset import Dataset
|
|
from .dataset import Dataset
|
|
|
from .dataset import get_encoding
|
|
from .dataset import get_encoding
|
|
|
from .dataset import is_pic
|
|
from .dataset import is_pic
|
|
@@ -62,8 +62,6 @@ class EasyDataSeg(Dataset):
|
|
|
from pycocotools.mask import decode
|
|
from pycocotools.mask import decode
|
|
|
cname2cid = {}
|
|
cname2cid = {}
|
|
|
label_id = 0
|
|
label_id = 0
|
|
|
- win_sep = "\\"
|
|
|
|
|
- other_sep = "/"
|
|
|
|
|
with open(label_list, encoding=get_encoding(label_list)) as fr:
|
|
with open(label_list, encoding=get_encoding(label_list)) as fr:
|
|
|
for line in fr.readlines():
|
|
for line in fr.readlines():
|
|
|
cname2cid[line.strip()] = label_id
|
|
cname2cid[line.strip()] = label_id
|
|
@@ -74,12 +72,8 @@ class EasyDataSeg(Dataset):
|
|
|
for line in f:
|
|
for line in f:
|
|
|
img_file, json_file = [osp.join(data_dir, x) \
|
|
img_file, json_file = [osp.join(data_dir, x) \
|
|
|
for x in line.strip().split()[:2]]
|
|
for x in line.strip().split()[:2]]
|
|
|
- if platform.system() == "Windows":
|
|
|
|
|
- img_file = win_sep.join(img_file.split(other_sep))
|
|
|
|
|
- json_file = win_sep.join(json_file.split(other_sep))
|
|
|
|
|
- else:
|
|
|
|
|
- img_file = other_sep.join(img_file.split(win_sep))
|
|
|
|
|
- json_file = other_sep.join(json_file.split(win_sep))
|
|
|
|
|
|
|
+ img_file = path_normalization(img_file)
|
|
|
|
|
+ json_file = path_normalization(json_file)
|
|
|
if not is_pic(img_file):
|
|
if not is_pic(img_file):
|
|
|
continue
|
|
continue
|
|
|
if not osp.isfile(json_file):
|
|
if not osp.isfile(json_file):
|