ultralytics 8.3.57 Support is_jetson() and is_raspberrypi() in Docker images (#18449)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
This commit is contained in:
parent
1f1f355a9e
commit
7e4416f64f
2 changed files with 6 additions and 10 deletions
|
|
@ -524,13 +524,9 @@ def read_device_model() -> str:
|
|||
is_raspberrypi().
|
||||
|
||||
Returns:
|
||||
(str): Model file contents if read successfully or empty string otherwise.
|
||||
(str): Kernel release information.
|
||||
"""
|
||||
try:
|
||||
with open("/proc/device-tree/model") as f:
|
||||
return f.read()
|
||||
except Exception:
|
||||
return ""
|
||||
return platform.release().lower()
|
||||
|
||||
|
||||
def is_ubuntu() -> bool:
|
||||
|
|
@ -602,7 +598,7 @@ def is_raspberrypi() -> bool:
|
|||
Returns:
|
||||
(bool): True if running on a Raspberry Pi, False otherwise.
|
||||
"""
|
||||
return "Raspberry Pi" in PROC_DEVICE_MODEL
|
||||
return "rpi" in DEVICE_MODEL
|
||||
|
||||
|
||||
def is_jetson() -> bool:
|
||||
|
|
@ -612,7 +608,7 @@ def is_jetson() -> bool:
|
|||
Returns:
|
||||
(bool): True if running on an NVIDIA Jetson device, False otherwise.
|
||||
"""
|
||||
return any(keyword in PROC_DEVICE_MODEL.lower() for keyword in ("nvidia", "jetson"))
|
||||
return "tegra" in DEVICE_MODEL
|
||||
|
||||
|
||||
def is_online() -> bool:
|
||||
|
|
@ -802,7 +798,7 @@ def get_user_config_dir(sub_dir="Ultralytics"):
|
|||
|
||||
|
||||
# Define constants (required below)
|
||||
PROC_DEVICE_MODEL = read_device_model() # is_jetson() and is_raspberrypi() depend on this constant
|
||||
DEVICE_MODEL = read_device_model() # is_jetson() and is_raspberrypi() depend on this constant
|
||||
ONLINE = is_online()
|
||||
IS_COLAB = is_colab()
|
||||
IS_KAGGLE = is_kaggle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue