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)
| 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 |
no test coverage detected