plenoptic.data.macaque#

plenoptic.data.macaque(as_gray=False)[source]#

Return an example image of a macaque.

Parameters:

as_gray (bool (default: False)) – Whether to load a single grayscale channel or 3 RGB channels.

Return type:

Tensor

Returns:

image – 4d tensor of the image.

Notes

This is one of the monkey selfies and is in the public domain.

It was originally downloaded from wikimedia

Examples

>>> import plenoptic as po
>>> macaque = po.data.macaque()
>>> macaque.shape
torch.Size([1, 3, 1500, 1085])
>>> po.plot.imshow(macaque[..., :-1], as_rgb=True)
<PyrFigure size ...>

(png, hires.png, pdf)

../../_images/plenoptic-data-macaque-1.png

To resize this image for use with an ImageNet-trained model, centering the monkey’s face:

>>> macaque = po.process.blur_downsample(macaque, 2)[..., :-59, :]
>>> macaque = po.process.center_crop(macaque, 224)
>>> macaque.shape
torch.Size([1, 3, 224, 224])
>>> po.plot.imshow(macaque, as_rgb=True)
<PyrFigure size ...>

(png, hires.png, pdf)

../../_images/plenoptic-data-macaque-2.png