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

Method get_batch

samples/python/efficientdet/image_batcher.py:154–170  ·  view source on GitHub ↗

Retrieve the batches. This is a generator object, so you can use it within a loop as: for batch, images in batcher.get_batch(): ... Or outside of a batch with the next() function. :return: A generator yielding three items per iteration: a numpy array holdi

(self)

Source from the content-addressed store, hash-verified

152 return image, scale
153
154 def get_batch(self):
155 """
156 Retrieve the batches. This is a generator object, so you can use it within a loop as:
157 for batch, images in batcher.get_batch():
158 ...
159 Or outside of a batch with the next() function.
160 :return: A generator yielding three items per iteration: a numpy array holding a batch of images, the list of
161 paths to the images loaded within this batch, and the list of resize scales for each image in the batch.
162 """
163 for i, batch_images in enumerate(self.batches):
164 batch_data = np.zeros(self.shape, dtype=self.dtype)
165 batch_scales = [None] * len(batch_images)
166 for i, image in enumerate(batch_images):
167 self.image_index += 1
168 batch_data[i], batch_scales[i] = self.preprocess_image(image)
169 self.batch_index += 1
170 yield batch_data, batch_images, batch_scales

Callers 3

mainFunction · 0.95
mainFunction · 0.95
runFunction · 0.45

Calls 1

preprocess_imageMethod · 0.95

Tested by

no test coverage detected