ultralytics 8.0.191 fix yolo checks for missing packages (#5179)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Rizwan Munawar <62513924+RizwanMunawar@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-10-02 22:45:30 +02:00 committed by GitHub
parent 9aaa5d5ed0
commit 525c8b0294
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 110 additions and 74 deletions

View file

@ -1,19 +1,16 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
import contextlib
from pathlib import Path
import pytest
import torch
from ultralytics import YOLO, download
from ultralytics.utils import ASSETS, SETTINGS
from ultralytics.utils import ASSETS, DATASETS_DIR, WEIGHTS_DIR
from ultralytics.utils.checks import cuda_device_count, cuda_is_available
CUDA_IS_AVAILABLE = cuda_is_available()
CUDA_DEVICE_COUNT = cuda_device_count()
DATASETS_DIR = Path(SETTINGS['datasets_dir'])
WEIGHTS_DIR = Path(SETTINGS['weights_dir'])
MODEL = WEIGHTS_DIR / 'path with spaces' / 'yolov8n.pt' # test spaces in path
DATA = 'coco8.yaml'
BUS = ASSETS / 'bus.jpg'
@ -91,7 +88,7 @@ def test_predict_sam():
model(ASSETS / 'zidane.jpg', points=[900, 370], labels=[1], device=0)
# Create SAMPredictor
overrides = dict(conf=0.25, task='segment', mode='predict', imgsz=1024, model='mobile_sam.pt')
overrides = dict(conf=0.25, task='segment', mode='predict', imgsz=1024, model=WEIGHTS_DIR / 'mobile_sam.pt')
predictor = SAMPredictor(overrides=overrides)
# Set image