chainer.links.model.vision.resnet.prepare¶
- chainer.links.model.vision.resnet.prepare(image, size=(224, 224))[source]¶
Converts the given image to a numpy array for ResNet.
Note that this method must be called before calling
forward
, because the pre-trained resnet model will resize the given image, convert from RGB to BGR, subtract the mean, and permute the dimensions before calling.- Parameters
image (PIL.Image or numpy.ndarray) – Input image. If an input is
numpy.ndarray
, its shape must be(height, width)
,(height, width, channels)
, or(channels, height, width)
, and the order of the channels must be RGB.size (pair of ints) – Size of converted images. If
None
, the given image is not resized.
- Returns
The converted output array.
- Return type