ultralytics 8.3.65 Rockchip RKNN Integration for Ultralytics YOLO models (#16308)

Signed-off-by: Francesco Mattioli <Francesco.mttl@gmail.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Burhan <62214284+Burhan-Q@users.noreply.github.com>
Co-authored-by: Lakshantha Dissanayake <lakshantha@ultralytics.com>
Co-authored-by: Burhan <Burhan-Q@users.noreply.github.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
Co-authored-by: Lakshantha Dissanayake <lakshanthad@yahoo.com>
Co-authored-by: Francesco Mattioli <Francesco.mttl@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Ivor Zhu 2025-01-20 20:25:54 -05:00 committed by GitHub
parent 617dea8e25
commit b5e0cee943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 390 additions and 118 deletions

View file

@ -19,6 +19,7 @@ import requests
import torch
from ultralytics.utils import (
ARM64,
ASSETS,
AUTOINSTALL,
IS_COLAB,
@ -30,6 +31,7 @@ from ultralytics.utils import (
MACOS,
ONLINE,
PYTHON_VERSION,
RKNN_CHIPS,
ROOT,
TORCHVISION_VERSION,
USER_CONFIG_DIR,
@ -487,10 +489,10 @@ def check_yolov5u_filename(file: str, verbose: bool = True):
return file
def check_model_file_from_stem(model="yolov8n"):
def check_model_file_from_stem(model="yolo11n"):
"""Return a model filename from a valid model stem."""
if model and not Path(model).suffix and Path(model).stem in downloads.GITHUB_ASSETS_STEMS:
return Path(model).with_suffix(".pt") # add suffix, i.e. yolov8n -> yolov8n.pt
return Path(model).with_suffix(".pt") # add suffix, i.e. yolo11n -> yolo11n.pt
else:
return model
@ -782,6 +784,21 @@ def cuda_is_available() -> bool:
return cuda_device_count() > 0
def is_rockchip():
"""Check if the current environment is running on a Rockchip SoC."""
if LINUX and ARM64:
try:
with open("/proc/device-tree/compatible") as f:
dev_str = f.read()
*_, soc = dev_str.split(",")
if soc.replace("\x00", "") in RKNN_CHIPS:
return True
except OSError:
return False
else:
return False
def is_sudo_available() -> bool:
"""
Check if the sudo command is available in the environment.
@ -798,5 +815,7 @@ def is_sudo_available() -> bool:
# Run checks and define constants
check_python("3.8", hard=False, verbose=True) # check python version
check_torchvision() # check torch-torchvision compatibility
# Define constants
IS_PYTHON_MINIMUM_3_10 = check_python("3.10", hard=False)
IS_PYTHON_3_12 = PYTHON_VERSION.startswith("3.12")