(self, data: dict)
| 590 | return ret |
| 591 | |
| 592 | def forward(self, data: dict): |
| 593 | if self.training: |
| 594 | self.criterion.initialize_for_single_clip(data['gt_instances']) |
| 595 | frames = data['imgs'] # list of Tensor. |
| 596 | outputs = { |
| 597 | 'pred_logits': [], |
| 598 | 'pred_boxes': [], |
| 599 | } |
| 600 | |
| 601 | track_instances = self._generate_empty_tracks() |
| 602 | for frame in frames: |
| 603 | if not isinstance(frame, NestedTensor): |
| 604 | frame = nested_tensor_from_tensor_list([frame]) |
| 605 | frame_res = self._forward_single_image(frame, track_instances) |
| 606 | track_instances = frame_res['track_instances'] |
| 607 | outputs['pred_logits'].append(frame_res['pred_logits']) |
| 608 | outputs['pred_boxes'].append(frame_res['pred_boxes']) |
| 609 | |
| 610 | if not self.training: |
| 611 | outputs['track_instances'] = track_instances |
| 612 | else: |
| 613 | outputs['losses_dict'] = self.criterion.losses_dict |
| 614 | return outputs |
| 615 | |
| 616 | |
| 617 | def build(args): |
nothing calls this directly
no test coverage detected