Skip to content

Conversation

@timmarkhuff
Copy link
Contributor

@timmarkhuff timmarkhuff commented Jul 15, 2025

A modified version of the Edge Endpoint that only supports edge inference. We won't actually merge these changes, but rather keep them in their own branch and deploy from here as needed.

Deploy it normally with an API token and some configured detectors.

After initial deployment, you can delete the API token and reboot and it will continue to serve edge inferences for the configured detectors.

Related PR: https://github.com/positronix-ai/rpc-server/pull/51

@timmarkhuff timmarkhuff requested a review from a team as a code owner July 15, 2025 17:24
@timmarkhuff timmarkhuff marked this pull request as draft July 15, 2025 17:24
@timmarkhuff timmarkhuff changed the title Offline Version of Edge Endpoint Edge Only Mode Jul 16, 2025
@timmarkhuff timmarkhuff marked this pull request as ready for review July 16, 2025 17:58
@timmarkhuff timmarkhuff changed the title Edge Only Mode Edge Only Mode - Edge Endpoint Jul 16, 2025
Copy link
Collaborator

@CoreyEWood CoreyEWood left a comment

Choose a reason for hiding this comment

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

Looks good to me, as long as it works as intended! Would definitely be good to keep it running for as long as possible to observe if anything pops up - I can't think of anything else that would create issues, but it's always possible to be missing something.

background_tasks.add_task(refresh_detector_metadata_if_needed, detector_id, gl)

confidence_threshold = confidence_threshold or detector_metadata.confidence_threshold
confidence_threshold = 0.9 # Set an arbitrary value since we cannot get one from the cloud.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to support using the passed in confidence_threshold if it exists? Or is it preferred to always use this hardcoded one?

Copy link
Contributor Author

@timmarkhuff timmarkhuff Jul 17, 2025

Choose a reason for hiding this comment

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

The RPC Server never passes in a confidence threshold, but rather relies on the detector's confidence threshold.

The confidence_threshold here doesn't do anything. The only reason I set it is because it is a required field for create_iq.

I added a comment to make this more clear.

Comment on lines 105 to 106
# for holding edge results if and when available
results = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not important either way but this isn't needed anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I removed it.

Submit an image query for a given detector.
This function attempts to run inference locally on the edge, if possible,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What this docstring says isn't totally true anymore, not sure if that's important or not though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I have updated it.

human_review: Optional[Literal["DEFAULT", "ALWAYS", "NEVER"]] = Query(None),
want_async: bool = Query(False),
gl: Groundlight = Depends(get_groundlight_sdk_instance),
app_state: AppState = Depends(get_app_state),
Copy link
Collaborator

Choose a reason for hiding this comment

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

(This comment is meant to be on the line above this but it won't let me comment there)

If you want to simplify this further I think you could just remove gl from the parameters here, since you don't use it (and then you wouldn't have to change the get_groundlight_sdk_instance function either`). But if this way works then it's fine too.

Copy link
Contributor Author

@timmarkhuff timmarkhuff Jul 17, 2025

Choose a reason for hiding this comment

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

I have removed the gl arg. I was hesitant to do that originally, because I thought some other caller that I am unaware of might be using it, but now that I have read up on fastapi.Depends, I realize that it is not something that is passed into functions, so it is safe to remove.

I removed it and tested, and it works fine.

timmarkhuff and others added 6 commits July 17, 2025 15:06
Changes:
* now works with Balena
* now totally independent of the cloud service (models are stored in s3
and fetched from there)

---------

Co-authored-by: Auto-format Bot <autoformatbot@groundlight.ai>
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.

3 participants