# Path: piecewisecrf/slim/ops.py
# UPDATE_OPS_COLLECTION = '_update_ops_'
# def batch_norm(inputs,
#                decay=0.999,
#                center=True,
#                scale=False,
#                epsilon=0.001,
#                moving_vars='moving_vars',
#                activation=None,
#                is_training=True,
#                trainable=True,
#                restore=True,
#                scope=None,
#                reuse=None):
# def _two_element_tuple(int_or_tuple):
# def conv2d(inputs,
#            num_filters_out,
#            kernel_size,
#            stride=1,
#            padding='SAME',
#            activation=tf.nn.relu,
#            stddev=0.01,
#            bias=0.0,
#            weight_decay=0,
#            batch_norm_params=None,
#            is_training=True,
#            trainable=True,
#            restore=True,
#            scope=None,
#            reuse=None,
#            init=None):
# def fc(inputs,
#        num_units_out,
#        activation=tf.nn.relu,
#        stddev=0.01,
#        bias=0.0,
#        weight_decay=0,
#        batch_norm_params=None,
#        is_training=True,
#        trainable=True,
#        restore=True,
#        scope=None,
#        reuse=None):
# def one_hot_encoding(labels, num_classes, scope=None):
# def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def avg_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
# def flatten(inputs, scope=None):
# def repeat_op(repetitions, inputs, op, *args, **kwargs):


import tensorflow as tf
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes

def inception_v3(inputs,
                 dropout_keep_prob=0.8,
                 num_classes=1000,
                 is_training=True,
                 restore_logits=True,
                 scope=''):
  """Latest Inception from http://arxiv.org/abs/1512.00567.

    "Rethinking the Inception Architecture for Computer Vision"

    Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens,
    Zbigniew Wojna

  Args:
    inputs: a tensor of size [batch_size, height, width, channels].
    dropout_keep_prob: dropout keep_prob.
    num_classes: number of predicted classes.
    is_training: whether is training or not.
    restore_logits: whether or not the logits layers should be restored.
      Useful for fine-tuning a model with different num_classes.
    scope: Optional scope for op_scope.

  Returns:
    a list containing 'logits', 'aux_logits' Tensors.
  """
  # end_points will collect relevant activations for external use, for example
  # summaries or losses.
  end_points = {}
  with tf.op_scope([inputs], scope, 'inception_v3'):

# Path: piecewisecrf/slim/ops.py
# UPDATE_OPS_COLLECTION = '_update_ops_'
# def batch_norm(inputs,
#                decay=0.999,
#                center=True,
#                scale=False,
#                epsilon=0.001,
#                moving_vars='moving_vars',
#                activation=None,
#                is_training=True,
#                trainable=True,
#                restore=True,
#                scope=None,
#                reuse=None):
# def _two_element_tuple(int_or_tuple):
# def conv2d(inputs,
#            num_filters_out,
#            kernel_size,
#            stride=1,
#            padding='SAME',
#            activation=tf.nn.relu,
#            stddev=0.01,
#            bias=0.0,
#            weight_decay=0,
#            batch_norm_params=None,
#            is_training=True,
#            trainable=True,
#            restore=True,
#            scope=None,
#            reuse=None,
#            init=None):
# def fc(inputs,
#        num_units_out,
#        activation=tf.nn.relu,
#        stddev=0.01,
#        bias=0.0,
#        weight_decay=0,
#        batch_norm_params=None,
#        is_training=True,
#        trainable=True,
#        restore=True,
#        scope=None,
#        reuse=None):
# def one_hot_encoding(labels, num_classes, scope=None):
# def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def avg_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
# def flatten(inputs, scope=None):
# def repeat_op(repetitions, inputs, op, *args, **kwargs):


# Path: piecewisecrf/slim/inception_model.py
import tensorflow as tf
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes


def inception_v3(inputs,
                 dropout_keep_prob=0.8,
                 num_classes=1000,
                 is_training=True,
                 restore_logits=True,
                 scope=''):
  """Latest Inception from http://arxiv.org/abs/1512.00567.

    "Rethinking the Inception Architecture for Computer Vision"

    Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens,
    Zbigniew Wojna

  Args:
    inputs: a tensor of size [batch_size, height, width, channels].
    dropout_keep_prob: dropout keep_prob.
    num_classes: number of predicted classes.
    is_training: whether is training or not.
    restore_logits: whether or not the logits layers should be restored.
      Useful for fine-tuning a model with different num_classes.
    scope: Optional scope for op_scope.

  Returns:
    a list containing 'logits', 'aux_logits' Tensors.
  """
  # end_points will collect relevant activations for external use, for example
  # summaries or losses.
  end_points = {}
  with tf.op_scope([inputs], scope, 'inception_v3'):

    with scopes.arg_scope([ops.conv2d, ops.fc, ops.batch_norm, ops.dropout],