unitorch.models.swin¤
SwinProcessor¤
Bases: HfImageClassificationProcessor
Initializes a SwinProcessor for image classification tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vision_config_path |
str
|
The path to the ViTImageProcessor configuration file. |
required |
Source code in src/unitorch/models/swin/processing.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
SwinForImageClassification¤
Bases: GenericModel
Initializes a SwinForImageClassification model for image classification tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_path |
str
|
The path to the Swin Transformer configuration file. |
required |
num_classes |
int
|
The number of classes for classification. Defaults to 1. |
1
|
Source code in src/unitorch/models/swin/modeling.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
forward ¤
forward(pixel_values: Tensor)
Performs a forward pass of the SwinForImageClassification model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixel_values |
Tensor
|
The input pixel values of the image. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The model's logits. |
Source code in src/unitorch/models/swin/modeling.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|