Metric Node
The Metric Node computes the metric for your model
Custom Metric Example
@tensorleap_custom_metric("cost")
def cost(pred80,pred40,pred20,gt):
gt=np.squeeze(gt,axis=0)
d={}
d["bboxes"] = torch.from_numpy(gt[...,:4])
d["cls"] = torch.from_numpy(gt[...,4])
d["batch_idx"] = torch.zeros_like(d['cls'])
y_pred_torch = [torch.from_numpy(s) for s in [pred80,pred40,pred20]]
_,loss_parts= criterion(y_pred_torch, d)
return {"box":loss_parts[0].unsqueeze(0).numpy(),"cls":loss_parts[1].unsqueeze(0).numpy(),"dfl":loss_parts[2].unsqueeze(0).numpy()}
Setup
Last updated
Was this helpful?

