      def random_warp(self, image):
          """ get pair of random warped images from aligned face image """
          logger.trace("Randomly warping image")
          height, width = image.shape[0:2]
          coverage = self.get_coverage(image)
          try:
              assert height == width and height % 2 == 0
          except AssertionError as err:
              msg = ("Training images should be square with an even number of pixels across each "
                     "side. An image was found with width: {}, height: {}."
 
</s> remove         coverage = self.get_coverage(image)
 </s> add         coverage = self.get_coverage(image) // 2 </s> remove         dispatcher = FixedProducerDispatcher(do_work, shapes=[
            (batch_size, 256,256,3), (batch_size, 256,256,3)])
 </s> add         height = width = 256
        batch_shapes = (batch_size, height, width, 3)
        dispatcher = FixedProducerDispatcher(do_work, shapes=[batch_shapes, batch_shapes]) </s> remove         range_ = np.linspace(height // 2 - coverage // 2,
                             height // 2 + coverage // 2,
                             5, dtype='float32')
 </s> add         range_ = np.linspace(height // 2 - coverage, height // 2 + coverage, 5, dtype='float32') </s> remove def staircase_loss(y_true, y_pred, var_a=16.0, cnst=1.0/255.0):
    """ Keras Staircase Loss """
    height = cnst
    width = cnst
    var_x = K.clip(K.abs(y_true - y_pred) - 0.5 * cnst, 0.0, 1.0)
    loss = height*(K.tanh(var_a*((var_x/width)-tf.floor(var_x/width)-0.5)) /
                   (2.0*K.tanh(var_a/2.0)) + 0.5 + tf.floor(var_x/width))
    loss += 1e-10
    return K.mean(loss, axis=-1)
 </s> add def l_p_norm(y_true, y_pred, p_norm=np.inf):
    """
    Calculate the L-p norm as a loss function,
    valid choics of p are [0,1,no.inf]
    """
    diff = y_true - y_pred
    loss = tf.norm(diff, ord=p_norm, axis=-1)
    return loss


def l_inf_norm(y_true, y_pred):
    """ Calculate the L-inf norm as a loss function """
    diff = K.abs(y_true - y_pred)
    max_loss = K.max(diff, axis=(1, 2), keepdims=True)
    loss = K.mean(max_loss, axis=-1)
    return loss </s> remove     Calculates the first and second order gradient difference between pixels of an image in the
    x and y dimensions. These gradients are then compared between the ground truth and the
    predicted image and the difference is taken. The difference used is a smooth L1 norm
    (approximate to MAE but differable at zero) When used as a loss, its minimization will result
    in predicted images approaching the samelevel of sharpness / blurriness as the ground truth.
 </s> add     Calculates the first and second order gradient difference between pixels of
    an image in the x and y dimensions. These gradients are then compared between
    the ground truth and the predicted image and the difference is taken. When
    used as a loss, its minimization will result in predicted images approaching
    the same level of sharpness / blurriness as the ground truth.
        coverage = self.get_coverage(image) // 2
      def random_warp(self, image):
          """ get pair of random warped images from aligned face image """
          logger.trace("Randomly warping image")
          height, width = image.shape[0:2]
        coverage = self.get_coverage(image) // 2
          try:
              assert height == width and height % 2 == 0
          except AssertionError as err:
              msg = ("Training images should be square with an even number of pixels across each "
                     "side. An image was found with width: {}, height: {}."
keep keep keep keep replace keep keep keep keep keep
 documentation, pep8, style, clarity updates  - Prep for Segmentation (#812)

* documentation, pep8, style, clarity updates

* Update cli.py

* Update _config.py

remove extra mask and coverage

mask type as dropdown

* Update training_data.py

move coverage / LR to global
cut down on loss description

style change
losses working in PR

* simpler logging

* legacy update 
lib/training_data.py