Skip to content

Cannot Load best.pt Without Full YOLOv5 Source Code #13627

@dntcoder

Description

@dntcoder

Search before asking

Question

ModuleNotFoundError: No module named 'models'
I encountered an issue when deploying my custom-trained YOLOv5 model (best.pt). Loading the model file depends on the full YOLOv5 source code structure, which makes it inconvenient for deployment in production or lightweight services. Is there a better way to load the model directly in an inference script without relying on the entire YOLOv5 codebase?

Additional

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    detectObject Detection issues, PR'squestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions