8.1.1.7.1.1.2.3. blueoil.networks.classification.lm_resnet

8.1.1.7.1.1.2.3.1. Module Contents

8.1.1.7.1.1.2.3.1.1. Classes

LmResnet

Residual network (ResNet) of 18-layers for classification

LmResnetQuantize

Residual network (ResNet) of 18-layers for classification

class blueoil.networks.classification.lm_resnet.LmResnet(*args, **kwargs)

Bases: 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.

static _batch_norm(inputs, training)
static _conv2d_fix_padding(inputs, filters, kernel_size, strides)

Convolution layer deals with stride of 2

basicblock(self, x, out_ch, strides, training)

Basic building block of single residual function

resnet_group(self, x, out_ch, count, strides, training, name)
base(self, images, is_training)

Base network.

Parameters
  • images – Input images.

  • is_training – A flag for if it is training or not.

Returns

Inference result.

Return type

tf.Tensor

class blueoil.networks.classification.lm_resnet.LmResnetQuantize(activation_quantizer=None, activation_quantizer_kwargs={}, weight_quantizer=None, weight_quantizer_kwargs={}, *args, **kwargs)

Bases: 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.

version = 1.0
static _quantized_variable_getter(getter, name, weight_quantization=None, *args, **kwargs)

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.