(self, x, targets=None)
| 26 | self.head = head |
| 27 | |
| 28 | def forward(self, x, targets=None): |
| 29 | # fpn output content features of [dark3, dark4, dark5] |
| 30 | fpn_outs = self.backbone(x) |
| 31 | |
| 32 | if self.training: |
| 33 | assert targets is not None |
| 34 | loss, iou_loss, conf_loss, cls_loss, l1_loss, num_fg = self.head( |
| 35 | fpn_outs, targets, x |
| 36 | ) |
| 37 | outputs = { |
| 38 | "total_loss": loss, |
| 39 | "iou_loss": iou_loss, |
| 40 | "l1_loss": l1_loss, |
| 41 | "conf_loss": conf_loss, |
| 42 | "cls_loss": cls_loss, |
| 43 | "num_fg": num_fg, |
| 44 | } |
| 45 | else: |
| 46 | outputs = self.head(fpn_outs) |
| 47 | |
| 48 | return outputs |
nothing calls this directly
no outgoing calls
no test coverage detected