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

Fixes a small bug with detection_filter so that instance methods work as expected #308

Merged
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
5 changes: 2 additions & 3 deletions samgeo/text_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def predict(
save_args (dict, optional): Save arguments for the prediction. Defaults to {}.
return_results (bool, optional): Whether to return the results. Defaults to False.
detection_filter (callable, optional):
Callable which with box, mask, logit, phrase, and index args returns a boolean.
Callable with box, mask, logit, phrase, and index args returns a boolean.
If provided, the function will be called for each detected object.
Defaults to None.

Expand Down Expand Up @@ -325,8 +325,7 @@ def predict(
if not callable(detection_filter):
raise ValueError("detection_filter must be callable.")

req_nargs = 6 if inspect.ismethod(detection_filter) else 5
if not len(inspect.signature(detection_filter).parameters) == req_nargs:
if not len(inspect.signature(detection_filter).parameters) == 5:
raise ValueError(
"detection_filter required args: "
"box, mask, logit, phrase, and index."
Expand Down
Loading