MCPcopy Create free account
hub / github.com/ZhengPeng7/BiRefNet / forward

Method forward

loss.py:111–120  ·  view source on GitHub ↗
(self, pred, target)

Source from the content-addressed store, hash-verified

109 self.iou_loss = IoULoss()
110
111 def forward(self, pred, target):
112 win_y, win_x = 64, 64
113 iou_loss = 0.
114 for anchor_y in range(0, target.shape[0], win_y):
115 for anchor_x in range(0, target.shape[1], win_y):
116 patch_pred = pred[:, :, anchor_y:anchor_y+win_y, anchor_x:anchor_x+win_x]
117 patch_target = target[:, :, anchor_y:anchor_y+win_y, anchor_x:anchor_x+win_x]
118 patch_iou_loss = self.iou_loss(patch_pred, patch_target)
119 iou_loss += patch_iou_loss
120 return iou_loss
121
122
123class ThrReg_loss(torch.nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected