Fix yolo checks as a package bug in Colab (#972)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sergio Sanchez <sergio.ssm.97@gmail.com>
This commit is contained in:
Glenn Jocher
2023-02-14 19:53:51 +04:00
committed by GitHub
parent bdc6cd4d8b
commit 1ad7e79033
12 changed files with 72 additions and 30 deletions

View File

@ -1,5 +1,6 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import platform
from pathlib import Path
import cv2
@ -14,6 +15,7 @@ from ultralytics.yolo.utils import ROOT, SETTINGS
MODEL = Path(SETTINGS['weights_dir']) / 'yolov8n.pt'
CFG = 'yolov8n.yaml'
SOURCE = ROOT / 'assets/bus.jpg'
MACOS = platform.system() == 'Darwin' # macOS environment
def test_model_forward():
@ -120,10 +122,11 @@ def test_export_openvino():
YOLO(f)(SOURCE) # exported model inference
def test_export_coreml():
def test_export_coreml(): # sourcery skip: move-assign
model = YOLO(MODEL)
model.export(format='coreml')
# YOLO(f)(SOURCE) # model prediction only supported on macOS
f = model.export(format='coreml')
if MACOS:
YOLO(f)(SOURCE) # model prediction only supported on macOS
def test_export_paddle(enabled=False):