Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to up deploy a custom trained yolov5 model on robotflow #351

Open
cyberkarim opened this issue Jan 15, 2025 · 0 comments
Open

Unable to up deploy a custom trained yolov5 model on robotflow #351

cyberkarim opened this issue Jan 15, 2025 · 0 comments

Comments

@cyberkarim
Copy link

``
It has been impossible to upload a yolov5 model trained on a custom dataset. My folder


rf = roboflow.Roboflow(api_key="..")
project = rf.workspace().project("...")

version = project.version(2)

version.deploy("yolov5", "yolov5/runs/train/exp2")

I've got this error

popi

It' an issue that arise as resulting of calling the function torch.load on the parameter : os.path.join(model_path, filename). This function attempts to load the yolov5 model using the same argument used as input for the function deploy. Recall the functions deploy inputs :

(method) def deploy(
model_type: str,
model_path: str,
filename: str = "weights/best.pt"
) -> None
Uploads provided weights file to Roboflow.

Args:
model_type (str): The type of the model to be deployed.
model_path (str): File path to the model weights to be uploaded.
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".

I tried :

torch.load(os.path.join("yolov5/runs/train/exp2", "weights/best.pt"))

but still getting the same error. According to my research, loading former yolo model versions has usually been done using torch.hub.load rather than torch.load. In fact

torch.hub.load('.', 'custom', path='/path/to/yolov5/runs/train/exp5/weights/best.pt', source='local')

works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant