A pre-trained CNN model with 101 layers provided by MSRA.
When you specify the path of the pre-trained chainer model serialized as
a .npz file in the constructor, this chain model automatically
initializes all the parameters with it.
This model would be useful when you want to extract a semantic feature
vector per image, or fine-tune the model on a different dataset.
Note that unlike VGG16Layers, it does not automatically download a
pre-trained caffemodel. This caffemodel can be downloaded at
If you want to manually convert the pre-trained caffemodel to a chainer
model that can be specified in the constructor,
please use convert_caffemodel_to_npz classmethod instead.
ResNet101 has 44,549,224 trainable parameters, and it’s 43% fewer than
ResNet152 model, while the top-5 classification accuracy on ImageNet
dataset drops 1.1% from ResNet152. For many cases, ResNet50 may have the
best balance between the accuracy and the model size.
pretrained_model (str) – the destination of the pre-trained
chainer model serialized as a .npz file.
If this argument is specified as auto,
it automatically loads and converts the caffemodel from
where $CHAINER_DATASET_ROOT is set as
$HOME/.chainer/dataset unless you specify another value
by modifying the environment variable. Note that in this case the
converted chainer model is stored on the same directory and
automatically used from the next time.
If this argument is specified as None, all the parameters
are not initialized by the pre-trained model, but the default
initializer used in the original paper, i.e.,
available_layers (list of str) – The list of available
layer names used by __call__ and extract methods.
The latter is easier for IDEs to keep track of the attribute’s
name (str) – Name of the parameter. This name is also used as the
shape (int or tuple of ints) – Shape of the parameter array. If it
is omitted, the parameter variable is left uninitialized.
dtype – Data type of the parameter array.
initializer – If it is not None, the data is initialized with
the given initializer. If it is an array, the data is directly
initialized by it. If it is callable, it is used as a weight
initializer. Note that in these cases, dtype argument is
The whole hierarchy rooted by this link is copied. The copy is
basically shallow, except that the parameter variables are also
shallowly copied. It means that the parameter variables of copied one
are different from ones of original link, while they share the data and
The name of the link is reset on the copy, since the copied instance
does not belong to the original parent chain (even if exists).
The difference of directly executing __call__ is that
it directly accepts images as an input and automatically
transforms them to a proper variable. That is,
it is also interpreted as a shortcut method that implicitly calls
prepare and __call__ functions.
test and volatile arguments are not supported anymore since
Instead, use chainer.using_config('train',train) and
This method returns a context manager object that enables registration
of parameters (and links for Chain) by an assignment.
A Parameter object can be automatically registered
by assigning it to an attribute under this context manager.
In most cases, the parameter registration is done in the
initializer method. Using the init_scope method, we can
simply assign a Parameter object to register
it to the link.
Registers an attribute of a given name as a persistent value.
This is a convenient method to register an existing attribute as a
persistent value. If name has been already registered as a
parameter, this method removes it from the list of parameter names
and re-registers it as a persistent value.
name (str) – Name of the attribute to be registered.