From 9fa7f9f598359fb5aad4f0503b58f6d25c94846b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 29 Nov 2020 11:58:14 +0100 Subject: [PATCH] f.read().strip() --- utils/datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index cd6151e..3438a2b 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -261,7 +261,7 @@ class LoadStreams: # multiple IP or RTSP cameras if os.path.isfile(sources): with open(sources, 'r') as f: - sources = [x.strip() for x in f.read().splitlines() if len(x.strip())] + sources = [x.strip() for x in f.read().strip().splitlines() if len(x.strip())] else: sources = [sources] @@ -353,7 +353,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing f += glob.glob(str(p / '**' / '*.*'), recursive=True) elif p.is_file(): # file with open(p, 'r') as t: - t = t.read().splitlines() + t = t.read().strip().splitlines() parent = str(p.parent) + os.sep f += [x.replace('./', parent) if x.startswith('./') else x for x in t] # local to global path else: