The use of weight file (.pt)

When I was validating the model, I found that only .pt files were used without any other way to obtain the model structure. If I want to use the weights from the .pt file in another structure that I have recorded in a yaml file, which has a different structure from the .pt file but uses the same weights, is there any way to achieve this?

You can load weights from a .pt file using .load().

from ultralytics import YOLO

model = YOLO("yolo11n.yaml").load("yolo11n.pt")
1 Like