Loss Node
The Loss Node computes the loss for your model
Custom Loss
Using a custom loss is the recommended way to work within Tensorleap. It allows you to test the validation of the loss in your local environment.
To add a custom loss, select CustomLoss when adding nodes to the mapping. This loss would have the same arguments defined in your custom loss defined in your integration script.
For example, adding this loss in the integration script:
@tensorleap_custom_loss("total_loss")
def loss(pred80,pred40,pred20,gt,demo_pred):
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]]
all_loss,_= criterion(y_pred_torch, d)
return all_loss.unsqueeze(0).numpy()
Would result in a possible node addition to the mapping:

This node could then be connected to the different inputs it expects to get in order to operate as expected
Setup
The CustomLoss node have several properties:
Selected Custom Loss: a dropdown from which a custom loss can be selected. The list would include all registered custom losses from your integration script.
Name: The name of the selected ground truth encoder in the integration script
Arguments: The expected arguments for your custom loss, as detailed in the integration script.
Default losses
The Tensorleap integration compes equipped with several losses ready for usage. These losses can be added from the dropdown menu, and each would have its own configurable settings. Adding these losses does not require any addition of a custom loss within the integration script.
Last updated
Was this helpful?