Filter at the edge
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:
- Reduce capture frequency – capture less often.
- Use a filtered camera – use an ML model to decide frame-by-frame what to capture.
- Conditional sync – capture locally but only sync when conditions are met.
Reduce capture frequency (time-based sampling)
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.
- In the Viam app, navigate to your machine’s CONFIGURE tab.
- Find the component you are capturing from (for example,
my-camera). - In the Data capture section, find the capture method you configured.
- Change the frequency to a lower value:
1Hz = 1 capture per second = ~2.5 GB/day for camera images0.1Hz = 1 capture every 10 seconds = ~250 MB/day0.0167Hz = 1 capture per minute = ~25 MB/day0.00028Hz = 1 capture per hour = ~0.4 MB/day
- Click Save.
The change takes effect immediately. No restart required.
Tip
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.
Configure conditional sync
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.
- In the Viam app, go to your machine’s CONFIGURE tab.
- Find the data management service in your configuration. If you do not see it, add it by clicking +, selecting Service, and choosing data management.
- In the data management service configuration, set the Sync interval to control how frequently synced data is uploaded. A longer interval means data accumulates locally before being sent in batches.
- To add sync conditions, you can use the
selective_syncer_nameattribute 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.
Note
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).
Use a filtered camera with ML
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.
Prerequisites
- A configured camera component on your machine. See Configure a camera if you need to set one up.
- The data management service configured. See Capture and sync edge data for instructions.
Instructions
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.
Build your own filtering module
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.
Build a custom filter module
For filtering needs that go beyond what the filtered-camera module provides, you can write your own module. Common examples:
- A sensor wrapper that only reports readings above a threshold (for example, temperature above 50 degrees C)
- A camera filter with custom logic specific to your application
- A filter that combines data from multiple sensors before deciding what to capture
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.
Manage local storage
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.
How local storage works
- Captured data is written to
~/.viam/captureby default. - Each capture creates a file (JPEG for images, JSON for tabular data).
- The sync process uploads files and deletes them after successful upload.
- If sync is disabled or the network is down, files accumulate locally.
Configure storage limits
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
Best practices for constrained machines
- Use the lowest capture frequency that meets your needs. Every reduction in frequency directly reduces storage pressure.
- Enable sync. Without sync, local storage fills indefinitely.
- Use filtered capture. The filtered camera and threshold sensor modules above reduce what gets written to disk, not just what gets synced.
- Monitor disk space. Set up a simple cron job or health check that alerts you when the capture directory exceeds a size threshold.
- Adjust sync interval. A shorter sync interval (for example, every 30 seconds) keeps the local buffer small. A longer interval (for example, every 5 minutes) reduces network requests but requires more local storage.
Try it
Verify your filtering is working
- Configure one of the filtering techniques above on your machine.
- Open the DATA tab in the Viam app.
- Compare data volume before and after filtering:
- Check how many new entries appear per minute with your filter active.
- Compare to the rate you saw in Capture and sync data before filtering.
- For the filtered camera, verify that captured images show meaningful variation between consecutive frames.
Troubleshooting
What’s next
- Query data – write SQL and MQL queries against your filtered, high-signal dataset.
- Create a dataset – use filtered captures to build cleaner training datasets for ML models.
- Write a module – learn more about building and deploying custom modules on Viam.
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!