提交 9fa7f9f5 authored 作者: Glenn Jocher's avatar Glenn Jocher

f.read().strip()

上级 96a84468
...@@ -261,7 +261,7 @@ class LoadStreams: # multiple IP or RTSP cameras ...@@ -261,7 +261,7 @@ class LoadStreams: # multiple IP or RTSP cameras
if os.path.isfile(sources): if os.path.isfile(sources):
with open(sources, 'r') as f: 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: else:
sources = [sources] sources = [sources]
...@@ -353,7 +353,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing ...@@ -353,7 +353,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
f += glob.glob(str(p / '**' / '*.*'), recursive=True) f += glob.glob(str(p / '**' / '*.*'), recursive=True)
elif p.is_file(): # file elif p.is_file(): # file
with open(p, 'r') as t: with open(p, 'r') as t:
t = t.read().splitlines() t = t.read().strip().splitlines()
parent = str(p.parent) + os.sep parent = str(p.parent) + os.sep
f += [x.replace('./', parent) if x.startswith('./') else x for x in t] # local to global path f += [x.replace('./', parent) if x.startswith('./') else x for x in t] # local to global path
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论