(is_training=True,
                           weight_decay=0.00004,
                           stddev=0.09,
                           regularize_depthwise=False)
Defines the default MobilenetV1 arg scope.

  Args:
    is_training: Whether or not we're training the model.
    weight_decay: The weight decay to use for regularizing the model.
    stddev: The standard deviation of the trunctated normal weight initializer.
    regularize_depthwise: Whether or not apply regularization on depthwise.

  Returns:
    An `arg_scope` to use for the mobilenet v1 model.
Defines the default MobilenetV1 arg scope.
Defines the default MobilenetV1 arg scope .
def mobilenet_v1_arg_scope(is_training=True,
                           weight_decay=0.00004,
                           stddev=0.09,
                           regularize_depthwise=False):
  """Defines the default MobilenetV1 arg scope.

  Args:
    is_training: Whether or not we're training the model.
    weight_decay: The weight decay to use for regularizing the model.
    stddev: The standard deviation of the trunctated normal weight initializer.
    regularize_depthwise: Whether or not apply regularization on depthwise.

  Returns:
    An `arg_scope` to use for the mobilenet v1 model.
  """
  batch_norm_params = {
      'is_training': is_training,
      'center': True,
      'scale': True,
      'decay': 0.9997,
      'epsilon': 0.001,
  }

  # Set weight_decay for weights in Conv and DepthSepConv layers.
  weights_init = tf.truncated_normal_initializer(stddev=stddev)
  regularizer = tf.contrib.layers.l2_regularizer(weight_decay)
  if regularize_depthwise:
    depthwise_regularizer = regularizer
  else:
    depthwise_regularizer = None
  with slim.arg_scope([slim.conv2d, slim.separable_conv2d],
                      weights_initializer=weights_init,
                      activation_fn=tf.nn.relu6, normalizer_fn=slim.batch_norm):
    with slim.arg_scope([slim.batch_norm], **batch_norm_params):
      with slim.arg_scope([slim.conv2d], weights_regularizer=regularizer):
        with slim.arg_scope([slim.separable_conv2d],
                            weights_regularizer=depthwise_regularizer) as sc:
          return sc
def mobilenet_v1_arg_scope ( is_training = True , weight_decay = 0.00004 , stddev = 0.09 , regularize_depthwise = False ) : batch_norm_params = { 'is_training' : is_training , 'center' : True , 'scale' : True , 'decay' : 0.9997 , 'epsilon' : 0.001 , } # Set weight_decay for weights in Conv and DepthSepConv layers. weights_init = tf . truncated_normal_initializer ( stddev = stddev ) regularizer = tf . contrib . layers . l2_regularizer ( weight_decay ) if regularize_depthwise : depthwise_regularizer = regularizer else : depthwise_regularizer = None with slim . arg_scope ( [ slim . conv2d , slim . separable_conv2d ] , weights_initializer = weights_init , activation_fn = tf . nn . relu6 , normalizer_fn = slim . batch_norm ) : with slim . arg_scope ( [ slim . batch_norm ] , * * batch_norm_params ) : with slim . arg_scope ( [ slim . conv2d ] , weights_regularizer = regularizer ) : with slim . arg_scope ( [ slim . separable_conv2d ] , weights_regularizer = depthwise_regularizer ) as sc : return sc