Skip to content

detect.py fails without internet connection, always tries to load pre-trained model weights #2799

@r-blmnr

Description

@r-blmnr

First of all, thanks for this great piece of software!

Problem

Without internet connection, calling detect.py fails. It seems that even when a local copy of weights is available, the code still tries to load a set of weights from an online resource.

Commenting this line prevents the error and the code runs as expected:

attempt_download(w)

However, as I am using the yolov5 version from PyPI, which is dynamically installed into a virtual environment, commenting is not a long-term option.

Request

@glenn-jocher Would it be possible to include a switch, where the code only tries to load weights from an online resource if the weights are not found locally? This would also be in line with the comment at:

# Attempt file download if does not exist

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions