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

Update inference multiple-counting (#2019)

* Update inference multiple-counting * update github check
上级 85b75d60
...@@ -97,7 +97,7 @@ def detect(save_img=False): ...@@ -97,7 +97,7 @@ def detect(save_img=False):
# Print results # Print results
for c in det[:, -1].unique(): for c in det[:, -1].unique():
n = (det[:, -1] == c).sum() # detections per class 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 # Write results
for *xyxy, conf, cls in reversed(det): for *xyxy, conf, cls in reversed(det):
......
...@@ -248,7 +248,7 @@ class Detections: ...@@ -248,7 +248,7 @@ class Detections:
if pred is not None: if pred is not None:
for c in pred[:, -1].unique(): for c in pred[:, -1].unique():
n = (pred[:, -1] == c).sum() # detections per class 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: if show or save or render:
img = Image.fromarray(img.astype(np.uint8)) if isinstance(img, np.ndarray) else img # from np 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 for *box, conf, cls in pred: # xyxy, confidence, class
......
...@@ -70,7 +70,7 @@ def check_git_status(): ...@@ -70,7 +70,7 @@ def check_git_status():
branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current 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 n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind
if n > 0: 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." f"Use 'git pull' to update or 'git clone {url}' to download latest."
else: else:
s = f'up to date with {url} ✅' s = f'up to date with {url} ✅'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论