From f16ee519ea116e00f38ade680391337af62168f6 Mon Sep 17 00:00:00 2001 From: SWHL Date: Wed, 24 Apr 2024 16:38:15 +0800 Subject: [PATCH] Fixed img path error when labelImg to yolov5 --- label_convert/labelImg_to_yolov5.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/label_convert/labelImg_to_yolov5.py b/label_convert/labelImg_to_yolov5.py index e9d68ab..c685a9a 100644 --- a/label_convert/labelImg_to_yolov5.py +++ b/label_convert/labelImg_to_yolov5.py @@ -90,7 +90,9 @@ def get_train_val_test_list( self, img_list, ratio=0.2, have_test=True, test_ratio=0.2 ): random.shuffle(img_list) - img_list = [f"{self.out_img_dir / img_path.name}" for img_path in img_list] + img_list = [ + f"{Path(self.out_img_dir.name) / img_path.name}" for img_path in img_list + ] len_img = len(img_list) if have_test: split_idx_first = int(len_img * ratio)