unitorch.models.dpt¤
DPTProcessor¤
Bases: HfImageClassificationProcessor
Processor for DPT-based depth estimation models.
Initializes the DPTProcessor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vision_config_path
|
str
|
Path to the DPT image processor configuration file. |
required |
Source code in src/unitorch/models/dpt/processing.py
14 15 16 17 18 19 20 21 22 23 24 25 | |
DPTForDepthEstimation¤
Bases: GenericModel
DPT model for depth estimation tasks.
Initializes the DPTForDepthEstimation model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str
|
Path to the DPT configuration file. |
required |
Source code in src/unitorch/models/dpt/modeling.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
prefix_keys_in_state_dict
class-attribute
instance-attribute
¤
prefix_keys_in_state_dict = {
"^dpt.": "_base_model.",
"^backbone.": "_base_model.",
"^neck.": "_base_model.",
"^head.": "_base_model.",
}
forward ¤
forward(pixel_values: Tensor)
Forward pass of the DPTForDepthEstimation model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixel_values
|
Tensor
|
Input image tensor of shape [batch_size, channels, height, width]. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: Upsampled depth prediction tensor. |
Source code in src/unitorch/models/dpt/modeling.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |