Dataset
A Dataset combines together images and annotations to facilitate processing.
Use a Dataset to:
-
query images and annotations in remo
-
annotate
-
export annotations
-
feed data to a training model
class remo.Dataset¶
Remo dataset
documentation
class remo.Dataset(id: int = None, name: str = None, quantity: int = 0, \*\*kwargs)
-
Parameters
-
id – dataset id
-
name – dataset name
-
quantity – number of images
-
add_annotations¶
Faster upload of annotations to the Dataset via file conversion.
If there are no Annotation Sets, an Annotation Set is automatically created. If annotation_set_id is not specified, annotations are added to the default Annotation Set. If the default Annotation Set’s task doesn’t match the annotations task, a new Annotation Set is also created.
documentation
add_annotations(annotations: List[remo.domain.annotation.Annotation], annotation_set_id: int = None)
-
Parameters
-
annotations – list of Annotation objects
-
annotation_set_id ((optional)) – annotation set id
-
add_data¶
Adds images and/or annotations to the dataset.
Use local files
to link (rather than copy) images. Use paths_to_upload
if you want to copy image files or archive files. Use urls
to download from the web images, annotations or archives.
Adding images: support for jpg
,``jpeg``, png
, tif
Adding annotations: to add annotations, you need to specify the annotation task and make sure the specific file format is one of those supported. See documentation here: https://remo.ai/docs/annotation-formats/
Adding archive files: support for zip
, tar
, gzip
documentation
add_data(local_files: List[str] = None, paths_to_upload: List[str] = None, urls: List[str] = None, annotation_task: str = None, folder_id: int = None, annotation_set_id: int = None, class_encoding=None)
-
Parameters
-
dataset_id – id of the dataset to add data to
-
local_files – list of files or directories containing annotations and image files Remo will create smaller copies of your images for quick previews but it will point at the original files to show original resolutions images. Folders will be recursively scanned for image files.
-
paths_to_upload – list of files or directories containing images, annotations and archives. These files will be copied inside .remo folder. Folders will be recursively scanned for image files. Unpacked archive will be scanned for images, annotations and nested archives.
-
urls – list of urls pointing to downloadable target, which can be image, annotation file or archive.
-
annotation_task – annotation tasks tell remo how to parse annotations. See also:
remo.task
. -
folder_id – specifies target virtual folder in the remo dataset. If None, it adds to the root level.
-
annotation_set_id – specifies target annotation set in the dataset. If None, it adds to the default annotation set.
-
class_encoding – specifies how to convert labels in annotation files to readable labels. If None, Remo will try to interpret the encoding automatically - which for standard words, means they will be read as they are. See also:
remo.class_encodings
.
-
-
Returns
Dictionary with results for linking files, upload files and upload urls:
{ 'files_link_result': ..., 'files_upload_result': ..., 'urls_upload_result': ... }
annotation_sets¶
Lists the annotation sets within the dataset
documentation
annotation_sets()
-
Returns
List[
remo.AnnotationSet
]
annotations¶
Returns all annotations for a given annotation set. If no annotation set is specified, the default annotation set will be used
documentation
annotations(annotation_set_id: int = None)
-
Parameters
annotation_set_id – annotation set id
-
Returns
List[
remo.Annotation
]
classes¶
Lists all the classes within the dataset
documentation
classes(annotation_set_id: int = None)
-
Parameters
annotation_set_id – annotation set id. If not specified the default annotation set is considered.
-
Returns
List of classes
create_annotation_set¶
Creates a new annotation set. If path_to_annotation_file is provided, it populates it with the given annotations.
documentation
create_annotation_set(annotation_task: str, name: str, classes: List[str], path_to_annotation_file: str = None)
-
Parameters
-
annotation_task – annotation task. See also:
remo.task
-
name – annotation set name
-
classes – list of classes. Example: [‘Cat’, ‘Dog’]
-
path_to_annotation_file – path to .csv annotation file
-
-
Returns
remo.AnnotationSet
default_annotation_set¶
If a default annotation set exists, it returns that annotation set. If a default annotation set doesn’t exist, it sets the first annotation set to be default and returns that annotation set.
documentation
default_annotation_set()
export_annotations¶
Export annotations for a given annotation set
documentation
export_annotations(annotation_set_id: int = None, annotation_format: str = 'json', export_coordinates: str = 'pixel', full_path: str = 'true')
-
Parameters
-
annotation_set_id – annotation set id, by default will be used default_annotation_set
-
annotation_format – can be one of [‘json’, ‘coco’, ‘csv’], default=’json’
-
export_coordinates – converts output values to percentage or pixels, can be one of [‘pixel’, ‘percent’], default=’pixel’
-
full_path – uses full image path (e.g. local path), can be one of [‘true’, ‘false’], default=’false’
-
-
Returns
annotation file content
export_annotations_to_file¶
Exports annotations in given format and save to output file
documentation
export_annotations_to_file(output_file: str, annotation_set_id: int = None, annotation_format: str = 'json', export_coordinates: str = 'pixel', full_path: str = 'true')
-
Parameters
-
output_file – output file to save
-
annotation_set_id – annotation set id
-
annotation_format – can be one of [‘json’, ‘coco’, ‘csv’], default=’json’
-
full_path – uses full image path (e.g. local path), can be one of [‘true’, ‘false’], default=’false’
-
export_coordinates – converts output values to percentage or pixels, can be one of [‘pixel’, ‘percent’], default=’pixel’
-
fetch¶
Updates dataset information from server
documentation
fetch()
get_annotation_set¶
Retrieves annotation set with given id. If no annotation set id is passed, it returns the default annotation set.
documentation
get_annotation_set(annotation_set_id: int = None)
-
Parameters
annotation_set_id – annotation set id
-
Returns
remo.AnnotationSet
get_annotation_statistics¶
Prints annotation statistics of all the available annotation sets within the dataset
documentation
get_annotation_statistics(annotation_set_id: int = None)
-
Returns
list of dictionaries with fields annotation set id, name, num of images, num of classes, num of objects, top3 classes, release and update dates
images¶
Lists images within the dataset
documentation
images(limit: int = None, offset: int = None)
-
Parameters
-
limit – the number of images to be listed
-
offset – specifies offset
-
-
Returns
List[
remo.Image
]
list_image_annotations¶
Retrieves annotations for a given image
documentation
list_image_annotations(annotation_set_id: int, image_id: int)
-
Parameters
-
annotation_set_id – annotation set id
-
image_id – image id
-
-
Returns
List[
remo.Annotation
]
search¶
Given a list of classes and annotation task, it returns a list of all the images with mathcing annotations
documentation
search(classes=None, task: str = None)
-
Parameters
-
classes – string or list of strings - search for images which match all given classes
-
task – annotation task. See also:
remo.task
-
-
Returns
subset of the dataset
set_default_annotation_set¶
Sets the default annotation set for a dataset. Important: default annotation sets are not stored in Remo, so every time a script runs the default annotation set will be assigned to the first annotation set that was created.
documentation
set_default_annotation_set(annotation_set_id: int)
-
Parameters
annotation_set_id – annotation set id
view¶
Opens browser on dataset page
documentation
view()
view_annotate¶
Opens browser on the annotation tool for the given annotation set
documentation
view_annotate(annotation_set_id: int = None)
-
Parameters
annotation_set_id – annotation set id. If not specified, default one be used.
view_annotation_stats¶
Opens browser on annotation set insights page
documentation
view_annotation_stats(annotation_set_id: int = None)
-
Parameters
annotation_set_id – annotation set id. If not specified, default one be used.
view_image¶
Opens browser on image view page for the given image
documentation
view_image(image_id: int)
-
Parameters
image_id – image id