跳至内容

参考资料 ultralytics/utils/errors.py

备注

该文件可在https://github.com/ultralytics/ultralytics/blob/main/ ultralytics/utils/errors .py。如果您发现问题,请通过提交 Pull Request🛠️ 帮助修复。谢谢🙏!



ultralytics.utils.errors.HUBModelError

Bases: Exception

自定义异常类,用于处理Ultralytics YOLO 中与模型获取相关的错误。

当所请求的模型未找到或无法检索时,就会引发该异常。 为获得更好的用户体验,还会对信息进行处理,使其包含表情符号。

属性

名称 类型 说明
message str

异常发生时显示的错误信息。

备注

ultralytics.utils "软件包中的 "emojis "函数自动处理信息。

源代码 ultralytics/utils/errors.py
class HUBModelError(Exception):
    """
    Custom exception class for handling errors related to model fetching in Ultralytics YOLO.

    This exception is raised when a requested model is not found or cannot be retrieved.
    The message is also processed to include emojis for better user experience.

    Attributes:
        message (str): The error message displayed when the exception is raised.

    Note:
        The message is automatically processed through the 'emojis' function from the 'ultralytics.utils' package.
    """

    def __init__(self, message="Model not found. Please check model URL and try again."):
        """Create an exception for when a model is not found."""
        super().__init__(emojis(message))

__init__(message='Model not found. Please check model URL and try again.')

在找不到模型时创建一个异常。

源代码 ultralytics/utils/errors.py
def __init__(self, message="Model not found. Please check model URL and try again."):
    """Create an exception for when a model is not found."""
    super().__init__(emojis(message))





Created 2023-11-12, Updated 2024-06-02
Authors: glenn-jocher (5), Burhan-Q (1)