Browse Source

Fix labels being missed when image extension appears twice in filename (#2300)

5.0
Iden Craven GitHub 3 years ago
parent
commit
a82dce7faa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      utils/datasets.py

+ 1
- 1
utils/datasets.py View File

@@ -335,7 +335,7 @@ class LoadStreams: # multiple IP or RTSP cameras
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 [x.replace(sa, sb, 1).replace('.' + x.split('.')[-1], '.txt') for x in img_paths]
return ['txt'.join(x.replace(sa, sb, 1).rsplit(x.split('.')[-1], 1)) for x in img_paths]


class LoadImagesAndLabels(Dataset): # for training/testing

Loading…
Cancel
Save