Add Local Data to Datasets
All Datasets are identified using a unique ID called a \<dataset_hash>
. The \<dataset_hash>
can be found by clicking a Dataset in the Encord platform.
Upload private cloud data
All types of data (videos, images, image groups, image sequences, and DICOM) from a private cloud are added to a Dataset in the exact same way.
Use the script below to upload your private cloud data to a specified Dataset.
-
Replace <dataset_hash> with the ID of the Dataset you want to upload your data to.
-
Replace <integration_title> with the title of the integration you want to use. You can see all available integrations in the Encord platform, or using the SDK.
-
Replace
path/to/json/file.json
with the path to your JSON file.
"Upload is still in progress, try again later!"
, check the upload status at a later time. Check data upload
If the code returns "Upload is still in progress, try again later!"
, run the following code to query the Encord server again. Replace upload_job_id
with the output by the previous code. In the example above upload_job_id=c4026edb-4fw2-40a0-8f05-a1af7f465727
.
timeout_seconds
argument from the add_private_data_to_dataset_get_result() method performs status checks until the status upload has finished.Local data
Uploading videos
Use the upload_video() method to upload a video to a Dataset specified using the \<dataset_hash>
.
Uploading single images
Use the upload_image() method to upload a single image to a dataset specified using the \<dataset_hash>
.
Uploading image groups & image sequences
Use the create_image_group() method to combine images into image groups and image sequences, and add it to a Dataset.
Image groups
Image groups are created using the create_image_group()
method with create_video=False
as an argument. Specify the file paths of each image you want to include in the image group in the script below.
data_sequence number
, which is based on the order or the files listed in the argument to create_image_group()
. If the ordering is important to you, make sure that your filenames are listed in the correct order.Image sequences
Image sequences are created using the create_image_group()
method. Image sequences can only be composed of images that have the same dimensions. Images with different dimensions are made into separate image sequences. Learn more about image sequences here.
create_video
is set to True
by default and can therefore be omitted when creating an image sequence.img1.jpeg
and img2.jpeg
are of shape [1920, 1080] and [1280, 720], respectively, each ends up in their own image sequence.Uploading DICOM series
In the following script, replace path/to/your/dicom-img1.dcm
and the other example file paths with the paths to the files you want to include in your DICOM series.
Reading and updating data
To inspect data within a dataset use the .data_rows()
property in the Dataset class. .data_rows()
returns a list of DataRows.
Was this page helpful?