roboflow / roboflow/roboflow-python

Unable to up deploy a custom trained yolov5 model on robotflow

Open
#351 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
629
Forks
140
Avg merge
2d 2h
Merged PRs (30d)
5

Description

``
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at version.deploy(model_type, model_path, filename) and trace the torch.load call for yolov5 weights. Reproduce the failure with the supplied custom model path and compare it with the working torch.hub.load example. Done means a custom-trained yolov5 weights file can be uploaded successfully through deploy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.