|
@ -1,4 +1,4 @@ |
|
|
# Transform Image Operator |
|
|
|
|
|
|
|
|
# Image Preprocessing Operator |
|
|
|
|
|
|
|
|
Authors: derekdqc, shiyu22 |
|
|
Authors: derekdqc, shiyu22 |
|
|
|
|
|
|
|
@ -14,23 +14,25 @@ In computer vision (CV) directions, image transformations are usually an indispe |
|
|
|
|
|
|
|
|
**Args:** |
|
|
**Args:** |
|
|
|
|
|
|
|
|
size(`int`): |
|
|
|
|
|
|
|
|
|
|
|
The size of the output image. |
|
|
|
|
|
|
|
|
- size: |
|
|
|
|
|
- the size of the output image |
|
|
|
|
|
- supported types: `int` |
|
|
|
|
|
|
|
|
`__call__(self, img: Union[np.ndarray, Image.Image, torch.Tensor, str])` |
|
|
`__call__(self, img: Union[np.ndarray, Image.Image, torch.Tensor, str])` |
|
|
|
|
|
|
|
|
**Args:** |
|
|
**Args:** |
|
|
|
|
|
|
|
|
img(`Union[np.ndarray, Image.Image, torch.Tensor, str]`): |
|
|
|
|
|
|
|
|
|
|
|
Original image data, the type can be np.ndarry, PIL.image, or str path of the image. |
|
|
|
|
|
|
|
|
- img: |
|
|
|
|
|
- the input image to be processed |
|
|
|
|
|
- supported type: `np.ndarry` or ` PIL.image` or `str` (path of the image) |
|
|
|
|
|
|
|
|
**Returns:** |
|
|
**Returns:** |
|
|
|
|
|
|
|
|
(`Tuple[('img_transformed', torch.Tensor)]`) |
|
|
|
|
|
|
|
|
The Operator returns a tuple `Tuple[('img_transformed', torch.Tensor)]` containing following fields: |
|
|
|
|
|
|
|
|
The tensor of the transformed image. |
|
|
|
|
|
|
|
|
- img_transformed: |
|
|
|
|
|
- the tensor of the transformed image |
|
|
|
|
|
- data type: `torch.Tensor` |
|
|
|
|
|
|
|
|
## Requirements |
|
|
## Requirements |
|
|
|
|
|
|
|
@ -45,3 +47,4 @@ The `towhee/transform-image` Operator is used for image transformation and is an |
|
|
## Reference |
|
|
## Reference |
|
|
|
|
|
|
|
|
- https://pytorch.org/vision/stable/transforms.html |
|
|
- https://pytorch.org/vision/stable/transforms.html |
|
|
|
|
|
|
|
|