VideoDataset¶
- class VideoDataset[source]¶
Bases:
supervisely.project.project.Dataset
VideoDataset is where your labeled and unlabeled videos and other data files live.
VideoDataset
object is immutable.- Parameters
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ)
Methods
Adds given item file to dataset items directory, and adds given annotation to dataset annotations directory.
Adds given item file to dataset items directory, and adds given annotation to dataset annotations directory.
Not available for VideoDataset class object.
Not available for VideoDataset class object.
Adds given binary object as an image to dataset items directory, and adds given annotation to dataset ann directory.
datasets_dir
Delete image, image info and annotation from
Dataset
.Generates full path to the given item.
Read annotation of item from json.
Path to the given annotation json file.
get_classes_stats
Not available for VideoDataset class object.
Not available for VideoDataset class object.
Not available for VideoDataset class object.
Information for Item with given name.
Get path to the item info json file without checking if the file exists.
Get path to the item info json file without checking if the file exists.
Path to the given item.
Generates
VideoItemPaths
object with paths to item and annotation directories for item with given name.List of video dataset item names.
Not available for VideoDataset class object.
Get URL to dataset items list in Supervisely.
ignorable_dirs
Checks if given item name belongs to the video dataset.
This method is used to iterate over dataset items, receiving item name, path to image and path to annotation json file.
key
Replaces given annotation for given item name to dataset annotations directory in json format.
Replaces given annotation for given item name to dataset annotations directory in json format.
Replaces given annotation json for given item name to dataset annotations directory in json format.
Replaces given annotation json for given item name to dataset annotations directory in json format.
Replaces given annotation json file for given item name to dataset annotations directory in json format.
Replaces given annotation json file for given item name to dataset annotations directory in json format.
Convert Supervisely dataset to COCO format.
Convert Supervisely dataset to Pascal VOC format.
Convert Supervisely dataset to YOLO format.
Attributes
Path to the video dataset annotations directory.
str
: Annotations directory namedatasets_dir_name
Path to the video dataset directory.
If the dataset is opened from the API, returns the list of ImageInfo objects.
Not available for VideoDataset class object.
Not available for VideoDataset class object.
Path to the video dataset items directory.
str
: Items data directory namePath to the video dataset item with items info.
str
: Items info directory namePath to the dataset segmentation masks directory.
meta_dir_name
Video Dataset name.
Returns a relative local path to the dataset.
Path to the video project containing the video dataset.
Not available for VideoDataset class object.
str
: Segmentation masks directory nameShort dataset name, which does not include it's parents.
- annotation_class¶
alias of
supervisely.video_annotation.video_annotation.VideoAnnotation
- item_info_class¶
-
add_item_file(item_name, item_path, ann=
None
, _validate_item=True
, _use_hardlink=False
, item_info=None
)[source]¶ Adds given item file to dataset items directory, and adds given annotation to dataset annotations directory. if ann is None, creates empty annotation file.
- Parameters
- item_name :
str
Item name.
- item_path :
str
Path to the item.
- ann :
VideoAnnotation
orstr
, optional VideoAnnotation object or path to annotation json file.
- _validate_item :
bool
, optional Checks input files format.
- _use_hardlink :
bool
, optional If True creates a hardlink pointing to src named dst, otherwise don’t.
- item_info :
VideoInfo
ordict
orstr
, optional VideoInfo object or VideoInfo object converted to dict or path to item info json file for copying to dataset item info directory.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if item_name already exists in dataset or item name has unsupported extension.- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) ann = "/home/admin/work/supervisely/projects/videos_example/ds0/ann/video_8888.mp4.json" ds.add_item_file("video_8888.mp4", "/home/admin/work/supervisely/projects/videos_example/ds0/video/video_8888.mp4", ann=ann) print(ds.item_exists("video_8888.mp4")) # Output: True
-
async add_item_file_async(item_name, item_path, ann=
None
, _validate_item=True
, _use_hardlink=False
, item_info=None
, img_info=None
)¶ Adds given item file to dataset items directory, and adds given annotation to dataset annotations directory. If ann is None, creates empty annotation file.
- Parameters
- item_name :
str
Item name.
- item_path :
str
Path to the item.
- ann :
Annotation
orstr
, optional Annotation object or path to annotation json file.
- _validate_item :
bool
, optional Checks input files format.
- _use_hardlink :
bool
, optional If True creates a hardlink pointing to src named dst, otherwise don’t.
- item_info :
ImageInfo
ordict
orstr
, optional ImageInfo object or ImageInfo object converted to dict or path to item info json file for copying to dataset item info directory.
- img_info :
ImageInfo
ordict
orstr
, optional Deprecated version of item_info parameter. Can be removed in future versions.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if item_name already exists in dataset or item name has unsupported extension.- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) ann = "/home/admin/work/supervisely/projects/lemons_annotated/ds1/ann/IMG_8888.jpeg.json" loop = sly.utils.get_or_create_event_loop() loop.run_until_complete( ds.add_item_file_async("IMG_8888.jpeg", "/home/admin/work/supervisely/projects/lemons_annotated/ds1/img/IMG_8888.jpeg", ann=ann) ) print(ds.item_exists("IMG_8888.jpeg")) # Output: True
-
add_item_np(item_name, img, ann=
None
, img_info=None
)[source]¶ Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.
-
add_item_raw_bytes(item_name, item_raw_bytes, ann=
None
, img_info=None
)[source]¶ Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.
-
async add_item_raw_bytes_async(item_name, item_raw_bytes, ann=
None
, img_info=None
)¶ Adds given binary object as an image to dataset items directory, and adds given annotation to dataset ann directory. If ann is None, creates empty annotation file.
- Parameters
- item_name :
str
Item name.
- item_raw_bytes :
bytes
Binary object.
- ann :
Annotation
orstr
, optional Annotation object or path to annotation json file.
- img_info :
ImageInfo
ordict
orstr
, optional ImageInfo object or ImageInfo object converted to dict or path to item info json file for copying to dataset item info directory.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if item_name already exists in dataset or item name has unsupported extension- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) img_path = "/home/admin/Pictures/Clouds.jpeg" img_np = sly.image.read(img_path) img_bytes = sly.image.write_bytes(img_np, "jpeg") loop = sly.utils.get_or_create_event_loop() coroutine = ds.add_item_raw_bytes_async("IMG_050.jpeg", img_bytes) if loop.is_running(): future = asyncio.run_coroutine_threadsafe(coroutine, loop) future.result() else: loop.run_until_complete(coroutine) print(ds.item_exists("IMG_050.jpeg")) # Output: True
- delete_item(item_name)¶
Delete image, image info and annotation from
Dataset
.- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
True if item was successfully deleted, False if item wasn’t found in dataset.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) print(dataset.delete_item("IMG_0748")) # Output: False print(dataset.delete_item("IMG_0748.jpeg")) # Output: True
- generate_item_path(item_name)¶
Generates full path to the given item.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
Full path to the given item
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) print(ds.generate_item_path("IMG_0748.jpeg")) # Output: '/home/admin/work/supervisely/projects/lemons_annotated/ds1/img/IMG_0748.jpeg'
-
get_ann(item_name, project_meta, key_id_map=
None
)[source]¶ Read annotation of item from json.
- Parameters
- item_name :
str
Item name.
- project_meta :
ProjectMeta
ProjectMeta object.
- key_id_map :
KeyIdMap
, optional KeyIdMap object.
- item_name :
- Returns
VideoAnnotation object.
- Return type
- Raises
RuntimeError
if item not found in the project- Usage example
import supervisely as sly project_path = "/home/admin/work/supervisely/projects/videos_example" project = sly.VideoProject(project_path, sly.OpenMode.READ) ds = project.datasets.get('ds0') annotation = ds.get_ann("video_0748", project.meta) # Output: RuntimeError: Item video_0748 not found in the project. annotation = ds.get_ann("video_0748.mp4", project.meta) print(annotation.to_json()) # Output: { # "description": "", # "size": { # "height": 500, # "width": 700 # }, # "key": "e9ef52dbbbbb490aa10f00a50e1fade6", # "tags": [], # "objects": [], # "frames": [{ # "index": 0, # "figures": [] # }] # "framesCount": 1 # }
- get_ann_path(item_name)[source]¶
Path to the given annotation json file.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
Path to the given annotation json file.
- Return type
- Raises
RuntimeError
if item not found in the project- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.get_ann_path("video_0748")) # Output: RuntimeError: Item video_0748 not found in the project. print(ds.get_ann_path("video_0748.mp4")) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/ann/video_0748.mp4.json'
- get_image_info(item_name)[source]¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.- Return type
- get_img_info_path(img_name)[source]¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.- Return type
- get_img_path(item_name)[source]¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.- Return type
- get_item_info(item_name)[source]¶
Information for Item with given name.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
VideoInfo object.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.get_item_info("video_0748.mp4")) # Output: # VideoInfo( # id=198702499, # name='video_0748.mp4', # hash='ehYHLNFWmMNuF2fPUgnC/g/tkIIEjNIOhdbNLQXkE8Y=', # team_id=16087, # workspace_id=23821, # project_id=124974, # dataset_id=466639, # path_original='/h5un6l2bnaz1vj8a9qgms4-public/videos/w/7/i4/GZYoCs...9F3kyVJ7.mp4', # frames_to_timecodes=[0, 0.033367, 0.066733, 0.1001,...,10.777433, 10.8108, 10.844167], # frames_count=326, # frame_width=3840, # frame_height=2160, # created_at='2021-03-23T13:14:25.536Z', # updated_at='2021-03-23T13:16:43.300Z' # )
- get_item_info_path(item_name)[source]¶
Get path to the item info json file without checking if the file exists.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
Path to the given item info json file.
- Return type
- Raises
RuntimeError
if item not found in the project.- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.get_item_info_path("video_0748")) # Output: RuntimeError: Item video_0748 not found in the project. print(ds.get_item_info_path("video_0748.mp4")) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/video_info/video_0748.mp4.json'
- get_item_meta_path(item_name)¶
Get path to the item info json file without checking if the file exists.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
Path to the given item info json file.
- Return type
- Raises
RuntimeError
if item not found in the project.- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) print(ds.get_item_info_path("IMG_0748")) # Output: RuntimeError: Item IMG_0748 not found in the project. print(ds.get_item_info_path("IMG_0748.jpeg")) # Output: '/home/admin/work/supervisely/projects/lemons_annotated/ds1/img_info/IMG_0748.jpeg.json'
- get_item_path(item_name)[source]¶
Path to the given item.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
Path to the given item.
- Return type
- Raises
RuntimeError
if item not found in the project- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.get_item_path("video_0748")) # Output: RuntimeError: Item video_0748 not found in the project. print(ds.get_item_path("video_0748.mp4")) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/video/video_0748.mp4'
- get_item_paths(item_name)[source]¶
Generates
VideoItemPaths
object with paths to item and annotation directories for item with given name.- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
VideoItemPaths object
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) video_path, ann_path = dataset.get_item_paths("video_0748.mp4") print("video_path:", video_path) print("ann_path:", ann_path) # Output: # video_path: /home/admin/work/supervisely/projects/videos_example/ds0/video/video_0748.mp4 # ann_path: /home/admin/work/supervisely/projects/videos_example/ds0/ann/video_0748.mp4.json
- get_items_names()[source]¶
List of video dataset item names.
- Returns
List of item names.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.get_item_names()) # Output: ['video_0002.mp4', 'video_0005.mp4', 'video_0008.mp4', ...]
- get_seg_path(item_name)[source]¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.- Return type
- static get_url(project_id, dataset_id)[source]¶
Get URL to dataset items list in Supervisely.
- Parameters
- project_id :
int
VideoProject
ID in Supervisely.- dataset_id :
int
VideoDataset
ID in Supervisely.
- project_id :
- Returns
URL to dataset items list.
- Return type
- Usage example
from supervisely import VideoDataset project_id = 10093 dataset_id = 45330 ds_items_link = VideoDataset.get_url(project_id, dataset_id) print(ds_items_link) # Output: "/projects/10093/datasets/45330"
- item_exists(item_name)[source]¶
Checks if given item name belongs to the video dataset.
- Parameters
- item_name :
str
Item name.
- item_name :
- Returns
True if item exist, otherwise False.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) ds.item_exists("video_0748") # False ds.item_exists("video_0748.mp4") # True
- items()¶
This method is used to iterate over dataset items, receiving item name, path to image and path to annotation json file. It is useful when you need to iterate over dataset items and get paths to images and annotations.
- Returns
Generator object, that yields tuple of item name, path to image and path to annotation json file.
- Return type
Generator[Tuple[str]]
- Usage example
import supervisely as sly input = "path/to/local/directory" # Creating Supervisely project from local directory. project = sly.Project(input, sly.OpenMode.READ) for dataset in project.datasets: for item_name, image_path, ann_path in dataset.items(): print(f"Item '{item_name}': image='{image_path}', ann='{ann_path}'")
-
set_ann(item_name, ann, key_id_map=
None
)[source]¶ Replaces given annotation for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item name.
- ann :
VideoAnnotation
VideoAnnotation object.
- key_id_map :
KeyIdMap
, optional KeyIdMap object.
- item_name :
- Returns
None
- Return type
NoneType
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) height, width = 500, 700 new_ann = sly.VideoAnnotation((height, width), frames_count=0) ds.set_ann("video_0748.mp4", new_ann)
- async set_ann_async(item_name, ann)¶
Replaces given annotation for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item name.
- ann :
Annotation
Annotation object.
- item_name :
- Returns
None
- Return type
NoneType
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) height, width = 500, 700 new_ann = sly.Annotation((height, width)) loop = sly.utils.get_or_create_event_loop() coroutine = ds.set_ann_async("IMG_0748.jpeg", new_ann) if loop.is_running(): future = asyncio.run_coroutine_threadsafe(coroutine, loop) future.result() else: loop.run_until_complete(coroutine)
- set_ann_dict(item_name, ann)¶
Replaces given annotation json for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item name.
- ann :
dict
Annotation
as a dict in json format.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if ann_path is not str- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) new_ann_json = { "description":"", "size":{ "height":500, "width":700 }, "tags":[], "objects":[], "customBigData":{} } ds.set_ann_dict("IMG_8888.jpeg", new_ann_json)
- async set_ann_dict_async(item_name, ann)¶
Replaces given annotation json for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item name.
- ann :
dict
Annotation
as a dict in json format.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if ann_path is not str- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) new_ann_json = { "description":"", "size":{ "height":500, "width":700 }, "tags":[], "objects":[], "customBigData":{} } loop = sly.utils.get_or_create_event_loop() coroutine = ds.set_ann_dict_async("IMG_8888.jpeg", new_ann_json) if loop.is_running(): future = asyncio.run_coroutine_threadsafe(coroutine, loop) future.result() else: loop.run_until_complete(coroutine)
- set_ann_file(item_name, ann_path)¶
Replaces given annotation json file for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item Name.
- ann_path :
str
Path to the
Annotation
json file.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if ann_path is not str- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) new_ann = "/home/admin/work/supervisely/projects/kiwi_annotated/ds1/ann/IMG_1812.jpeg.json" ds.set_ann_file("IMG_1812.jpeg", new_ann)
- async set_ann_file_async(item_name, ann_path)¶
Replaces given annotation json file for given item name to dataset annotations directory in json format.
- Parameters
- item_name :
str
Item Name.
- ann_path :
str
Path to the
Annotation
json file.
- item_name :
- Returns
None
- Return type
NoneType
- Raises
RuntimeError
if ann_path is not str- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) new_ann = "/home/admin/work/supervisely/projects/kiwi_annotated/ds1/ann/IMG_1812.jpeg.json" loop = sly.utils.get_or_create_event_loop() coroutine = ds.set_ann_file_async("IMG_1812.jpeg", new_ann) if loop.is_running(): future = asyncio.run_coroutine_threadsafe(coroutine, loop) future.result() else: loop.run_until_complete(coroutine)
-
to_coco(meta, return_type=
'path'
, dest_dir=None
, copy_images=False
, with_captions=False
, log_progress=False
, progress_cb=None
)¶ Convert Supervisely dataset to COCO format.
- Note: Depending on the
return_type
andwith_captions
parameters, the function returns different values. If
return_type
is “path”, the COCO annotation files will be saved to the disk. Ifreturn_type
is “dict”, the function returns COCO dataset in dictionary format. Ifwith_captions
is True, the function returns Tuple (instances and captions).
- Parameters
- meta :
ProjectMeta
Project meta information.
- return_type :
str
, optional - dest_dir :
str
, optional Path to save COCO dataset.
- copy_images :
bool
, optional If True, copies images to the COCO dataset directory.
- with_captions :
bool
, optional If True, returns captions
- log_progress :
str
, optional If True, log progress.
- progress_cb :
Callable
, optional Progress callback.
- meta :
- Returns
COCO dataset in dictionary format.
- Return type
- Usage example
import supervisely as sly project_path = "/home/admin/work/supervisely/projects/lemons_annotated" project = sly.Project(project_path, sly.OpenMode.READ) for ds in project.datasets: dest_dir = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" coco: Tuple[Dict, Dict] = ds.to_coco(project.meta, save=True, dest_dir=dest_dir)
- Note: Depending on the
-
to_pascal_voc(meta, dest_dir=
None
, train_val_split_coef=0.8
, log_progress=False
, progress_cb=None
)¶ Convert Supervisely dataset to Pascal VOC format.
- Parameters
- meta :
ProjectMeta
Project meta information.
- dest_dir :
str
, optional Destination directory.
- train_val_split_coef :
float
, optional Coefficient for splitting images into train and validation sets.
- log_progress :
str
, optional If True, log progress.
- progress_cb :
Callable
, optional Progress callback.
- meta :
- Returns
None
- Return type
NoneType
- Usage example
import supervisely as sly project_path = "/home/admin/work/supervisely/projects/lemons_annotated" project = sly.Project(project_path, sly.OpenMode.READ) for ds in project.datasets: dest_dir = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds.to_pascal_voc(project.meta, dest_dir=dest_dir)
-
to_yolo(meta, dest_dir=
None
, task_type='detection'
, log_progress=False
, progress_cb=None
)¶ Convert Supervisely dataset to YOLO format.
- Parameters
- meta :
ProjectMeta
Project meta information.
- dest_dir :
str
, optional Path to save YOLO dataset.
- task_type :
str
, optional Task type.
- log_progress :
str
, optional If True, log progress.
- progress_cb :
Callable
, optional Progress callback.
- meta :
- Returns
YOLO dataset in dictionary format.
- Return type
- Usage example
import supervisely as sly project_path = "/home/admin/work/supervisely/projects/lemons_annotated" project = sly.Project(project_path, sly.OpenMode.READ) for ds in project.datasets: dest_dir = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds.to_yolo(project.meta, dest_dir=dest_dir)
- property ann_dir¶
Path to the video dataset annotations directory.
- Returns
Path to the video dataset directory with annotations.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.ann_dir) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/ann'
- property directory¶
Path to the video dataset directory.
- Returns
Path to the video dataset directory.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.directory) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0'
- property image_infos¶
If the dataset is opened from the API, returns the list of ImageInfo objects. Otherwise raises an exception.
- Raises
ValueError: If the dataset is opened in local mode.
- Returns
List of ImageInfo objects.
- Return type
List[
ImageInfo
]
- property img_dir¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.- Return type
- property img_info_dir¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.
- property item_dir¶
Path to the video dataset items directory.
- Returns
Path to the video dataset items directory.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.item_dir) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/video'
- property item_info_dir¶
Path to the video dataset item with items info.
- Returns
Path to the video dataset directory with items info.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.item_info_dir) # Output: '/home/admin/work/supervisely/projects/videos_example/ds0/video_info'
- property meta_dir¶
Path to the dataset segmentation masks directory.
- Returns
Path to the dataset directory with masks.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) print(ds.meta_dir) # Output: '/home/admin/work/supervisely/projects/lemons_annotated/ds1/meta'
- property name¶
Video Dataset name.
- Returns
Video Dataset Name.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.name) # Output: "ds0"
- property path¶
Returns a relative local path to the dataset.
- Returns
Relative local path to the dataset.
- Return type
- property project_dir¶
Path to the video project containing the video dataset.
- Returns
Path to the video project.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/videos_example/ds0" ds = sly.VideoDataset(dataset_path, sly.OpenMode.READ) print(ds.project_dir) # Output: "/home/admin/work/supervisely/projects/videos_example"
- property seg_dir¶
Not available for VideoDataset class object. :raises:
NotImplementedError
in all cases.
- property short_name¶
Short dataset name, which does not include it’s parents. To get the full name of the dataset, use
name
.- Returns
Dataset Name.
- Return type
- Usage example
import supervisely as sly dataset_path = "/home/admin/work/supervisely/projects/lemons_annotated/ds1" ds = sly.Dataset(dataset_path, sly.OpenMode.READ) print(ds.name) # Output: "ds1"