glenn-jocher commited on
Commit
aac33f8
1 Parent(s): 85b75d6

Update inference multiple-counting (#2019)

Browse files

* Update inference multiple-counting

* update github check

Files changed (3) hide show
  1. detect.py +1 -1
  2. models/common.py +1 -1
  3. utils/general.py +1 -1
detect.py CHANGED
@@ -97,7 +97,7 @@ def detect(save_img=False):
97
  # Print results
98
  for c in det[:, -1].unique():
99
  n = (det[:, -1] == c).sum() # detections per class
100
- s += f'{n} {names[int(c)]}s, ' # add to string
101
 
102
  # Write results
103
  for *xyxy, conf, cls in reversed(det):
 
97
  # Print results
98
  for c in det[:, -1].unique():
99
  n = (det[:, -1] == c).sum() # detections per class
100
+ s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
101
 
102
  # Write results
103
  for *xyxy, conf, cls in reversed(det):
models/common.py CHANGED
@@ -248,7 +248,7 @@ class Detections:
248
  if pred is not None:
249
  for c in pred[:, -1].unique():
250
  n = (pred[:, -1] == c).sum() # detections per class
251
- str += f'{n} {self.names[int(c)]}s, ' # add to string
252
  if show or save or render:
253
  img = Image.fromarray(img.astype(np.uint8)) if isinstance(img, np.ndarray) else img # from np
254
  for *box, conf, cls in pred: # xyxy, confidence, class
 
248
  if pred is not None:
249
  for c in pred[:, -1].unique():
250
  n = (pred[:, -1] == c).sum() # detections per class
251
+ str += f"{n} {self.names[int(c)]}{'s' * (n > 1)}, " # add to string
252
  if show or save or render:
253
  img = Image.fromarray(img.astype(np.uint8)) if isinstance(img, np.ndarray) else img # from np
254
  for *box, conf, cls in pred: # xyxy, confidence, class
utils/general.py CHANGED
@@ -70,7 +70,7 @@ def check_git_status():
70
  branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current
71
  n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind
72
  if n > 0:
73
- s = f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. " \
74
  f"Use 'git pull' to update or 'git clone {url}' to download latest."
75
  else:
76
  s = f'up to date with {url} ✅'
 
70
  branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current
71
  n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind
72
  if n > 0:
73
+ s = f"⚠️ WARNING: code is out of date by {n} commit{'s' * (n > 1)}. " \
74
  f"Use 'git pull' to update or 'git clone {url}' to download latest."
75
  else:
76
  s = f'up to date with {url} ✅'