Skip to content

Commit

Permalink
fix: k largest sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing-su committed Oct 30, 2023
1 parent d3e57b6 commit 2a578cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions adetailer/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def filter_k_largest(pred: PredictOutput, k: int = 0) -> PredictOutput:
return pred
areas = [bbox_area(bbox) for bbox in pred.bboxes]
idx = np.argsort(areas)[-k:]
idx = idx[::-1]
pred.bboxes = [pred.bboxes[i] for i in idx]
pred.masks = [pred.masks[i] for i in idx]
return pred
Expand Down

0 comments on commit 2a578cf

Please sign in to comment.