MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / _central_crop

Function _central_crop

tools/tensorflow-quantization/examples/data/data_loader.py:197–205  ·  view source on GitHub ↗
(image, crop_height, crop_width)

Source from the content-addressed store, hash-verified

195
196
197def _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
208def preprocess_image_record(record, min_size=256, image_height=224, image_width=224):

Callers 2

load_image_npFunction · 0.85
preprocess_image_recordFunction · 0.85

Calls 1

shapeMethod · 0.80

Tested by

no test coverage detected