Skip to content

unitorch.cli.models¤

Image¤

Processor for image-related operations.

Initializes a new instance of the ImageProcessor.

Parameters:

Name Type Description Default
image_type Optional[str]

The type of the image. Defaults to None.

None
image_size tuple

The size of the image. Defaults to (256, 256).

(256, 256)
http_url Optional[str]

The URL for fetching images. Defaults to None.

None
Source code in src/unitorch/cli/models/image_utils.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def __init__(
    self,
    image_type: Optional[str] = None,
    image_size: tuple = (256, 256),
    http_url: Optional[str] = None,
):
    """
    Initializes a new instance of the ImageProcessor.

    Args:
        image_type (Optional[str]): The type of the image. Defaults to None.
        image_size (tuple): The size of the image. Defaults to (256, 256).
        http_url (Optional[str]): The URL for fetching images. Defaults to None.
    """
    self.image_type = image_type
    self.image_size = image_size
    self.http_url = http_url

from_core_configure classmethod ¤

from_core_configure(config, **kwargs)

Creates a new instance of the ImageProcessor using the configuration from the core.

Parameters:

Name Type Description Default
config

The configuration object.

required
**kwargs

Additional keyword arguments.

{}

Returns:

Type Description

An instance of the ImageProcessor.

Source code in src/unitorch/cli/models/image_utils.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@classmethod
@add_default_section_for_init("core/process/image")
def from_core_configure(cls, config, **kwargs):
    """
    Creates a new instance of the ImageProcessor using the configuration from the core.

    Args:
        config: The configuration object.
        **kwargs: Additional keyword arguments.

    Returns:
        An instance of the ImageProcessor.
    """
    pass

Labels¤

Processor for label-related operations.

Initializes a new instance of the LabelProcessor.

Parameters:

Name Type Description Default
num_classes Optional[int]

The number of classes. Defaults to None.

None
sep Optional[str]

The separator used for splitting text. Defaults to ",".

','
max_seq_length Optional[int]

The maximum sequence length. Defaults to 128.

128
map_dict Optional[Dict]

A dictionary for mapping labels. Defaults to an empty dictionary.

dict()
Source code in src/unitorch/cli/models/label_utils.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def __init__(
    self,
    num_classes: Optional[int] = None,
    sep: Optional[str] = ",",
    max_seq_length: Optional[int] = 128,
    map_dict: Optional[Dict] = dict(),
):
    """
    Initializes a new instance of the LabelProcessor.

    Args:
        num_classes (Optional[int]): The number of classes. Defaults to None.
        sep (Optional[str]): The separator used for splitting text. Defaults to ",".
        max_seq_length (Optional[int]): The maximum sequence length. Defaults to 128.
        map_dict (Optional[Dict]): A dictionary for mapping labels. Defaults to an empty dictionary.
    """
    self.num_classes = num_classes
    self.sep = sep
    self.map_dict = map_dict

from_core_configure classmethod ¤

from_core_configure(config, **kwargs)

Creates a new instance of the LabelProcessor using the configuration from the core.

Parameters:

Name Type Description Default
config

The configuration object.

required
**kwargs

Additional keyword arguments.

{}

Returns:

Type Description

An instance of the LabelProcessor.

Source code in src/unitorch/cli/models/label_utils.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@classmethod
@add_default_section_for_init("core/process/label")
def from_core_configure(cls, config, **kwargs):
    """
    Creates a new instance of the LabelProcessor using the configuration from the core.

    Args:
        config: The configuration object.
        **kwargs: Additional keyword arguments.

    Returns:
        An instance of the LabelProcessor.
    """
    pass