ultralytics 8.0.97 confusion matrix, windows, docs updates (#2511)

Co-authored-by: Yonghye Kwon <developer.0hye@gmail.com>
Co-authored-by: Dowon <ks2515@naver.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-05-09 21:20:34 +02:00
committed by GitHub
parent 6ee3a9a74b
commit d1107ca4cb
138 changed files with 744 additions and 351 deletions

View File

@ -8,7 +8,6 @@ import platform
import re
import subprocess
import sys
import tempfile
import threading
import urllib
import uuid
@ -414,12 +413,7 @@ def is_dir_writeable(dir_path: Union[str, Path]) -> bool:
Returns:
bool: True if the directory is writeable, False otherwise.
"""
try:
with tempfile.TemporaryFile(dir=dir_path):
pass
return True
except OSError:
return False
return os.access(str(dir_path), os.W_OK)
def is_pytest_running():

View File

@ -49,7 +49,7 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
# Method 1
for n in range(2, 9999):
p = f'{path}{sep}{n}{suffix}' # increment path
p = f'{path}{sep}{str(n).zfill(4)}{suffix}' # increment path
if not os.path.exists(p): #
break
path = Path(p)

View File

@ -321,18 +321,17 @@ class ConfusionMatrix:
ticklabels = (list(names) + ['background']) if labels else 'auto'
with warnings.catch_warnings():
warnings.simplefilter('ignore') # suppress empty matrix RuntimeWarning: All-NaN slice encountered
sn.heatmap(
array,
ax=ax,
annot=nc < 30,
annot_kws={
'size': 8},
cmap='Blues',
fmt='.2f' if normalize else '%d', # float if normalize else integer
square=True,
vmin=0.0,
xticklabels=ticklabels,
yticklabels=ticklabels).set_facecolor((1, 1, 1))
sn.heatmap(array,
ax=ax,
annot=nc < 30,
annot_kws={
'size': 8},
cmap='Blues',
fmt='.2f' if normalize else '.0f',
square=True,
vmin=0.0,
xticklabels=ticklabels,
yticklabels=ticklabels).set_facecolor((1, 1, 1))
title = 'Confusion Matrix' + ' Normalized' * normalize
ax.set_xlabel('True')
ax.set_ylabel('Predicted')