Expects batched images with shape BxCxHxW and float format. This transformation may not exactly match apply_image. apply_image is the transformation expected by the model.
(self, image: torch.Tensor)
| 53 | return boxes.reshape(-1, 4) |
| 54 | |
| 55 | def apply_image_torch(self, image: torch.Tensor) -> torch.Tensor: |
| 56 | """ |
| 57 | Expects batched images with shape BxCxHxW and float format. This |
| 58 | transformation may not exactly match apply_image. apply_image is |
| 59 | the transformation expected by the model. |
| 60 | """ |
| 61 | # Expects an image in BCHW format. May not exactly match apply_image. |
| 62 | target_size = self.get_preprocess_shape(image.shape[0], image.shape[1], self.target_length) |
| 63 | return F.interpolate( |
| 64 | image, target_size, mode="bilinear", align_corners=False, antialias=True |
| 65 | ) |
| 66 | |
| 67 | def apply_coords_torch( |
| 68 | self, coords: torch.Tensor, original_size: Tuple[int, ...] |
nothing calls this directly
no test coverage detected