8.1.1.7.1.1.2.1. blueoil.networks.classification.base

8.1.1.7.1.1.2.1.1. Module Contents

8.1.1.7.1.1.2.1.1.1. Classes

Base

base network for classification

class blueoil.networks.classification.base.Base(weight_decay_rate=None, *args, **kwargs)

Bases: blueoil.networks.base.BaseNetwork

base network for classification

This base network is for classification. Every classification’s network class should extend this class.

placeholders(self)

Placeholders.

Return placeholders.

Returns

Placeholders.

Return type

tf.compat.v1.placeholder

inference(self, images, is_training)

inference.

Parameters
  • images – images tensor. shape is (batch_num, height, width, channel)

  • is_training

_weight_decay_loss(self)

L2 weight decay (regularization) loss.

loss(self, softmax, labels)

loss.

Parameters
  • softmax – softmaxed tensor from base. shape is (batch_num, num_classes)

  • labels – onehot labels tensor. shape is (batch_num, num_classes)

_heatmaps(self, target_feature_map)

Generate heatmap from target feature map.

Parameters

target_feature_map (Tensor) – Tensor to be generate heatmap. shape is [batch_size, h, w, num_classes].

summary(self, output, labels=None)

Summary.

Parameters
  • output – tensor from inference.

  • labels – labels tensor.

_calc_top_k(self, softmax, labels, k)

Calculate the mean top k accuracy. In the case that multiple classes are on the top k boundary, the order of the class indices is used to break the tie - lower indices given preference - so that only k predictions are included in the top k.

Parameters
  • softmax (Tensor) – class predictions from the softmax. Shape is [batch_size, num_classes].

  • labels (Tensor) – onehot ground truth labels. Shape is [batch_size, num_classes].

  • k (Int) – number of top predictions to use.

metrics(self, softmax, labels)

metrics.

Parameters
  • softmax – probabilities applied softmax. shape is (batch_num, num_classes)

  • labels – onehot labels tensor. shape is (batch_num, num_classes)