Skip to content

ds2ai.Labelfile

class Labelfile(object)

This namespace represents each lebeling image files in LABELING AI.

init()

__init__(info, user, label_classes)
  • Parmeters:
    • info (str): Information about the current labeling project corresponding to the object
    • user (str): User for creating, modifying, deleting the label project
    • label_classes (list(Labelclass)): list of Label classes needed when labeling the current Labelfile object
  • Fields:
    • id: Project id.
    • file_name: name of the file
    • status: current status of the file in a project
    • file_url: url of the file for further connectivity
    • width: width of the image file
    • height: height of the image file
    • labelproject: the project that the image belongs to
    • label_classes: Label classes in the labeling projects
    • url: url for making progress in the project, comes from a new Util object
    • user: User information
    • user_token: User token information

repr()

Returns the current object's self.file_name as a printable format

__repr__()
  • Return type:
    • str

download()

Downloads the current image file to a designated file path

download(file_path="")
  • Parmeters:
    • file_path (str): path for where you want to download, current path set as default
  • Return type:
    • str

set_done()

Sets the current object's status as "done"

set_done(workAssignee=None)
  • Parmeters:
    • workAssignee (str): parameter for when you want to set a specific workAssignee's image, None set as default so that if not required, there's no need to enter
  • Return type:
    • requests(dict)r

create_label()

Create a label with a designated class name, color, and other details

create_label(label, class_name=None, color=None, box=[], polygon=[], structuredData=None)
  • Parmeters:
    • label (Label): Label object for the label that will be created
    • class_name (str): name of the class for labeling
    • color (str): hex code of the color for labeling
    • box (list): list of coordinates for box labeling
    • polygon (list): list of coordinates for polygon labeling
    • structuredData (list): whether if it's a structured data
  • Return type:
    • response(dict)

create_labels()

Create a label from self.create_label() function

create_labels(labels_raw)
  • Parmeters:
    • labels_raw (dict): dict including all the information for the current label, with the keys like 'labeltype', 'box', and etc.
  • Return type:
    • response(dict)

delete(): deletes current Labelfile object

delete()
  • Return type:
    • None