ImageNet Inception v3

class deepobs.imagenet.imagenet_inception_v3.set_up(batch_size=128, weight_decay=4e-05)[source]

Class providing the functionality for the Inception v3 architecture on ImagNet.

Details about the architecture can be found in the original paper.

There are many changes from the paper to the "official" TensorFlow implementation as well as the model.txt that can be found in the sources of the original paper. We chose to implement the version from Tensorflow (with possibly some minor changes)

Parameters:
  • batch_size (int) -- Batch size of the data points. Defaults to 128.
  • weight_decay (float) -- Weight decay factor. In this model weight decay is applied to the weights, but not the biases. Defaults to 4e-5.
data_loading

Data loading class for ImageNet, imagenet_input.data_loading.

Type:deepobs.data_loading
losses

Tensor of size batch_size containing the individual losses per data point.

Type:tf.Tensor
accuracy

Tensor containing the accuracy of the model.

Type:tf.Tensor
train_init_op

A TensorFlow operation to be performed before starting every training epoch.

Type:tf.Operation
train_eval_init_op

A TensorFlow operation to be performed before starting every training eval epoch.

Type:tf.Operation
test_init_op

A TensorFlow operation to be performed before starting every test evaluation phase.

Type:tf.Operation
conv2d_BN(inputs, filters, kernel_size, strides, padding, training, name='conv2d_BN')[source]

Creates a convolutional layer, followed by a batch normalization layer and a ReLU activation.

Parameters:
  • inputs (tf.Tensor) -- Input tensor to the layer.
  • filters (int) -- Number of filters for the conv layer. No default value specified.
  • kernel_size (int) -- Size of the conv filter. No default value specified.
  • strides (int) -- Stride for the convolutions. No default value specified.
  • padding (str) -- Padding of the convolutional layers. Can be SAME or VALID. No default value specified.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the layer. Defaults to conv2d_BN.
Returns:

Output after the conv and batch norm layer.

Return type:

tf.Tenors

get()[source]

Returns the losses and the accuray of the model.

Returns:Tupel consisting of the losses and the accuracy.
Return type:tupel
inception_block10(input_layer, training, name='inception_block10')[source]

Defines the Inception block 10.

Parameters:
  • input_layer (tf.Tensor) -- Input to the inception block.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the block. Defaults to inception_block10.
Returns:

Output after the inception block.

Return type:

tf.Tenors

inception_block5(input_layer, variant, training, name='inception_block5')[source]

Defines the Inception block 5.

Parameters:
  • input_layer (tf.Tensor) -- Input to the inception block.
  • variant (str) -- Describes which variant of the inception block 5 to use. Can be a or b.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the block. Defaults to inception_block5.
Returns:

Output after the inception block.

Return type:

tf.Tenors

inception_block6(input_layer, variant, training, name='inception_block6')[source]

Defines the Inception block 6.

Parameters:
  • input_layer (tf.Tensor) -- Input to the inception block.
  • variant (str) -- Describes which variant of the inception block 6 to use. Can be a, b or c.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the block. Defaults to inception_block6.
Returns:

Output after the inception block.

Return type:

tf.Tenors

inception_block7(input_layer, training, name='inception_block7')[source]

Defines the Inception block 7.

Parameters:
  • input_layer (tf.Tensor) -- Input to the inception block.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the block. Defaults to inception_block7.
Returns:

Output after the inception block.

Return type:

tf.Tenors

inception_blockD(input_layer, training, name='inception_blockD')[source]

Defines the Inception block D.

Parameters:
  • input_layer (tf.Tensor) -- Input to the inception block.
  • training (bool) -- Switch to determine if we are in training (or evaluation) mode.
  • name (str) -- Name of the block. Defaults to inception_blockD.
Returns:

Output after the inception block.

Return type:

tf.Tenors

set_up(weight_decay)[source]

Sets up the test problem.

Parameters:weight_decay (float) -- Weight decay factor, which is only applied to the weights and not the biases.
Returns:Tupel consisting of the losses and the accuracy.
Return type:tupel