Skip to content

Commit 60d6e5a

Browse files
committed
document normalization for pre-trained models
1 parent b13bac5 commit 60d6e5a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,15 @@ These can be constructed by passing ``pretrained=True``:
271271
squeezenet = models.squeezenet1_0(pretrained=True)
272272
273273
274+
All pre-trained models expect input images normalized in the same way, i.e.
275+
mini-batches of 3-channel RGB images of shape (3 x H x W), where H and W are expected
276+
to be atleast 224.
277+
278+
The images have to be loaded in to a range of [0, 1] and then
279+
normalized using `mean=[0.485, 0.456, 0.406]` and `std=[0.229, 0.224, 0.225]`
280+
281+
An example of such normalization can be found in `the imagenet example here` <https://github.com/pytorch/examples/blob/42e5b996718797e45c46a25c55b031e6768f8440/imagenet/main.py#L89-L101>
282+
274283
Transforms
275284
==========
276285

@@ -395,7 +404,7 @@ normalize the image.
395404
scale_each=True will scale each image in the batch of images separately rather than
396405
computing the (min, max) over all images.
397406

398-
[Example usage is given in this notebook](https://gist.github.com/anonymous/bf16430f7750c023141c562f3e9f2a91)
407+
`Example usage is given in this notebook` <https://gist.github.com/anonymous/bf16430f7750c023141c562f3e9f2a91>
399408

400409
save\_image(tensor, filename, nrow=8, padding=2, normalize=False, range=None, scale\_each=False)
401410
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)