ultralytics 8.2.23 New YouTube Shorts inference (#13150)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Erfan Zekri Esfahani <40582518+eze1376@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2024-05-27 22:35:45 +02:00 committed by GitHub
parent c371c953d5
commit 22de23ec8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 34 additions and 22 deletions

View file

@ -7,7 +7,6 @@ from pathlib import Path
import cv2
import numpy as np
import pytest
import requests
import torch
import yaml
from PIL import Image
@ -20,7 +19,6 @@ from ultralytics.utils import (
ASSETS,
DEFAULT_CFG,
DEFAULT_CFG_PATH,
LOGGER,
ONLINE,
ROOT,
WEIGHTS_DIR,
@ -135,15 +133,10 @@ def test_youtube():
"""
Test YouTube inference.
Note: YouTube connection errors frequently occur during this test due to
the nature of network instability or YouTube server availability issues.
These errors are caught and logged to avoid test failures caused by external factors.
Note: ConnectionError may occur during this test due to network instability or YouTube server availability.
"""
model = YOLO(MODEL)
try:
model.predict("https://youtu.be/G17sBkb38XQ", imgsz=96, save=True)
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError) as e:
LOGGER.warning(f"YouTube connection error: {e}")
model.predict("https://youtu.be/G17sBkb38XQ", imgsz=96, save=True)
@pytest.mark.skipif(not ONLINE, reason="environment is offline")