Skip to content

Commit 15e2fc9

Browse files
authored
obb head separate outputs
1 parent b350130 commit 15e2fc9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ultralytics/nn/modules/head.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ def __init__(self, nc=80, ne=1, ch=()):
234234
def forward(self, x):
235235
"""Concatenates and returns predicted bounding boxes and class probabilities."""
236236
bs = x[0].shape[0] # batch size
237+
238+
if self.separate_outputs and self.export:
239+
outputs = []
240+
for i in range(self.nl):
241+
angle_logit = self.cv4[i](x[i]).view(bs, self.ne, -1)
242+
outputs.append(angle_logit)
243+
244+
outputs.extend(Detect.forward(self, x))
245+
return outputs
246+
237247
angle = torch.cat([self.cv4[i](x[i]).view(bs, self.ne, -1) for i in range(self.nl)], 2) # OBB theta logits
238248
# NOTE: set `angle` as an attribute so that `decode_bboxes` could use it.
239249
angle = (angle.sigmoid() - 0.25) * math.pi # [-pi/4, 3pi/4]

0 commit comments

Comments
 (0)