MCPcopy Create free account
hub / github.com/DIVE128/DMVSNet / classification_loss_1

Function classification_loss_1

loss.py:188–196  ·  view source on GitHub ↗
(prob_volume, depth_values, interval, depth_gt, mask, weight)

Source from the content-addressed store, hash-verified

186 else:
187 return ce_loss.sum()
188def classification_loss_1(prob_volume, depth_values, interval, depth_gt, mask, weight):
189 depth_gt_volume = depth_gt.unsqueeze(1).expand_as(depth_values) # (b, d, h, w)
190
191 gt_index_volume = (
192 ((depth_values - interval / 2) <= depth_gt_volume).float() * ((depth_values + interval / 2) > depth_gt_volume).float())
193
194 pos_w = (depth_gt_volume.shape[1]-1)/1.0 # pos_w = neg_num / pos_num
195 loss = binary_cross_entropy_with_logits(prob_volume, gt_index_volume, pos_weight=pos_w,mask=mask,weight=weight)
196 return loss
197
198def classification_loss(prob_volume, depth_values, interval, depth_gt, mask, weight):
199 depth_gt_volume = depth_gt.unsqueeze(1).expand_as(depth_values) # (b, d, h, w)

Callers 1

mvs_lossFunction · 0.85

Calls 1

Tested by

no test coverage detected