Unverified 提交 17b5f5b9 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Fix `increment_path()` with periods (#5518)

Fix for https://github.com/ultralytics/yolov5/issues/5503 ``` python detect.py --visualize --source path/to/file.suffix1.jpg ```
上级 01555483
......@@ -837,7 +837,6 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
i = [int(m.groups()[0]) for m in matches if m] # indices
n = max(i) + 1 if i else 2 # increment number
path = Path(f"{path}{sep}{n}{suffix}") # update path
dir = path if path.suffix == '' else path.parent # directory
if not dir.exists() and mkdir:
dir.mkdir(parents=True, exist_ok=True) # make directory
if mkdir:
path.mkdir(parents=True, exist_ok=True) # make directory
return path
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论