extorch.vision.transforms.segmentation
Transform compose for segmentation. |
|
Horizontally flip the given image and label randomly with a given probability (Link). |
|
Normalization for segmentation, where the normalization is only applied on the input image. |
|
Crops the given image at the center. |
|
Random cropping for segmentation. |
|
Resize for segmentation. |
|
Random resize for segmentation. |
|
PIL to Tensor for segmentation. |
|
Convert image dtype for segmentation. |
- class extorch.vision.transforms.segmentation.SegCenterCrop(size: Union[int, List[int]])[source]
Bases:
torch.nn.modules.module.Module
Crops the given image at the center.
- Parameters
size (Union[int, List[int]]) – Height and width of the crop box.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegCompose(transforms)[source]
Bases:
torchvision.transforms.transforms.Compose
Transform compose for segmentation.
- class extorch.vision.transforms.segmentation.SegConvertImageDtype(dtype)[source]
Bases:
torch.nn.modules.module.Module
Convert image dtype for segmentation.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegNormalize(mean: List[float], std: List[float])[source]
Bases:
torch.nn.modules.module.Module
Normalization for segmentation, where the normalization is only applied on the input image.
- Parameters
mean (List[float]) – List of means for each channel.
std (List[float]) – List of standard deviations for each channel.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegPILToTensor[source]
Bases:
torch.nn.modules.module.Module
PIL to Tensor for segmentation.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegRandomCrop(size: Union[int, Tuple[int, int]])[source]
Bases:
torch.nn.modules.module.Module
Random cropping for segmentation. The Cropping is applied on the image and target at the same time.
- Parameters
size (Union[int, Tuple[int, int]]) – Desired output size of the crop.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegRandomHorizontalFlip(p: float = 0.5)[source]
Bases:
torch.nn.modules.module.Module
Horizontally flip the given image and label randomly with a given probability (Link).
If the image and label are torch Tensor, they are expected to have […, H, W] shape, where … means an arbitrary number of leading dimensions.
- Parameters
p (float) – probability of the image and label being flipped. Default: 0.5.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegRandomResize(min_size: Union[int, Tuple[int, int]], max_size: Optional[Union[T, Tuple[T, T]]] = None)[source]
Bases:
torch.nn.modules.module.Module
Random resize for segmentation.
- Parameters
min_size (Union[int, Tuple[int, int]]) – Desired minimum output size.
max_size (Optional[Union[int, Tuple[int, int]]]) – Desired maximum output size. Default: None.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class extorch.vision.transforms.segmentation.SegResize(size: Union[int, Tuple[int, int]])[source]
Bases:
torch.nn.modules.module.Module
Resize for segmentation.
- Parameters
size (Union[int, Tuple[int, int]]) – Desired output size.
- forward(image, target)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool