Skip to content

Commit 9fb9bdd

Browse files
lewha0soumith
authored andcommitted
Fixed a bug in data_loading_tutorial; Border lines of the grids are not considered; Should be shifted accordingly (#509)
1 parent 3f73013 commit 9fb9bdd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

beginner_source/data_loading_tutorial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,14 @@ def show_landmarks_batch(sample_batched):
379379
sample_batched['image'], sample_batched['landmarks']
380380
batch_size = len(images_batch)
381381
im_size = images_batch.size(2)
382+
grid_border_size = 2
382383

383384
grid = utils.make_grid(images_batch)
384385
plt.imshow(grid.numpy().transpose((1, 2, 0)))
385386

386387
for i in range(batch_size):
387-
plt.scatter(landmarks_batch[i, :, 0].numpy() + i * im_size,
388-
landmarks_batch[i, :, 1].numpy(),
388+
plt.scatter(landmarks_batch[i, :, 0].numpy() + i * im_size + (i + 1) * grid_border_size,
389+
landmarks_batch[i, :, 1].numpy() + grid_border_size,
389390
s=10, marker='.', c='r')
390391

391392
plt.title('Batch from dataloader')

0 commit comments

Comments
 (0)