MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / loss

Method loss

embodiedscan/models/dense_heads/fcaf3d_head.py:208–236  ·  view source on GitHub ↗

Perform forward propagation and loss calculation of the detection head on the features of the upstream network. Args: x (tuple[Tensor]): Features from the upstream network, each is a 4D-tensor. batch_data_samples (List[:obj:`Det3DDataSample`])

(self, x: Tuple[Tensor], batch_data_samples: SampleList,
             **kwargs)

Source from the content-addressed store, hash-verified

206 points[::-1]
207
208 def loss(self, x: Tuple[Tensor], batch_data_samples: SampleList,
209 **kwargs) -> dict:
210 """Perform forward propagation and loss calculation of the detection
211 head on the features of the upstream network.
212
213 Args:
214 x (tuple[Tensor]): Features from the upstream network, each is
215 a 4D-tensor.
216 batch_data_samples (List[:obj:`Det3DDataSample`]): The Data
217 Samples. It usually includes information such as
218 `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
219
220 Returns:
221 dict: A dictionary of loss components.
222 """
223 outs = self(x)
224 batch_gt_instances_3d = []
225 batch_gt_instances_ignore = []
226 batch_input_metas = []
227 for data_sample in batch_data_samples:
228 batch_input_metas.append(data_sample.metainfo)
229 batch_gt_instances_3d.append(data_sample.gt_instances_3d)
230 batch_gt_instances_ignore.append(
231 data_sample.get('ignored_instances', None))
232
233 loss_inputs = outs + (batch_gt_instances_3d, batch_input_metas,
234 batch_gt_instances_ignore)
235 losses = self.loss_by_feat(*loss_inputs)
236 return losses
237
238 def predict(self,
239 x: Tuple[Tensor],

Callers

nothing calls this directly

Calls 1

loss_by_featMethod · 0.95

Tested by

no test coverage detected