Upload a batch of data
If you configured the data management service, Viam automatically uploads data from the configured directory to the cloud, at the interval you specified. However, if you want to upload a batch of data once from somewhere else, either from a different directory on your machine or from your personal computer or mobile device, you have several options using the Viam app, the data client API, or the Viam mobile app.
In this page
- Sync a batch of data from another directory by configuring the path to the directory as an additional sync path in a machine’s data management service.
This requires the data to be on a machine running
viam-server
. - Upload data with the Python SDK by running a Python script to upload files from a folder.
You can do this on a computer that doesn’t have
viam-server
installed on it. - Upload images with the Viam mobile app from your mobile device.
Sync a batch of data from another directory
Typically, you configure the data service to sync data from your machine at regular intervals indefinitely. However, if you already have a cache of data you’d like to use with Viam, you can temporarily modify your configuration to sync a batch of data and then revert your config changes after the data is uploaded.
Prerequisites
Instructions
Note
This method of uploading data will delete the data from your machine once it is uploaded to the cloud.
If you do not want the data deleted from your machine, copy the data to a new folder and sync that folder instead so that your local copy remains.
1. Organize your data
Put the data you want to sync in a directory on your machine. All of the data in the folder will be synced, so be sure that you want to upload all of the contents of the folder.
2. Configure sync from the additional folder
In the Additional paths, enter the full path to the directory where the data you want to upload is stored, for example, /Users/Artoo/my_cat_photos
.
Toggle Syncing to on (green) if it isn’t already on.
Click Save in the top right corner of the page.
3. Confirm that your data uploaded
Navigate to your DATA page in the Viam app and confirm that your data appears there. If you don’t see your files yet, wait a few moments and refresh the page.
4. Remove the folder path
Once the data has uploaded, navigate back to your data service config. You can now delete the additional path you added. You can also turn off Syncing unless you have other directories you’d like to continue to sync from.
Upload data with Python
You can use the Python data client API file_upload_from_path
method to upload one or more files from your computer to the Viam Cloud.
Note
Unlike data sync, using the file_upload_from_path
API method uploads all the data even if that data already exists in the cloud.
In other words, it duplicates data if you run it multiple times.
Also unlike data sync, this method does not delete data from your device.
Prerequisites
Instructions
1. Get API key
Go to your organization’s setting page and create an API key for your individual machine part, machine, location, or organization.
2. Add a file_upload_from_path
API call
Create a Python script and use the file_upload_from_path
method to upload your data, depending on whether you are uploading one or multiple files:
To upload just one file, make a call to file_upload_from_path
.
To upload all the files in a directory, you can use the file_upload_from_path
method inside a for
loop.
3. Run your code
Save and run your code once. Running your code more than once will duplicate the data. View your uploaded data in your DATA page in the Viam app.
Upload images with the Viam mobile app
Upload images as machine data straight from your phone, skipping the normal data capture and cloud synchronization process, through the Viam mobile app. This is useful if you want to capture images for training machine learning models on the go.
Prerequisites
Instructions
1. Navigate to your machine
In the Viam mobile app, select an organization by clicking on the menu icon in the top left corner and tapping an organization.
Tap the Locations tab and select a location, then select the machine you want your data to be associated with.
2. Upload images
Tap the menu button marked “…” in the upper right corner. Tap Upload Images.
Select each image you want to upload, then tap Add.
The uploaded images metadata will contain the machine part you selected. However, the uploaded images will not be associated with a component or method.
Next steps
Now that you have a batch of data uploaded, you can train an ML model on it. Or, if you want to collect and upload data not in a batch, see Capture and Sync Image Data.
Have questions, or want to meet other people working on robots? Join our Community Discord.
If you notice any issues with the documentation, feel free to file an issue or edit this file.
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!