瀏覽代碼

use osp.basename() get filename,don't use split (#4278)

use split in windows can't run corret
fictionking 4 月之前
父節點
當前提交
ebb7453609
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      paddlex/modules/anomaly_detection/dataset_checker/dataset_src/convert_dataset.py

+ 2 - 2
paddlex/modules/anomaly_detection/dataset_checker/dataset_src/convert_dataset.py

@@ -100,9 +100,9 @@ def convert_labelme_dataset(input_dir):
                 if not os.path.exists(img_path):
                     logging.info("%s is not existed, skip this image" % img_path)
                     continue
-                img_name = img_path.split("/")[-1]
+                img_name = osp.basename(img_path)
                 img_file_list.append(f"images/{img_name}")
-                label_img_name = annotated_img_path.split("/")[-1]
+                label_img_name = osp.basename(annotated_img_path)
                 label_file_list.append(f"annotations/{label_img_name}")
 
                 img = np.asarray(cv2.imread(img_path))