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

infer num_classes for yolov8-seg pipeline #1261

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/deepsparse/yolov8/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,27 @@ def process_engine_outputs(
)

def process_engine_outputs_seg(
self, engine_outputs: List[numpy.ndarray], nc: int = 80, **kwargs
self,
engine_outputs: List[numpy.ndarray],
**kwargs,
) -> YOLOSegOutput:
"""
The pathway for processing the outputs of the engine for YOLOv8 segmentation.
:param engine_outputs: list of numpy arrays that are the output of the engine
forward pass
: params nc: number of classes. If not provided, calculated as
detection.shape[1] - 4
:return: outputs of engine post-processed into an object in the `output_schema`
format of this pipeline
"""

detections, mask_protos = engine_outputs

# defined per ultralytics documentation
num_classes = detections.shape[1] - 4
bfineran marked this conversation as resolved.
Show resolved Hide resolved

# NMS
detections_output = self.nms_function(
outputs=detections,
nc=nc,
nc=num_classes,
iou_thres=kwargs.get("iou_thres", 0.25),
conf_thres=kwargs.get("conf_thres", 0.45),
multi_label=kwargs.get("multi_label", False),
Expand Down
Loading