Label Module =============================== The label module contains the classes and function related to labelling. DetectionLabel -------------- The DetectionLabel class is used to store the information of a label. It contains the following attributes: - color: str - name: str - type: enum (OBJECT, ACTION) - category: enum (DETECTION, CLASSIFICATION) - id: str - label_id: str - is_deleted: bool To create a DetectionLabel object, you can use the ``DetectionLabel.create()`` function: .. py:function:: DetectionLabel.create(name, type, category, description, client, color) Create a DetectionLabel :param name: name of the label :param type: type of the label :param category: category of the label :param description: description of the label :param client: token of the user. :param color: color of the label :type name: str :type type: enum (OBJECT, ACTION) :type category: enum (DETECTION, CLASSIFICATION) :type description: str :type client: deeplabel.client.BaseClient :type color: str :return: DetectionLabel object :rtype: DetectionLabel The labels can be retrieved using the ``DetectionLabel.from_search_params()`` function: .. py:function:: DetectionLabel.from_search_params(params, client) Retrieve a list of DetectionLabel objects :param params: search parameters :param client: token of the user. :type client: deeplabel.client.BaseClient :type sparams: dict :return: list of DetectionLabel objects :rtype: list of DetectionLabel LabelMap -------------- The LabelMap class is used to store the information of detection label. It contains the following attributes: - label_id: str - label: DetectionLabel - name_lower: str - project_id: str To add labels to a project, we can use the ``LabelMap.add_labels_to_project()`` function: .. py:function:: LabelMap.add_labels_to_project(project_id, label_ids, client) Add labels to a project :param project_id: id of the project :param label_ids: list of label ids :param client: token of the user. :type project_id: str :type label_ids: list of str :type client: deeplabel.client.BaseClient :return: list of LabelMap objects :rtype: list of LabelMap To get the label maps we can use the ``LabelMap.from_search_params()`` function: .. py:function:: LabelMap.from_search_params(params, client) Retrieve a list of LabelMap objects :param params: search parameters :param client: token of the user. :type client: deeplabel.client.BaseClient :type sparams: dict :return: list of LabelMap objects :rtype: list of LabelMap Folder ----------------- The folders in deeplabel can be of type VIDEO and GALLERY. In deeplabel-sdk, we have a root folder (RootFolder) which has attributes: - folder_id: str - type: enum - project_id: str The root folder also has properties: - folders: list of Folder objects - videos: list of Video objects - galleries: list of Gallery objects There is a Folder class which inherits from RootFolder and has the following attributes: - folder_id: str - description: str - name: str - parent_folder_id: str - ancestor_folder_id: List[str] To create a folder use the ``Folder.create()`` function: .. py:function:: Folder.create(name,project_id, client,type, description, parent_folder_id="project") Create a folder. :param name: name of the folder. :param project_id: project_id in which folder is created. :param parent_folder_id: parent folder id of the folder. :param type: type of the folder. :param description: description of the folder. :param client: token of the user. :type name: str :type project_id: str :type parent_folder_id: str :type type: enum :type description: str :type client: deeplabel.client.BaseClient :return: Folder object :rtype: Folder We can fetch the folder using folder_id, project_id and search_params. Using the ``Folder.from_folder_id()`` function: .. py:function:: Folder.from_folder_id(folder_id, client) Return the folder object from the folder_id. :param folder_id: folder_id :param client: token of the user. :type folder_id: str :type client: deeplabel.client.BaseClient :return: Folder object :rtype: Folder Using the ``Folder.from_project_id()`` function: .. py:function:: Folder.from_project_id(project_id, client) Return the folder object from the project_id. :param project_id: project_id of the folder. :param client: token of the user. :type project_id: str :type client: deeplabel.client.BaseClient :return: List of Folder object :rtype: List Using the ``Folder.from_search_params()`` function: .. py:function:: Folder.from_search_params(params, client) Return the folder object from the search_params. :param params: search_params for the folder. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Folder object :rtype: List DlModels ----------------- The DlModel class contains the information regarding the DlModel. It has following attributes: - dl_model_id: str - url: str - description: str - sequence: SequenceInfo (length, sampling_rate) - status: - name: str - architecture: str - category: enum (DETECTION, CLASSIFICATION, ACTION-RECOGNITION) - type: enum (OBJECT, ACTION) It also has different properties: - generate_zip_url: Generates the presigned url for the model if the model zip file is present in s3. - name: List of labels from the model.names file. - name_filter: Get dlmodel labels from model.names.filter or model.names.include file. The DlModel can be fetched using the dl_model_id and search_params. Using the ``DlModel.from_dl_model_id()`` function: .. py:function:: DlModel.from_dl_model_id(dl_model_id, client) Return the DlModel object from the dl_model_id. :param dl_model_id: dl_model_id :param client: token of the user. :type dl_model_id: str :type client: deeplabel.client.BaseClient :return: DlModel object :rtype: DlModel Using the ``DlModel.from_search_params()`` function: .. py:function:: DlModel.from_search_params(params, client) Return the DlModel object from the search_params. :param params: search_params for the DlModel. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of DlModel object :rtype: List Video ----------------- The video folder in the label of deeplabel-sdk containes all the information related to the labelling of the videos in deeplabel. The video class has the following attributes: - video_id: str - title: str - project_id:str - input_url: str - thumbnail_url: str - status: The labelling is done in different steps. Each step has its own status. The Differnt stags of labelling are: - download - assign_resources - extraction - frames_extraction - inference - label - review - labelling Each of these steps can have the following status along with start_time and end_time: - TBD - IN_PROGRESS - SUCCESS - FAILURE - CANCELLED - ABORTED - HOLD - RETRY - REDO - extraction_points: List of ExtractionPoints (labelling_fps, start_time, end_time) - duration: float - video_fps: float - labelling_fps: int - is_feedback: bool It also contains following properties: - video_url: It is used to generate a new presigned url for the video if the current url has expired. We can also fetch all the video_graph and video_task of the video using the property video_graphs and video_tasks respectively. - ext: Extenion of the video, deduced from path/name - detections: detections of the video - frames: frames of the video - tasks: tasks of the video Different methods in the Video class are: To create a video use the ``Video.create()`` function: .. py:function:: Video.create(input_url, project_id, client, parent_folder_id="project", is_feedback=False) Create a video. :param input_url: url of the video. :param project_id: project_id in which video is created. :param parent_folder_id: parent folder id of the video. :param client: token of the user. :param is_feedback: Is it a feedback. :type input_url: str :type project_id: str :type parent_folder_id: str :type client: deeplabel.client.BaseClient :type is_feedback: bool :return: Video object :rtype: Video The videos can be fetched using video_id and search_params. To fetch the video using video_id use the ``Video.from_video_id()`` function: .. py:function:: Video.from_video_id(video_id, client) Return the video object from the video_id. :param video_id: video_id of the video. :param client: token of the user. :type video_id: str :type client: deeplabel.client.BaseClient :return: Video object :rtype: Video To fetch the video using search_params use the ``Video.from_search_params()`` function: .. py:function:: Video.from_search_params(params, client) Return the video object from the search_params. :param params: search_params for the video. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Video object :rtype: List We can insert the extraction time points if the video has an extraction task using the ``Video.set_extraction_points()`` function: .. py:function:: Video.set_extraction_points( extraction_timepoints, client) Set the extraction points for the video. :param extraction_timepoints: extraction_ptimeoints for the video. :param client: token of the user. :type extraction_points: List of ExtractionPoints :type client: deeplabel.client.BaseClient :return: Video object :rtype: Video Video Detection ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Inferred videos detections can be fetched using the Detection class. The Detection class has the following attributes: - is_reviewed: bool - type: Enum (BOUNDING_BOX, POLYGON, CLASSIFICATION) - bounding_box: BoundingBox - polygon: Polygon - label: DetectionLabel - detection_id: str - video_id: str - frame_id: str - sequence_id: str The detections can be fetched using detection_id, video_id_and_project_id and search_params. To fetch the detection using detection_id use the ``Detection.from_detection_id()`` function: .. py:function:: Detection.from_detection_id(detection_id, client) Return the detection object from the detection_id. :param detection_id: detection_id of the detection. :param client: token of the user. :type detection_id: str :type client: deeplabel.client.BaseClient :return: Detection object :rtype: Detection To fetch the detection using video_id_and_project_id use the ``Detection.from_video_id_and_project_id()`` function: .. py:function:: Detection.from_video_id_and_project_id(video_id, project_id, client) Return the detection object from the video_id_and_project_id :param video_id: video_id of the detection. :param project_id: project_id of the detection. :param client: token of the user. :type video_id: str :type project_id: str :type client: deeplabel.client.BaseClient :return: List of Detection object :rtype: List To fetch the detection using search_params use the ``Detection.from_search_params()`` function: .. py:function:: Detection.from_search_params(params, client) Return the detection object from the search_params. :param params: search_params for the detection. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Detection object :rtype: List VideoTask ^^^^^^^^^^^^^^^^^^^^^^ The VideoTask class has the following attributes: - video_task_id: str - timestamp: {created_at, modified_at} - video: {title, video_id} - project: {title, project_id} - status: enum (TBD, IN_PROGRESS, SUCCESS, ABORTED, FAILURE) - assignee: {name, user_id} - is_deleted: bool - name: str Video Tasks can be fetched from video_task_id, video_id and search_params. To fetch the video_task using video_task_id use the ``VideoTask.from_video_task_id()`` function: .. py:function:: VideoTask.from_video_task_id(video_task_id, client) Return the video_task object from the video_task_id. :param video_task_id: video_task_id of the video_task. :param client: token of the user. :type video_task_id: str :type client: deeplabel.client.BaseClient :return: VideoTask object :rtype: VideoTask To fetch the video_task using video_id use the ``VideoTask.from_video_id()`` function: .. py:function:: VideoTask.from_video_id(video_id, client) Return the video_task object from the video_id. :param video_id: video_id of the video_task. :param client: token of the user. :type video_id: str :type client: deeplabel.client.BaseClient :return: List of VideoTask object :rtype: List To fetch the video_task using search_params use the ``VideoTask.from_search_params()`` function: .. py:function:: VideoTask.from_search_params(params, client) Return the video_task object from the search_params. :param params: search_params for the video_task. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of VideoTask object :rtype: List To update the status of the video_task use the ``VideoTask.update_status()`` function: .. py:function:: VideoTask.update_status(status, client) Update the status of the video_task. :param status: status of the video_task. :param client: token of the user. :type status: enum :type client: deeplabel.client.BaseClient :return: VideoTask object :rtype: VideoTask Video Frame ^^^^^^^^^^^^^^^^^^^^^^ The frame class has the following attributes: - displayed: bool - review_comment: str - name: str - number: int - is_deleted: bool - parent_folder_id: str - resolution: {width, height} - frame_id: str - video_id: str - frame_url: str - frame_number: int - point_in_time: float - detections: List of Detection objects - assignee: str The frames can be fetched from frame_id, video_id_and_project_id and search_params. To fetch the frame using frame_id use the ``Frame.from_frame_id()`` function: .. py:function:: Frame.from_frame_id(frame_id, client) Return the frame object from the frame_id. :param frame_id: frame_id of the frame. :param client: token of the user. :type frame_id: str :type client: deeplabel.client.BaseClient :return: Frame object :rtype: Frame To fetch the frame using video_id_and_project_id use the ``Frame.from_video_id_and_project_id()`` function: .. py:function:: Frame.from_video_id_and_project_id(video_id, project_id, client) Return the frame object from the video_id_and_project_id :param video_id: video_id of the frame. :param project_id: project_id of the frame. :param client: token of the user. :type video_id: str :type project_id: str :type client: deeplabel.client.BaseClient :return: List of Frame object :rtype: List To fetch the frame using search_params use the ``Frame.from_search_params()`` function: .. py:function:: Frame.from_search_params(params, client) Return the frame object from the search_params. :param params: search_params for the frame. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Frame object :rtype: List Gallery ----------------- The Gallery class consists of the following attributes: - gallery_id: str - title: str - description: str - is_deleted: bool - parent_folder_id: str - project_id: str - owner_id: str - status: The labelling is done in different steps. Each step has its own status. The Differnt stags of labelling are: - submit - assign_resources - inference - label - review - labelling Each of these steps can have the following status along with start_time and end_time: - TBD - IN_PROGRESS - SUCCESS - FAILURE - CANCELLED - ABORTED - HOLD It has a property images which fetches all the images present in the gallery. And the tasks property is used to fetch the gallery tasks. Gallery can be fetched using gallery_id, folder_id and search_params. To create a gallery use the ``Gallery.create()`` function: .. py:function:: Gallery.create(title, project_id, client) Create a gallery. :param title: name of the gallery. :param project_id: project_id in which gallery is created. :param client: token of the user. :type title: str :type project_id: str :type client: deeplabel.client.BaseClient :return: Gallery object :rtype: Gallery To fetch the gallery using gallery_id use the ``Gallery.from_gallery_id()`` function: .. py:function:: Gallery.from_gallery_id(gallery_id, client) Return the gallery object from the gallery_id. :param gallery_id: gallery_id of the gallery. :param client: token of the user. :type gallery_id: str :type client: deeplabel.client.BaseClient :return: Gallery object :rtype: Gallery To fetch the gallery using search_params use the ``Gallery.from_search_params()`` function: .. py:function:: Gallery.from_search_params(params, client) Return the gallery object from the search_params. :param params: search_params for the gallery. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Gallery object :rtype: List To submit a gallery for labelling, use the ``Gallery.submit_for_labelling()`` function: Gallery Detection ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The Detection class consists of the following attributes: - detection_id: str - is_reviewed: bool - type: Enum (IMAGE_BOUNDING_BOX, IMAGE_POLYGON, IMAGE_CLASSIFICATION) - bounding_box: BoundingBox - polygon: Polygon - label: str The gallery detections can fetched using detection_id, image_id and search_params. To fetch the detection using detection_id use the ``Detection.from_detection_id()`` function: .. py:function:: Detection.from_detection_id(detection_id, client) Return the detection object from the detection_id. :param detection_id: detection_id of the detection. :param client: token of the user. :type detection_id: str :type client: deeplabel.client.BaseClient :return: Detection object :rtype: Detection To fetch the detection using image_id use the ``Detection.image_id()`` function: .. py:function:: Detection.from_image_id(image_id, client) Return the detection object from the image_id. :param image_id: image_id of the detection. :param client: token of the user. :type image_id: str :type client: deeplabel.client.BaseClient :return: List of Detection object :rtype: List To fetch the detection using search_params use the ``Detection.from_search_params()`` function: .. py:function:: Detection.from_search_params(params, client) Return the detection object from the search_params. :param params: search_params for the detection. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Detection object :rtype: List GalleryTask ^^^^^^^^^^^^^^^^^^^^^^ The GalleryTask class consists of the following attributes: - gallery_task_id: str - timestamp: {created_at, modified_at} - status: enum (TBD, IN_PROGRESS, SUCCESS, ABORTED, FAILURE, NOT_AVAILABLE) - dl_model_id: str - gallery: {title, gallery_id} - project: {title, project_id} - assignee: {name, user_id} - name: str Gallery Tasks can be fetched from gallery_task_id, gallery_id and search_params. To fetch the gallery_task using gallery_task_id use the ``GalleryTask.from_gallery_task_id()`` function: .. py:function:: GalleryTask.from_gallery_task_id(gallery_task_id, client) Return the gallery_task object from the gallery_task_id. :param gallery_task_id: gallery_task_id of the gallery_task. :param client: token of the user. :type gallery_task_id: str :type client: deeplabel.client.BaseClient :return: GalleryTask object :rtype: GalleryTask To fetch the gallery_task using gallery_id use the ``GalleryTask.from_gallery_id()`` function: .. py:function:: GalleryTask.from_gallery_id(gallery_id, client) Return the gallery_task object from the gallery_id. :param gallery_id: gallery_id of the gallery_task. :param client: token of the user. :type gallery_id: str :type client: deeplabel.client.BaseClient :return: List of GalleryTask object :rtype: List To fetch the gallery_task using search_params use the ``GalleryTask.from_search_params()`` function: .. py:function:: GalleryTask.from_search_params(params, client) Return the gallery_task object from the search_params. :param params: search_params for the gallery_task. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of GalleryTask object :rtype: List To update the status of the gallery_task use the ``GalleryTask.update_status()`` function: .. py:function:: GalleryTask.update_status(status, client) Update the status of the gallery_task. :param status: status of the gallery_task. :param client: token of the user. :type status: enum :type client: deeplabel.client.BaseClient :return: GalleryTask object :rtype: GalleryTask Images ^^^^^^^^^^^^^^^^^^^^^ The Image class consists of the following attributes: - image_id: str - gallery_id: str - image_url: str - assignee: str - project_id: str - name: str - displayed: bool - parent_folder_id: str - resolution: {height, width} - is_deleted: bool - detections: List of Detection objects To create a image use the ``Image.create()`` function: .. py:function:: Image.create(url, gallery_id, height, width, client) Create a image. :param gallery_id: gallery_id in which image is created. :param age_url: url of the image. :param client: token of the user. :param height: height of the image. :param width: width of the image. :type gallery_id: str :type image_url: str :type client: deeplabel.client.BaseClient :type height: int :type width: int :return: Image object :rtype: Image The images can be fetched using image_id, gallery_and_project_id and search_params. To fetch the image using image_id use the ``Image.from_image_id()`` function: .. py:function:: Image.from_image_id(image_id, client) Return the image object from the image_id. :param image_id: image_id of the image. :param client: token of the user. :type image_id: str :type client: deeplabel.client.BaseClient :return: Image object :rtype: Image To fetch the image using gallery_and_project_id use the ``Image.from_gallery_and_project_id()`` function: .. py:function:: Image.from_gallery_and_project_id(gallery_id, project_id, client) Return the image object from the gallery_and_project_id. :param gallery_id: gallery_id of the image. :param project_id: project_id of the image. :param client: token of the user. :type gallery_id: str :type project_id: str :type client: deeplabel.client.BaseClient :return: List of Image object :rtype: List To fetch the image using search_params use the ``Image.from_search_params()`` function: .. py:function:: Image.from_search_params(params, client) Return the image object from the search_params. :param params: search_params for the image. :param client: token of the user. :type params: dict :type client: deeplabel.client.BaseClient :return: List of Image object :rtype: List