Home > Mobile >  How to use yolov5 api with flask offline?
How to use yolov5 api with flask offline?

Time:02-26

I was able to run flask app with yolov5 on a PC with internet connection. I followed the steps mentioned in yolov5 docs and used this file: yolov5/utils/flask_rest_api/restapi.py,

But I need to achieve the same offline. Now the issue is, when I am using the following:

model = torch.hub.load("ultralytics/yolov5", "yolov5", force_reload=True)

It tries to download model from internet. And throws an error.

Urllib.error.URLError: <urlopen error [Errno - 2] name or service not known>

How to get the same results offline.

Thanks in advance.

CodePudding user response:

If you want to run detection offline, you need to have the model already downloaded.

So, download the model (for example yolov5s.pt) from enter image description here

  • Related