(image)
| 40 | return [left, top, right, bottom] |
| 41 | |
| 42 | def convert_to_numpy(image): |
| 43 | if isinstance(image, Image.Image): |
| 44 | image = np.array(image) |
| 45 | elif isinstance(image, torch.Tensor): |
| 46 | image = image.detach().cpu().numpy() |
| 47 | elif isinstance(image, np.ndarray): |
| 48 | image = image.copy() |
| 49 | else: |
| 50 | raise f'Unsurpport datatype{type(image)}, only surpport np.ndarray, torch.Tensor, Pillow Image.' |
| 51 | return image |
| 52 | |
| 53 | def convert_to_pil(image): |
| 54 | if isinstance(image, Image.Image): |
no outgoing calls
no test coverage detected