Skip to content

Conversation

@robotrapta
Copy link
Member

And a couple useful changes to the SDK.

Copy link
Contributor

@positavi positavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments.

def get_detector_by_name(self, name: str) -> Optional[Detector]:
#TODO: Do this on server.
detector_list = self.list_detectors(page_size=100)
for d in detector_list.results:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work if there are more than 100 detectors ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not. But it will complain instead of failing silently.

image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg")
# Show the results
print(f"The answer is {image_query.result}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we expose confidence here? its actually a little tricky because when a human reviews it the confidence becomes None (!).

also, this only gets the ML answer, which can be total junk. if you want to wait for a definitive answer, you have to poll it. i don't know what we do to encourage good behavior there or if it matters if people just busy wait and poll.

i think we can expose the example here of how to check threshold, wait for a good enough answer. its kindof awesome and a really unique feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this does require more thought, and my initial thoughts are probably wrong.

Seems like there are multiple levels:
A. We can specify the confidence_threshold at detector creation (or update) time. Then, when a posicheck comes:

  • we return a boolean on whether we are above the confidence_threshold
  • or we return None for result if we're under-confident. If we are above the confidence threshold, or it comes from a human, we return non-None result.

B. We add an optional polling_timeout argument to submit_image_query, and we do optionally do the polling inside that function on behalf of the user. We can also add an optional confidence_threshold parameter to submit_image_query() that overrides the detector-level config.

Not sure if we need these now, or should just include a second, more detailed example code. Handling varying confidences definitely makes things more complicated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do at least one of these things , but I'd rather put that in another PR.

Copy link
Contributor

@positavi positavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

image_query = gl.submit_image_query(detector=detector, image="path/to/filename.jpeg")
# Show the results
print(f"The answer is {image_query.result}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this does require more thought, and my initial thoughts are probably wrong.

Seems like there are multiple levels:
A. We can specify the confidence_threshold at detector creation (or update) time. Then, when a posicheck comes:

  • we return a boolean on whether we are above the confidence_threshold
  • or we return None for result if we're under-confident. If we are above the confidence threshold, or it comes from a human, we return non-None result.

B. We add an optional polling_timeout argument to submit_image_query, and we do optionally do the polling inside that function on behalf of the user. We can also add an optional confidence_threshold parameter to submit_image_query() that overrides the detector-level config.

Not sure if we need these now, or should just include a second, more detailed example code. Handling varying confidences definitely makes things more complicated.

@robotrapta robotrapta merged commit f8533b4 into main Oct 25, 2022
@robotrapta robotrapta deleted the userguide-updates branch October 25, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants