diff --git a/detect.py b/detect.py index 80e006251b69..d377f5e9c43e 100644 --- a/detect.py +++ b/detect.py @@ -97,7 +97,7 @@ def detect(save_img=False): # Print results for c in det[:, -1].unique(): n = (det[:, -1] == c).sum() # detections per class - s += f'{n} {names[int(c)]}s, ' # add to string + s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string # Write results for *xyxy, conf, cls in reversed(det): diff --git a/models/common.py b/models/common.py index 3bfdb3c7dc14..fba792e56022 100644 --- a/models/common.py +++ b/models/common.py @@ -248,7 +248,7 @@ def display(self, pprint=False, show=False, save=False, render=False): if pred is not None: for c in pred[:, -1].unique(): n = (pred[:, -1] == c).sum() # detections per class - str += f'{n} {self.names[int(c)]}s, ' # add to string + str += f"{n} {self.names[int(c)]}{'s' * (n > 1)}, " # add to string if show or save or render: img = Image.fromarray(img.astype(np.uint8)) if isinstance(img, np.ndarray) else img # from np for *box, conf, cls in pred: # xyxy, confidence, class diff --git a/utils/general.py b/utils/general.py index aa137ebde5ff..8421ba0c7ea7 100755 --- a/utils/general.py +++ b/utils/general.py @@ -70,7 +70,7 @@ def check_git_status(): branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind if n > 0: - s = f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. " \ + s = f"⚠️ WARNING: code is out of date by {n} commit{'s' * (n > 1)}. " \ f"Use 'git pull' to update or 'git clone {url}' to download latest." else: s = f'up to date with {url} ✅'