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

Method get_batch

samples/python/efficientnet/image_batcher.py:162–177  ·  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 two items per iteration: a numpy array holding

(self)

Source from the content-addressed store, hash-verified

160 return image
161
162 def get_batch(self):
163 """
164 Retrieve the batches. This is a generator object, so you can use it within a loop as:
165 for batch, images in batcher.get_batch():
166 ...
167 Or outside of a batch with the next() function.
168 :return: A generator yielding two items per iteration: a numpy array holding a batch of images, and the list of
169 paths to the images loaded within this batch.
170 """
171 for i, batch_images in enumerate(self.batches):
172 batch_data = np.zeros(self.shape, dtype=self.dtype)
173 for i, image in enumerate(batch_images):
174 self.image_index += 1
175 batch_data[i] = self.preprocess_image(image)
176 self.batch_index += 1
177 yield batch_data, batch_images

Callers 3

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95

Calls 1

preprocess_imageMethod · 0.95

Tested by

no test coverage detected