Fix `increment_path()` with periods (#5518)
Browse filesFix for https://github.com/ultralytics/yolov5/issues/5503
```
python detect.py --visualize --source path/to/file.suffix1.jpg
```
- utils/general.py +2 -3
utils/general.py
CHANGED
@@ -837,7 +837,6 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
|
|
837 |
i = [int(m.groups()[0]) for m in matches if m] # indices
|
838 |
n = max(i) + 1 if i else 2 # increment number
|
839 |
path = Path(f"{path}{sep}{n}{suffix}") # update path
|
840 |
-
|
841 |
-
|
842 |
-
dir.mkdir(parents=True, exist_ok=True) # make directory
|
843 |
return path
|
|
|
837 |
i = [int(m.groups()[0]) for m in matches if m] # indices
|
838 |
n = max(i) + 1 if i else 2 # increment number
|
839 |
path = Path(f"{path}{sep}{n}{suffix}") # update path
|
840 |
+
if mkdir:
|
841 |
+
path.mkdir(parents=True, exist_ok=True) # make directory
|
|
|
842 |
return path
|