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

Update inference.py #313

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions groundingdino/util/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def predict_with_caption(
image: np.ndarray,
caption: str,
box_threshold: float = 0.35,
text_threshold: float = 0.25
text_threshold: float = 0.25,
remove_combined: bool = False
) -> Tuple[sv.Detections, List[str]]:
"""
import cv2
Expand All @@ -179,7 +180,8 @@ def predict_with_caption(
caption=caption,
box_threshold=box_threshold,
text_threshold=text_threshold,
device=self.device)
device=self.device,
remove_combined=remove_combined)
source_h, source_w, _ = image.shape
detections = Model.post_process_result(
source_h=source_h,
Expand All @@ -192,8 +194,9 @@ def predict_with_classes(
self,
image: np.ndarray,
classes: List[str],
box_threshold: float,
text_threshold: float
box_threshold: float = 0.35,
text_threshold: float = 0.25,
remove_combined: bool = False
) -> sv.Detections:
"""
import cv2
Expand Down Expand Up @@ -222,7 +225,8 @@ def predict_with_classes(
caption=caption,
box_threshold=box_threshold,
text_threshold=text_threshold,
device=self.device)
device=self.device,
remove_combined=remove_combined)
source_h, source_w, _ = image.shape
detections = Model.post_process_result(
source_h=source_h,
Expand Down