Reputation: 319
I am referencing https://keras.io/examples/vision/depth_estimation/#visualizing-samples code for one of my project however, I am getting error related to StopIteration. Could someone please suggest how this can be rectified?
def visualize_depth_map(samples, test=False, model=None):
input, target = samples
cmap = plt.cm.jet
cmap.set_bad(color="black")
if test:
pred = model.predict(input)
fig, ax = plt.subplots(6, 3, figsize=(50, 50))
for i in range(6):
ax[i, 0].imshow((input[i].squeeze()))
ax[i, 1].imshow((target[i].squeeze()), cmap=cmap)
ax[i, 2].imshow((pred[i].squeeze()), cmap=cmap)
else:
fig, ax = plt.subplots(6, 2, figsize=(50, 50))
for i in range(6):
ax[i, 0].imshow((input[i].squeeze()))
ax[i, 1].imshow((target[i].squeeze()), cmap=cmap)
visualize_samples = next(
iter(DataGenerator(data=df, batch_size=6, dim=(HEIGHT, WIDTH)))
)
visualize_depth_map(visualize_samples)
Traceback below:
StopIteration Traceback (most recent call last)
<ipython-input-7-1f95b664ead3> in <module>()
19
20
---> 21 visualize_samples = next(iter(DataGenerator(data=df, batch_size=6, dim=(HEIGHT, WIDTH))))
22 visualize_depth_map(visualize_samples)
StopIteration:
Upvotes: 0
Views: 83