check_file() update from yolov5

This commit is contained in:
Glenn Jocher
2020-06-15 12:25:48 -07:00
parent 936ac746ce
commit c78d49f190
4 changed files with 16 additions and 6 deletions
+10
View File
@@ -43,6 +43,16 @@ def check_git_status():
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n')
def check_file(file):
# Searches for file if not found locally
if os.path.isfile(file):
return file
else:
files = glob.glob('./**/' + file, recursive=True) # find file
assert len(files), 'File Not Found: %s' % file # assert file was found
return files[0] # return first file if multiple found
def load_classes(path):
# Loads *.names file at 'path'
with open(path, 'r') as f: