question

EricNeliz-1395 avatar image
0 Votes"
EricNeliz-1395 asked romungi-MSFT answered

Error when using azure trained model on yolov5

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered

@EricNeliz-1395 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


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for you answer, I didn't try deploying the model as an endpoint in azure since it does not fit my use case, the machine the algorithm will be ran on won't have access to internet, and if it were the case, would be very limited, so I have to rely on offline solutions. But thank you for the link I will try to see if it can apply to yolov5 as well (so yes, converting the model into keras would be interesting if it doesn't impact performances too much).

1 Vote 1 ·