From 9fceabc1f50569953ffb89b21599be00d77ca311 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 21 Jun 2021 19:19:03 +0200 Subject: [PATCH 1/2] Fix `img2label_paths()` order --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 93d6511ac658..32aec11311a5 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -348,7 +348,7 @@ def __len__(self): def img2label_paths(img_paths): # Define label paths as a function of image paths sa, sb = os.sep + 'images' + os.sep, os.sep + 'labels' + os.sep # /images/, /labels/ substrings - return ['txt'.join(x.replace(sa, sb, 1).rsplit(x.split('.')[-1], 1)) for x in img_paths] + return [sb.join(x.rsplit(sa, 1)).rsplit('.')[0] + '.txt' for x in img_paths] class LoadImagesAndLabels(Dataset): # for training/testing From ec999c63f1dbfcd1f05f875fd8d3b63ca0880f0f Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 21 Jun 2021 19:29:36 +0200 Subject: [PATCH 2/2] fix, 1 --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 32aec11311a5..25a7b2f67355 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -348,7 +348,7 @@ def __len__(self): def img2label_paths(img_paths): # Define label paths as a function of image paths sa, sb = os.sep + 'images' + os.sep, os.sep + 'labels' + os.sep # /images/, /labels/ substrings - return [sb.join(x.rsplit(sa, 1)).rsplit('.')[0] + '.txt' for x in img_paths] + return [sb.join(x.rsplit(sa, 1)).rsplit('.', 1)[0] + '.txt' for x in img_paths] class LoadImagesAndLabels(Dataset): # for training/testing