is_docker() fix for `show=True` predict bug (#218)

Co-authored-by: Hardik Dava <39372750+hardikdava@users.noreply.github.com>
Co-authored-by: Onuralp Sezer <thunderbirdtr@fedoraproject.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pull/249/head
Glenn Jocher 2 years ago committed by GitHub
parent 7f9d7142c2
commit 88c9418087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ultralytics/__init__.py
  2. 3
      ultralytics/yolo/engine/predictor.py
  3. 6
      ultralytics/yolo/utils/__init__.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, GPL-3.0 license # Ultralytics YOLO 🚀, GPL-3.0 license
__version__ = "8.0.2" __version__ = "8.0.3"
from ultralytics.hub import checks from ultralytics.hub import checks
from ultralytics.yolo.engine.model import YOLO from ultralytics.yolo.engine.model import YOLO

@ -124,9 +124,8 @@ class BasePredictor:
# Dataloader # Dataloader
bs = 1 # batch_size bs = 1 # batch_size
if self.args.show:
self.args.show = check_imshow(warn=True)
if webcam: if webcam:
self.args.show = check_imshow(warn=True)
self.dataset = LoadStreams(source, self.dataset = LoadStreams(source,
imgsz=imgsz, imgsz=imgsz,
stride=stride, stride=stride,

@ -119,8 +119,12 @@ def is_docker() -> bool:
Returns: Returns:
bool: True if the script is running inside a Docker container, False otherwise. bool: True if the script is running inside a Docker container, False otherwise.
""" """
with open('/proc/self/cgroup') as f: file = Path('/proc/self/cgroup')
if file.exists():
with open(file) as f:
return 'docker' in f.read() return 'docker' in f.read()
else:
return False
def is_git_directory() -> bool: def is_git_directory() -> bool:

Loading…
Cancel
Save