five_crop¶
- torchvision.transforms.functional.five_crop(img: Tensor, size: List[int]) Tuple[Tensor, Tensor, Tensor, Tensor, Tensor][source]¶
將給定影像裁剪為四個角和中心區域。如果影像是 PyTorch Tensor,則其形狀應為 […, H, W],其中 … 表示任意數量的前導維度
注意
此轉換返回一個影像元組,並且您的
Dataset返回的輸入和目標數量可能不匹配。- 引數:
img (PIL Image 或 Tensor) – 要裁剪的影像。
size (sequence 或 int) – 期望的裁剪輸出尺寸。如果 size 是一個 int 而非像 (h, w) 這樣的序列,則會進行方形裁剪 (size, size)。如果提供的序列長度為 1,則將被解釋為 (size[0], size[0])。
- 返回值:
元組 (tl, tr, bl, br, center) 對應的左上角、右上角、左下角、右下角和中心裁剪區域。
- 返回值型別:
使用
five_crop的示例