(path, center_crop=1.0)
| 99 | |
| 100 | |
| 101 | def read_image_to_tensor(path, center_crop=1.0): |
| 102 | pil_im = Image.open(path).convert('RGB') |
| 103 | if center_crop < 1.0: |
| 104 | width, height = pil_im.size |
| 105 | pil_im = pil_im.crop(( |
| 106 | int((1 - center_crop) * height / 2), int((1 + center_crop) * height / 2), |
| 107 | int((1 - center_crop) * width / 2), int((1 + center_crop) * width / 2), |
| 108 | )) |
| 109 | input_img = pil_im.resize((256, 256)) |
| 110 | input_img = np.array(input_img) / 255.0 |
| 111 | input_img = input_img.astype(np.float32) |
| 112 | return input_img |
| 113 | |
| 114 | |
| 115 | def match_mulitple_path(root_dir, regex): |
no outgoing calls
no test coverage detected