File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -268,8 +268,8 @@ def __call__(self, sample):
268
268
h , w = image .shape [:2 ]
269
269
new_h , new_w = self .output_size
270
270
271
- top = np .random .randint (0 , h - new_h )
272
- left = np .random .randint (0 , w - new_w )
271
+ top = np .random .randint (0 , h - new_h + 1 )
272
+ left = np .random .randint (0 , w - new_w + 1 )
273
273
274
274
image = image [top : top + new_h ,
275
275
left : left + new_w ]
@@ -294,7 +294,7 @@ def __call__(self, sample):
294
294
295
295
######################################################################
296
296
# .. note::
297
- # In the example above, `RandomCrop` uses an external library's random number generator
297
+ # In the example above, `RandomCrop` uses an external library's random number generator
298
298
# (in this case, Numpy's `np.random.int`). This can result in unexpected behavior with `DataLoader`
299
299
# (see `here <https://pytorch.org/docs/stable/notes/faq.html#my-data-loader-workers-return-identical-random-numbers>`_).
300
300
# In practice, it is safer to stick to PyTorch's random number generator, e.g. by using `torch.randint` instead.
You can’t perform that action at this time.
0 commit comments