Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support single output in YoloX nms #813

Merged
merged 9 commits into from
Jul 5, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ def __init__(
self.with_confidence = with_confidence

def forward(self, x, device: str = None):
ofrimasad marked this conversation as resolved.
Show resolved Hide resolved
# Use the main output features in case of multiple outputs.
if isinstance(x, (tuple, list)):
ofrimasad marked this conversation as resolved.
Show resolved Hide resolved
x = x[0]

if self.nms_type == NMS_Type.ITERATIVE:
nms_result = non_max_suppression(x[0], conf_thres=self.conf, iou_thres=self.iou, with_confidence=self.with_confidence)
nms_result = non_max_suppression(x, conf_thres=self.conf, iou_thres=self.iou, with_confidence=self.with_confidence)
else:
nms_result = matrix_non_max_suppression(x[0], conf_thres=self.conf, max_num_of_detections=self.max_pred)
nms_result = matrix_non_max_suppression(x, conf_thres=self.conf, max_num_of_detections=self.max_pred)

return self._filter_max_predictions(nms_result)

Expand Down