Previous
Upload external data
Reduce the volume of data your robot captures and syncs. Robots can generate gigabytes per day from cameras and sensors, but most of that data is redundant. Edge filtering means the machine decides what is worth recording or syncing, so you save bandwidth, storage costs, and noise in your datasets.
This is especially important for machines on cellular connections, metered networks, or with limited local storage.
This page covers three approaches, from simplest to most powerful:
The simplest filter is capturing less often. If you configured your camera at 1 Hz (one frame per second), consider whether you actually need that rate.
my-camera).1 Hz = 1 capture per second = ~2.5 GB/day for camera images0.1 Hz = 1 capture every 10 seconds = ~250 MB/day0.0167 Hz = 1 capture per minute = ~25 MB/day0.00028 Hz = 1 capture per hour = ~0.4 MB/dayThe change takes effect immediately. No restart required.
Start with the lowest frequency that meets your needs. You can always increase it later once you understand your data volume and bandwidth budget.
This approach works well when you need periodic snapshots but not continuous monitoring. It does not help when you need to capture specific events – for that, continue to the next techniques.
Conditional sync lets you capture data locally at full frequency but only upload it to the cloud when certain conditions are met. This is useful when you want a local buffer of recent data but only care about syncing data that meets specific criteria.
You configure conditional sync through the data management service in your machine’s configuration. The sync configuration supports conditions based on sensor readings, component states, or other data sources on your machine.
selective_syncer_name attribute to
specify a custom module that controls when sync occurs. This module
programmatically decides whether accumulated data should be synced based on
any logic you define – sensor thresholds, time of day, connectivity status,
or external triggers.For example, you might write a selective sync module that checks a temperature sensor and only triggers sync when the reading exceeds a threshold. The data management service calls into your module to determine whether to proceed with each sync cycle.
Conditional sync still captures data locally at your configured frequency. It only controls when that data gets uploaded. Make sure your machine has enough local storage for the capture buffer (see Manage local storage below).
You can use the filtered_camera registry module to selectively capture only images that contain certain objects or people, using a machine learning (ML) model.
The filtered camera wraps an existing camera and only outputs frames that match your ML model’s criteria, so only interesting frames are ever written to disk.
Add an ML model service to your machine
Add an ML model service on your machine that is compatible with the ML model you want to use, for example TFLite CPU.
Select a suitable ML model
Click Select model on the ML model service configuration panel, then select an existing model you want to use, or click Upload a new model to upload your own.
If you’re not sure which model to use, you can use EfficientDet-COCO from the Registry, which can detect people and animals, among other things.
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.
Add and configure the vision / ML model service on your machine.
From the Select model dropdown, select the name of your ML model service (for example, mlmodel-1).
Configure the filtered camera
The filtered-camera modular component pulls the stream of images from your camera component and applies the vision service to it.
Configure a filtered-camera component on your machine, following the attribute guide in the module listing.
Use the name of your camera component as the "camera" to pull images from, and select the name of the vision service you just configured as your "vision" service.
Then add all or some of the labels your ML model uses as classifications or detections in "classifications" or "objects".
For example, if you are using the EfficientDet-COCO model, you could use a configuration like the following to only capture images when a person is detected with more than 80% confidence in your camera stream.
{
"camera": "camera-1",
"vision_services": [
{
"vision": "vision-1",
"objects": {
"Person": 0.8
}
}
],
"window_seconds": 0
}
You can also add a buffer window with window_seconds, which controls the duration of a buffer of images captured before a successful match.
If you were to set window_seconds to 3, the camera would also capture and sync images from the 3 seconds before a person appeared in the camera stream.
Configure data capture and sync on the filtered camera
Configure data capture and sync on the filtered camera following the same process as described in Capture and sync data. The filtered camera will only capture image data that passes the filters you configured in the previous step.
Turn off data capture on your original camera component if you haven’t already, so that you don’t capture duplicate or unfiltered images.
Save to start capturing
Save the config. With cloud sync enabled, captured data is automatically uploaded to Viam after a short delay.
View filtered data on Viam
Once you save your configuration, place an object that your ML model can detect within view of your camera.
Images that pass your filter will be captured and will sync at the specified sync interval, which may mean you have to wait and then refresh the page for data to appear. Your images will begin to appear under the DATA tab.
If no data appears after the sync interval, check the Logs and ensure that the condition for filtering is met. You can test the vision service from the CONTROL tab to see its classifications and detections live.
(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 Conditional cloud sync for a documented example of syncing data only at certain times of day.
If the filtered_camera registry module doesn’t meet your needs, you can build a custom filtering module.
See Create a data filtering module for a full walkthrough, or Write a module for general module development guidance.
For filtering needs that go beyond what the filtered-camera module provides, you can write your own module. Common examples:
The pattern is: write a module that wraps an existing component, evaluates its data against your criteria, and only returns data worth capturing. Configure data capture on the wrapper component instead of the raw component.
See Write a module for the general module development guide. The key technique is accessing the source component through the dependencies parameter in your module’s reconfigure method.
On constrained machines (Raspberry Pi, Jetson Nano, single-board computers), local storage is limited. Understanding how Viam manages the capture directory helps you avoid filling the disk.
~/.viam/capture by default.You can configure the maximum storage that data capture will use on disk. In
your data management service configuration, set the maximum_capture_file_size_bytes
attribute to limit the size of individual capture files, and monitor the overall
capture directory size.
To check current disk usage of the capture directory:
du -sh ~/.viam/capture
To monitor it over time:
watch -n 60 du -sh ~/.viam/capture
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!