(image, crop_height, crop_width)
| 195 | |
| 196 | |
| 197 | def _central_crop(image, crop_height, crop_width): |
| 198 | shape = tf.shape(image) |
| 199 | height, width = shape[0], shape[1] |
| 200 | |
| 201 | amount_to_be_cropped_h = height - crop_height |
| 202 | crop_top = amount_to_be_cropped_h // 2 |
| 203 | amount_to_be_cropped_w = width - crop_width |
| 204 | crop_left = amount_to_be_cropped_w // 2 |
| 205 | return tf.slice(image, [crop_top, crop_left, 0], [crop_height, crop_width, -1]) |
| 206 | |
| 207 | |
| 208 | def preprocess_image_record(record, min_size=256, image_height=224, image_width=224): |
no test coverage detected