Check if a file path exists and raise an error if it doesn't. Args: path: The file path to check Raises: FileNotFoundError: If the path is not empty and the file does not exist
(path: str)
| 703 | if orig_ratio > target_ratio: |
| 704 | crop_width = orig_width |
| 705 | crop_height = int(crop_width * target_ratio) |
| 706 | else: |
| 707 | crop_height = orig_height |
| 708 | crop_width = int(crop_height / target_ratio) |
| 709 | |
| 710 | cropped_img = TF.center_crop(img, [crop_height, crop_width]) |
| 711 | |
| 712 | resized_img = TF.resize(cropped_img, [target_height, target_width], antialias=True) |
| 713 | |
| 714 | h, w = resized_img.shape[-2:] |
| 715 | return resized_img, h, w |
| 716 | |
| 717 | |
| 718 | def check_path_exists(path: str) -> None: |
| 719 | """ |
| 720 | Check if a file path exists and raise an error if it doesn't. |
no outgoing calls
no test coverage detected