Skip to content

Commit

Permalink
fix max_bbox_size
Browse files Browse the repository at this point in the history
  • Loading branch information
MateoLostanlen committed Jan 9, 2025
1 parent 0fdd361 commit 02ab1f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyroengine/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class Classifier:
model_path: model path
"""

def __init__(self, model_folder="data", imgsz=1024, conf=0.15, iou=0, format="ncnn", model_path=None) -> None:
def __init__(
self, model_folder="data", imgsz=1024, conf=0.15, iou=0, format="ncnn", model_path=None, max_bbox_size=0.4

Check warning on line 51 in pyroengine/vision.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

pyroengine/vision.py#L51

Redefining built-in 'format'
) -> None:
if model_path is None:

if format == "ncnn":
Expand Down Expand Up @@ -103,6 +105,7 @@ def __init__(self, model_folder="data", imgsz=1024, conf=0.15, iou=0, format="nc
self.imgsz = imgsz
self.conf = conf
self.iou = iou
self.max_bbox_size = max_bbox_size

def is_arm_architecture(self):
# Check for ARM architecture
Expand Down Expand Up @@ -221,7 +224,7 @@ def __call__(self, pil_img: Image.Image, occlusion_mask: Optional[np.ndarray] =

# drop big detections
pred = np.clip(pred, 0, 1)
pred = pred[(pred[:, 2] - pred[:, 0]) > 0.4, :]
pred = pred[(pred[:, 2] - pred[:, 0]) < self.max_bbox_size, :]
pred = np.reshape(pred, (-1, 5))

# Remove prediction in occlusion mask
Expand Down

0 comments on commit 02ab1f0

Please sign in to comment.