Skip to content

Commit

Permalink
DOCS-2056: Add vision service control panel
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Jul 10, 2024
1 parent 3863d3d commit adcb632
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 52 deletions.
Binary file modified assets/services/vision/color-detector-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 5 additions & 52 deletions docs/services/vision/mlmodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ When done, click the **Save** button in the top right corner of the page, then p
## Test your detector or classifier

You can test your detector or classifier with [existing images in the Viam app](#existing-images-in-the-cloud) or [live camera footage](#live-camera-footage).
You can also test classifiers with [existing images on a computer](#existing-images-on-your-machine).
You can also test detectors and classifiers with [existing images on a computer](#existing-images-on-your-machine).

### Existing images in the cloud

Expand All @@ -226,66 +226,19 @@ If the classifier's results exceed the confidence threshold, the **Run model** s
If you intend to use the detector or classifier with a camera that is part of your machine, you can test your detector or classifier from the [**Control tab**](/fleet/control/) or with code:

1. Configure a [camera component](/components/camera/).

{{< alert title="Tip" color="tip" >}}
This is the camera whose name you need to pass to vision service methods.
{{< /alert >}}

2. (Optional) If you would like to see detections or classifications from the **Control tab**, configure a [transform camera](/components/camera/transform/) with the following attributes:

{{< tabs >}}
{{% tab name="Detections" %}}

```json
{
"pipeline": [
{
"type": "detections",
"attributes": {
"confidence_threshold": 0.5,
"detector_name": "<vision-service-name>",
"valid_labels": ["<label>"]
}
}
],
"source": "<camera-name>"
}
```

{{% /tab %}}
{{% tab name="Classifications" %}}

```json
{
"pipeline": [
{
"type": "classifications",
"attributes": {
"confidence_threshold": 0.5,
"classifier_name": "<vision-service-name>",
"max_classifications": <int>,
"valid_labels": [ "<label>" ]
}
}
],
"source": "<camera-name>"
}
```

{{% /tab %}}
{{< /tabs >}}

3. After adding the components and their attributes, click the **Save** button in the top right corner of the page.
4. Navigate to the **CONTROL** tab, click on your transform camera and toggle it on.
If you've configured a detector, the transform camera will now show detections with bounding boxes around the object.
2. After adding the camera, click the **Save** button in the top right corner of the page.
3. Navigate to the **CONTROL** tab, click on the vision service and select your camera and vision service and then click **Refresh**.
The panel will now show detections with bounding boxes around the colors or classifications on the image.

![Viam app control tab interface showing bounding boxes around two office chairs, both labeled "chair" with confidence score "0.50."](/services/vision/chair-detector.png)

If you've configured a classifier, the transform camera will now show classifications on the image.

![Model recognizes a star on camera feed](/services/model-on-camera.png)

5. The following code gets the machine’s vision service and then runs a detector or classifier vision model on an image from the machine's camera `"cam1"`.
4. The following code gets the machine’s vision service and then runs a detector or classifier vision model on an image from the machine's camera `"cam1"`.

{{% alert title="Tip" color="tip" %}}

Expand Down

0 comments on commit adcb632

Please sign in to comment.