yolo v5 保存模型为 model with shape
用 YOLO v5 训练出来的 pt 文件只包含权重信息,下列代码可以 Saving Models with Shapes。
import torch
from models.experimental import attempt_load
weights = 'runs/train/exp/weights/best.pt'
model = attempt_load(weights)
torch.save(model, 'model_with_shape.pt')
print("load and save model successfully!")