Error when using azure trained model on yolov5

Eric Neliz 11 Reputation points
2022-04-16T13:28:23.107+00:00

Hi, I trained a model with Azure Machine Learning studio for an objects detection tasks using yolov5 as the model. I created the experiment using the notebook and it ran successfully for a little less than 30 epochs. The experiment status tell me that it completed successfully and I have access to the file "model.pt" in the output folder of the child run.

Now I would like to use that trained model and test it with the github version of yolov5 installed on my local computer, but when I use it, it simply doesn't work and display an error (it works with my own trained model from my local computer), the error is the following:

Traceback (most recent call last):
File "C:\Users\Username\Desktop\yolov5\detect.py", line 261, in <module>
main(opt)
File "C:\Users\Username\Desktop\yolov5\detect.py", line 256, in main
run(**vars(opt))
File "C:\Users\Username\Desktop\yolov5\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Username\Desktop\yolov5\detect.py", line 92, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data)
File "C:\Users\Username\Desktop\yolov5\models\common.py", line 305, in init
model = attempt_load(weights if isinstance(weights, list) else w, map_location=device)
File "C:\Users\Username\Desktop\yolov5\models\experimental.py", line 98, in attempt_load
model.append(ckpt['ema' if ckpt.get('ema') else 'model'].float().fuse().eval()) # FP32 model
KeyError: 'model'

So is there an explanation, or does the model simply doesn't work with classic yolov5 installations ? Either way I would appreciate the help. Thank you !

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,335 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. romungi-MSFT 48,906 Reputation points Microsoft Employee Moderator
    2022-04-18T07:15:39.15+00:00

    @Eric Neliz Are you able to deploy the model as a realtime endpoint directly on Azure? I couldn't really find any direct reference to using the model out of the box on local installations for yolo. One project does help to document steps to use yolov3 with keras locally and on azure. Is this an option to convert your model to a format like keras?

    Ref: Micheleen Harris


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.