浏览代码

Fix `check_suffix()` (#4712)

Fix a bug when `file=''`
modifyDataloader
Glenn Jocher GitHub 3 年前
父节点
当前提交
f984cce52a
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      utils/general.py

+ 2
- 2
utils/general.py 查看文件

@@ -244,7 +244,7 @@ def check_imshow():

def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
# Check file(s) for acceptable suffixes
if any(suffix):
if file and suffix:
if isinstance(suffix, str):
suffix = [suffix]
for f in file if isinstance(file, (list, tuple)) else [file]:
@@ -258,7 +258,7 @@ def check_yaml(file, suffix=('.yaml', '.yml')):

def check_file(file, suffix=''):
# Search/download file (if necessary) and return path
check_suffix(file, suffix)
check_suffix(file, suffix) # optional
file = str(file) # convert to str()
if Path(file).is_file() or file == '': # exists
return file

正在加载...
取消
保存