-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add_label_posts_review_reason
- Loading branch information
Showing
47 changed files
with
2,568 additions
and
785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"label": "API Reference", | ||
"position": 5, | ||
"collapsed": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
id: redirect | ||
title: API Reference | ||
hide_title: true | ||
--- | ||
|
||
<meta http-equiv="refresh" content="0; url=/python-sdk/api-reference-docs/" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Sample Applications | ||
|
||
Explore these GitHub repositories to see examples of Groundlight-powered applications: | ||
|
||
## Groundlight Stream Processor | ||
|
||
Repository: [https://github.com/groundlight/stream](https://github.com/groundlight/stream) | ||
|
||
The Groundlight Stream Processor is an easy-to-use Docker container for analyzing RTSP streams or common USB-based cameras. You can run it with a single Docker command, such as: | ||
|
||
```bash | ||
docker run stream:local --help | ||
``` | ||
|
||
## Arduino ESP32 Camera Sample App | ||
|
||
Repository: [https://github.com/groundlight/esp32cam](https://github.com/groundlight/esp32cam) | ||
|
||
This sample application allows you to build a working AI vision detector using an inexpensive WiFi camera. With a cost of under $10, you can create a powerful and affordable AI vision system. | ||
|
||
## Raspberry Pi | ||
|
||
Repository: [https://github.com/groundlight/raspberry-pi-door-lock](https://github.com/groundlight/raspberry-pi-door-lock) | ||
|
||
This sample application demonstrates how to set up a Raspberry Pi-based door lock system. The application monitors a door and sends a notification if the door is observed to be unlocked during non-standard business hours. | ||
|
||
## Industrial and Manufacturing Applications | ||
|
||
Groundlight can be used to [apply modern natural-language-based computer vision to industrial and manufacturing applications](/docs/building-applications/industrial). |
4 changes: 4 additions & 0 deletions
4
...uilding-applications/1-grabbing-images.md → ...uilding-applications/2-grabbing-images.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ing-applications/5-managing-confidence.md → ...ing-applications/4-managing-confidence.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
.../building-applications/handling-errors.md → ...uilding-applications/5-handling-errors.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Asynchronous Queries | ||
|
||
Groundlight provides a simple interface for submitting asynchronous queries. This is useful for times in which the thread or process or machine submitting image queries is not the same thread or machine that will be retrieving and using the results. For example, you might have a forward deployed robot or camera that submits image queries to Groundlight, and a separate server that retrieves the results and takes action based on them. We will refer to these two machines as the **submitting machine** and the **retrieving machine**. | ||
|
||
## Setup Submitting Machine | ||
On the **submitting machine**, you will need to install the Groundlight Python SDK. Then you can submit image queries asynchronously using the `ask_async` interface (read the full documentation [here](pathname:///python-sdk/api-reference-docs/#groundlight.client.Groundlight.ask_async)). `ask_async` submits your query and returns as soon as the query is submitted. It does not wait for an answer to be available prior to returning to minimize the time your program spends interacting with Groundlight. As a result, the `ImageQuery` object `ask_async` returns lacks a `result` (the `result` field will be `None`). This is acceptable for this use case as the **submitting machine** is not interested in the result. Instead, the **submitting machine** just needs to communicate the `ImageQuery.id`s to the **retrieving machine** - this might be done via a database, a message queue, or some other mechanism. For this example, we assume you are using a database where you save the `ImageQuery.id` to it via `db.save(image_query.id)`. | ||
|
||
```python notest | ||
from groundlight import Groundlight | ||
import cv2 | ||
from time import sleep | ||
|
||
detector = gl.get_or_create_detector(name="your_detector_name", query="your_query") | ||
|
||
cam = cv2.VideoCapture(0) # Initialize camera (0 is the default index) | ||
|
||
while True: | ||
_, image = cam.read() # Capture one frame from the camera | ||
image_query = gl.ask_async(detector=detector, image=image) # Submit the frame to Groundlight | ||
db.save(image_query.id) # Save the image_query.id to a database for the retrieving machine to use | ||
sleep(10) # Sleep for 10 seconds before submitting the next query | ||
|
||
cam.release() # Release the camera | ||
|
||
``` | ||
|
||
## Setup Retrieving Machine | ||
On the **retrieving machine** you will need to install the Groundlight Python SDK. Then you can retrieve the results of the image queries submitted by another machine using `get_image_query`. The **retrieving machine** can then use the `ImageQuery.result` to take action based on the result for whatever application you are building. For this example, we assume your application looks up the next image query to process from a database via `db.get_next_image_query_id()` and that this function returns `None` once all `ImageQuery`s are processed. | ||
```python notest | ||
from groundlight import Groundlight | ||
|
||
detector = gl.get_or_create_detector(name="your_detector_name", query="your_query") | ||
|
||
image_query_id = db.get_next_image_query_id() | ||
|
||
while image_query_id is not None: | ||
image_query = gl.get_image_query(id=image_query_id) # retrieve the image query from Groundlight | ||
result = image_query.result | ||
|
||
# take action based on the result of the image query | ||
if result.label == 'YES': | ||
pass # TODO: do something based on your application | ||
elif result.label == 'NO': | ||
pass # TODO: do something based on your application | ||
elif result.label == 'UNCLEAR': | ||
pass # TODO: do something based on your application | ||
|
||
# update image_query_id for next iteration of the loop | ||
image_query_id = db.get_next_image_query_id() | ||
``` | ||
|
||
## Important Considerations | ||
When you submit an image query asynchronously, ML prediction on your query is **not** instant. So attempting to retrieve the result immediately after submitting an async query will likely result in an `UNCLEAR` result as Groundlight is still processing your query. Instead, if your code needs a `result` synchronously we recommend using one of our methods with a polling mechanism to retrieve the result. You can see all of the interfaces available in the documentation [here](pathname:///python-sdk/api-reference-docs/#groundlight.client.Groundlight). | ||
|
||
```python notest | ||
from groundlight import Groundlight | ||
from PIL import Image | ||
|
||
detector = gl.get_or_create_detector(name="your_detector_name", query="your_query") | ||
image = Image.open("/path/to/your/image.jpg") | ||
image_query = gl.ask_async(detector=detector, image=image) # Submit async query to Groundlight | ||
result = image_query.result # This will always be 'None' as you asked asynchronously | ||
|
||
image_query = gl.get_image_query(id=image_query.id) # Immediately retrieve the image query from Groundlight | ||
result = image_query.result # This will likely be 'UNCLEAR' as Groundlight is still processing your query | ||
|
||
image_query = gl.wait_for_confident_result(id=image_query.id) # Poll for a confident result from Groundlight | ||
result = image_query.result | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
sidebar_position: 6 | ||
--- | ||
|
||
# Using Groundlight on the Edge | ||
|
||
If your account has access to edge models, you can download and install them to your edge devices. | ||
This allows you to run your model evaluations on the edge, reducing latency, cost, network bandwidth, and energy. | ||
|
||
## How the Edge Endpoint works | ||
|
||
The Edge Endpoint runs as a set of docker containers on an "edge device". This edge device can be an NVIDIA Jetson device, rack-mounted server, or even a Raspberry Pi. The Edge Endpoint is responsible for downloading and running the models, | ||
and for communicating with the Groundlight cloud service. | ||
|
||
To use the edge endpoint, simply configure the Groundlight SDK to use the edge endpoint's URL instead of the cloud endpoint. | ||
All application logic will work seamlessly and unchanged with the Groundlight Edge Endpoint, except some ML answers will | ||
return much faster locally. The only visible difference is that image queries answered at the edge endpoint will have the prefix `iqe_` instead of `iq_` for image queries answered in the cloud. `iqe_` stands for "image query edge". Edge-originated | ||
image queries will not appear in the cloud dashboard. | ||
|
||
## Configuring the Edge Endpoint | ||
|
||
To configure the Groundlight SDK to use the edge endpoint, you can either pass the endpoint URL to the Groundlight constructor like: | ||
|
||
```python | ||
from groundlight import Groundlight | ||
gl = Groundlight(endpoint="http://localhost:6717") | ||
``` | ||
|
||
or by setting the `GROUNDLIGHT_ENDPOINT` environment variable like: | ||
|
||
```bash | ||
export GROUNDLIGHT_ENDPOINT=http://localhost:6717 | ||
python your_app.py | ||
``` |
4 changes: 4 additions & 0 deletions
4
.../docs/building-applications/industrial.md → ...ocs/building-applications/8-industrial.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.