glenn-jocher commited on
Commit
8412d44
1 Parent(s): eae3330

update datasets.py to add detect.py --source glob_command feature

Browse files
Files changed (1) hide show
  1. utils/datasets.py +5 -3
utils/datasets.py CHANGED
@@ -70,10 +70,12 @@ class LoadImages: # for inference
70
  def __init__(self, path, img_size=640):
71
  p = str(Path(path)) # os-agnostic
72
  p = os.path.abspath(p) # absolute path
73
- if os.path.isdir(p):
74
- files = sorted(glob.glob(os.path.join(p, '*.*')))
 
 
75
  elif os.path.isfile(p):
76
- files = [p]
77
  else:
78
  raise Exception('ERROR: %s does not exist' % p)
79
 
 
70
  def __init__(self, path, img_size=640):
71
  p = str(Path(path)) # os-agnostic
72
  p = os.path.abspath(p) # absolute path
73
+ if '*' in p:
74
+ files = sorted(glob.glob(p)) # glob
75
+ elif os.path.isdir(p):
76
+ files = sorted(glob.glob(os.path.join(p, '*.*'))) # dir
77
  elif os.path.isfile(p):
78
+ files = [p] # files
79
  else:
80
  raise Exception('ERROR: %s does not exist' % p)
81