import torch
from ultralytics import YOLO
from yolov6.models.yolo import build_model
device = torch.device(‘cuda’ if torch.cuda.is_available() else ‘cpu’)
model_path = ‘path_to_weights.pt’
model = build_model(cfg=‘/path/yolov6n.yaml’, num_classes=1, device=device, fuse_ab=False, distill_ns=False)
model.torch.load(model_path)
model.eval()
.
.
.
I am performing object detection and I have trained my dataset on yolov6. Now, I want to use the best weights learned during training to perform another task but I am facing difficulty in loading these weights. Can you help me find the correct way to do this?