我已經model = torchvision.models.detection.retinanet_resnet50_fpn_v2(progress=True)并且想在自定義資料上對其進行訓練。為了得到損失,我必須執行
classification_loss, regression_loss = model(images, targets)
我已經images為targets.
uj5u.com熱心網友回復:
檢查這個官方教程:https ://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
一般來說,targets是一個list,dict例如
targets = [
{
"boxes": torch.as_tensor([[xmin, ymin, xmax, ymax]], dtype=torch.float32),
"labels": torch.as_tensor([1,], dtype=torch.int64)
}
]
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/516934.html
