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

DOCS-2644: Address Alyssa's feedback #3144

Merged
merged 7 commits into from
Jul 19, 2024
Merged
Changes from 3 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
61 changes: 51 additions & 10 deletions docs/use-cases/image-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ From there, you can use your image data to do things like [train ML models](/use

{{< /alert >}}

In the next how-to guide you can use the images you collect here to [train computer vision models](/use-cases/deploy-ml/).
If you'd like to follow a more detailed tutorial, see [Selectively Capture Data Using filtered-camera](/tutorials/projects/filtered-camera/).

## Prerequisites

Expand All @@ -42,7 +42,8 @@ In the next how-to guide you can use the images you collect here to [train compu
{{<imgproc src="/icons/components/camera.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="configure a camera component">}}
**1. Configure a camera**

Configure a camera component, such as a [webcam](/components/camera/webcam/), on your machine.
On your [machine's page](#prerequisites), configure any camera component.
If you are not sure what to use, start with a [webcam](/components/camera/webcam/).

{{% /tablestep %}}
{{% tablestep link="/services/data/"%}}
Expand All @@ -69,18 +70,37 @@ For example, set it to `0.05` to capture an image every 20 seconds.

Set the MIME type to your desired image format, for example `image/jpeg`.

Click save to start capturing data.

{{% /tablestep %}}
{{% tablestep %}}
{{<imgproc src="/services/ml/collect.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**4. View data in the Viam app**

{{< alert title="Wait until data appears" color="note" >}}
Once you have saved your configuration changes, your data will sync at the specified sync interval, which may mean you have to wait and then refresh the page for data to appear.

If no data appears after the sync interval, check the [**Logs**](/cloud/machines/#logs).
{{< /alert >}}
npentrel marked this conversation as resolved.
Show resolved Hide resolved

Once you have synced images, you can [view those images in the Viam app](/services/data/view/) from the **DATA** tab in the top navigation bar.

You can also [export your data from the Viam app](/services/data/export/) to a deployed machine, or to any computer.

{{% /tablestep %}}
{{< /table >}}

You now know how to capture and sync image data.

{{< alert title="Avoid fees by disabling data capture" color="note" >}}
If this is not a production machine and you have confirmed that your machine is capturing and syncing data, disable data capture in the camera configuration to avoid [incurring fees](https://www.viam.com/product/pricing) for capturing large amounts of test data.
{{< /alert >}}

For many use cases, you may not want to capture data unless it meets certain conditions.
Consider the example of a security camera that captures data every 5 seconds.
This setup would result in a large number of images, of which most wouldn't be interesting.
In the next part of this guide, you will learn how to filter the data before capturing and syncing it.

## Use filtering to collect and sync only certain images

You can use filtering to selectively capture images using a machine learning (ML) model, for example to only capture images with people in them.
Expand All @@ -95,12 +115,18 @@ The following steps use the [`filtered_camera`](https://github.com/erh/filtered_

Configure an ML model service on your machine that is compatible with the ML model you want to use, for example [TFLite CPU](/services/ml/deploy/tflite_cpu/).

From the **Model** dropdown, select the preexisting model you want to use, or click **Add new model** to upload your own.
{{% /tablestep %}}
{{% tablestep link="/services/vision/"%}}
{{<imgproc src="/services/ml/train.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**2. Add an ML model to your machine**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{% /tablestep %}}
{{% tablestep link="/services/vision/"%}}
{{<imgproc src="/services/ml/train.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**2. Add an ML model to your machine**

This is duplicated, and then step numbers need changing.


From the **Model** dropdown, select an [existing model](https://app.viam.com/registry?type=ML+Model) you want to use, or click **Add new model** to upload your own.
If you're not sure which model to add, you can add [`EfficientNet-ImageNet2012`](https://app.viam.com/ml-model/viam/EfficientNet-ImageNet2012) which can detect people and animals, among other things.

{{% /tablestep %}}
{{% tablestep link="/services/vision/"%}}
{{<imgproc src="/services/icons/vision.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**2. Add a vision service to use with the ML model**
**3. Add a vision service to use with the ML model**

You can think of the vision service as the bridge between the ML model service and the output from your camera.

Expand All @@ -110,26 +136,41 @@ From the **Select model** dropdown, select the name of your ML model service (fo
{{% /tablestep %}}
{{% tablestep %}}
{{<imgproc src="/services/icons/modular-registry.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**3. Configure the filtered camera**
**4. Configure the filtered camera**

The `filtered-camera` {{< glossary_tooltip term_id="modular-resource" text="modular component" >}} pulls the stream of images from the camera you configured earlier, and applies the vision service to it.

Configure a `filtered-camera` component on your machine, following the [attribute guide in the README](https://github.com/erh/filtered_camera?tab=readme-ov-file#configure-your-filtered-camera) to specify the names of your webcam and vision service, and add classification and object detection filters.
Configure a `filtered-camera` component on your machine, following the [attribute guide in the README](https://github.com/erh/filtered_camera?tab=readme-ov-file#configure-your-filtered-camera) to specify the names of your camera and vision service, and add classification and object detection filters.

{{% /tablestep %}}
{{% tablestep %}}
{{<imgproc src="/services/icons/data-capture.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**4. Configure data capture and sync on the filtered camera**
**5. Configure data capture and sync on the filtered camera**

Configure data capture and sync just as you would for a webcam.
Configure data capture and sync just as you did before.
npentrel marked this conversation as resolved.
Show resolved Hide resolved
The filtered camera will only capture image data that passes the filters you configured in the previous step.

Turn off data capture on your webcam if you haven't already, so that you don't capture duplicate or unfiltered images.
Turn off data capture on your camera if you haven't already, so that you don't capture duplicate or unfiltered images.

{{% /tablestep %}}
{{% tablestep %}}

{{<imgproc src="/services/ml/collect.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**6. View filtered data in the Viam app**

Once you save your configuration, your filtered images will sync and you can [view those images in the Viam app](/services/data/view/) from the **DATA** tab.

{{< alert title="Wait until data appears" color="note" >}}
Your data will sync at the specified sync interval, which may mean you have to wait and then refresh the page for data to appear.

If no data appears after the sync interval, check the [**Logs**](/cloud/machines/#logs) and ensure that the condition for filtering is met.
You can add a [`transform` camera](/components/camera/transform/) to see detections or classifications live from the [**CONTROL** tab](/cloud/machines/#control).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems slightly unrelated to this alert. Consider moving/removing or at least adding a new line to make a separate paragraph.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed the alert around it

{{< /alert >}}
npentrel marked this conversation as resolved.
Show resolved Hide resolved

{{% /tablestep %}}
{{% tablestep %}}
{{<imgproc src="/services/ml/configure.svg" class="fill alignleft" style="max-width: 150px" declaredimensions=true alt="Train models">}}
**5. (Optional) Trigger sync with custom logic**
**7. (Optional) Trigger sync with custom logic**

By default, the captured data syncs at the regular interval you specified in the data capture config.
If you need to trigger sync in a different way, see [Trigger cloud sync conditionally](/services/data/trigger-sync/) for a documented example of syncing data only at certain times of day.
Expand Down
Loading