pythonpytorchyolov5

Warning message using yolov5


i am trying using yolov5 but recently i got warning message like this:

WARNING 'ultralytics.yolo.v8' is deprecated since '8.0.136' and will be removed in '8.1.0'. Please use 'ultralytics.models.yolo' instead.

WARNING 'ultralytics.yolo.utils' is deprecated since '8.0.136' and will be removed in '8.1.0'. Please use 'ultralytics.utils' instead.

Note this warning may be related to loading older models. You can update your model to current structure with:

    import torch
    ckpt = torch.load("model.pt")  # applies to both official and custom models
    torch.save(ckpt, "updated-model.pt")

the problem is i dont using any of ultralytics.yolo.v8 and ulralytics.yolo.utils in my code

import torch
import cv2 as cv

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(device)

# Reload model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')

the rest is just basic opencv to open camera, is anyone know what a problem is or the problem is from yolov5 repository?


Solution

  • i dont using any of ultralytics.yolo.v8 and ulralytics.yolo.utils in my code

    As it says, "Note this warning may be related to loading older models", which is what you're doing. The model file you're loading using torch.hub.load contains references to the old module name.

    You can ignore the warning for now, but using that model will break if you update the ultralytics module to 8.1+.