Chainer
6.0.0b2

Tutorials

  • Chainer at a Glance
  • Concepts Walkthrough

Examples

  • Neural Net Examples
  • Colab Notebook Examples
  • Awesome Chainer

References

  • API Reference
    • Variable and Parameter
    • Functions
    • Link and Chains
      • Learnable connections
      • Activation/loss/normalization functions with parameters
      • Machine learning models
      • Pre-trained models
        • VGG Networks
        • GoogLeNet
        • Residual Networks
        • ChainerCV models
        • Compatibility with other frameworks
      • Link and Chain base classes
      • Link hooks
    • Probability Distributions
    • Optimizers
    • Weight Initializers
    • Training Tools
    • Datasets
    • Iterator
    • Serializers
    • Utilities
    • Configuring Chainer
    • Debug Mode
    • Visualization of Computational Graph
    • Static Subgraph Optimizations: Usage
    • Static Subgraph Optimizations: Design Notes
    • Caffe Model Support
    • Assertion and Testing
  • Installation
  • Distributed Deep Learning with ChainerMN

Other

  • API Compatibility Policy
  • Contribution Guide
  • Tips and FAQs
  • Performance Best Practices
  • Upgrade Guide
  • Comparison with Other Frameworks
  • License

Community

  • Slack Chat
  • Forums
Chainer
  • Docs »
  • API Reference »
  • Link and Chains »
  • chainer.links.model.vision.resnet.prepare

chainer.links.model.vision.resnet.prepare¶

chainer.links.model.vision.resnet.prepare(image, size=(224, 224))[source]¶

Converts the given image to the numpy array for ResNets.

Note that you have to call this method before forward because the pre-trained resnet model requires to resize the given image, covert the RGB to the 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

numpy.ndarray

Next Previous

© Copyright 2015, Preferred Networks, inc. and Preferred Infrastructure, inc.

Built with Sphinx using a theme provided by Read the Docs.