:mod:`blueoil.networks.classification.lm_resnet`
================================================
.. py:module:: blueoil.networks.classification.lm_resnet
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
blueoil.networks.classification.lm_resnet.LmResnet
blueoil.networks.classification.lm_resnet.LmResnetQuantize
.. py:class:: LmResnet(*args, **kwargs)
Bases: :class:`blueoil.networks.classification.base.Base`
Residual network (ResNet) of 18-layers for classification
This ResNet-18 is modified from the ImageNet version of ResNet-18 of the original paper
Deep Residual Learning for Image Recognition (https://arxiv.org/abs/1512.03385)
- The first layer is 3x3 convolution layer with stride 1 instead of 7x7 conv with stride 2,
like the CIFAR-10 version of ResNet-18 in the paper.
- The 3x3 max pooling with stride 2 is not used in this architecture.
- In each residual block, batch normalization (BN) is after the add, to be specific, a
pre-activation variant of residual block is used.
- Utilizing Space-to-Depth operator for each the transition layer, convolution op with
strides of 2 is replaced with space-to-depth.
- Note currently this ResNet-18 only supports NHWC data format.
.. method:: _batch_norm(inputs, training)
:staticmethod:
.. method:: _conv2d_fix_padding(inputs, filters, kernel_size, strides)
:staticmethod:
Convolution layer deals with stride of 2
.. method:: basicblock(self, x, out_ch, strides, training)
Basic building block of single residual function
.. method:: resnet_group(self, x, out_ch, count, strides, training, name)
.. method:: base(self, images, is_training)
Base network.
:param images: Input images.
:param is_training: A flag for if it is training or not.
:returns: Inference result.
:rtype: tf.Tensor
.. py:class:: LmResnetQuantize(activation_quantizer=None, activation_quantizer_kwargs={}, weight_quantizer=None, weight_quantizer_kwargs={}, *args, **kwargs)
Bases: :class:`blueoil.networks.classification.lm_resnet.LmResnet`
Residual network (ResNet) of 18-layers for classification
This ResNet-18 is modified from the ImageNet version of ResNet-18 of the original paper
Deep Residual Learning for Image Recognition (https://arxiv.org/abs/1512.03385)
- The first layer is 3x3 convolution layer with stride 1 instead of 7x7 conv with stride 2,
like the CIFAR-10 version of ResNet-18 in the paper.
- The 3x3 max pooling with stride 2 is not used in this architecture.
- In each residual block, batch normalization (BN) is after the add, to be specific, a
pre-activation variant of residual block is used.
- Utilizing Space-to-Depth operator for each the transition layer, convolution op with
strides of 2 is replaced with space-to-depth.
- Note currently this ResNet-18 only supports NHWC data format.
.. attribute:: version
:annotation: = 1.0
.. method:: _quantized_variable_getter(getter, name, weight_quantization=None, *args, **kwargs)
:staticmethod:
Get the quantized variables.
Use if to choose or skip the target should be quantized.
:param getter: Default from tensorflow.
:param name: Default from tensorflow.
:param weight_quantization: Callable object which quantize variable.
:param args: Args.
:param kwargs: Kwargs.