  
      # Remove the c_s score for the last scale. In the MS-SSIM calculation,
      # we use the l(p) at the highest scale. l(p) * c_s(p) is ssim(p).
      mc_s.pop()  # Remove the c_s score for the last scale.
      mc_s_and_ssim = tf.stack(mc_s + [tf.nn.relu(ssim_per_channel)], axis=-1)
      # Take weighted geometric mean across the scale axis.
      ms_ssim = tf.reduce_prod(tf.pow(mc_s_and_ssim, power_factors), [-1])
  
      return tf.reduce_mean(ms_ssim, [-1])  # Avg over color channels.
  
 
</s> remove     ms_ssim = tf.reduce_prod(tf.pow(mc_s_and_ssim, power_factors), [-1])
 </s> add     ms_ssim = tf.reduce_prod(tf.pow(mcs_and_ssim, power_factors), [-1]) </s> remove                 # Overwrite previous ssim value since we only need the last one.
                ssim_per_channel, c_s = _ssim_per_channel(*imgs, max_val=max_val)
                mc_s.append(tf.nn.relu(c_s))
 </s> add             # Overwrite previous ssim value since we only need the last one.
            ssim_per_channel, c_s = _ssim_per_channel(*imgs, max_val=max_val)
            mc_s.append(tf.nn.relu(c_s)) </s> remove     """ Keras ms_ssim loss """
    msssim = K.expand_dims(K.expand_dims(1.0 - ms_ssim(y_true, y_pred), axis=-1), axis=-1)
    # need to expand to [1, height, width] dimensions for Keras ... modify to not be hard-coded
    return K.tile(msssim, [1, 64, 64])
 </s> add     """ Keras loss function for MS-SSIM """
    expanded = K.expand_dims(1.0 - ms_ssim_calc(y_true, y_pred), axis=-1)
    loss = K.expand_dims(expanded, axis=-1)
    # need to expand to [1,height,width] dimensions for Keras. modify to not be hard-coded
    return K.tile(loss, [1, 64, 64]) </s> remove             num1 = reducer(var_x * var_y, kernel) * 2.0
            den1 = reducer(tf.square(var_x) + tf.square(var_y), kernel)
            c_2 *= compensation
            c_s = (num1 - num0 + c_2) / (den1 - den0 + c_2)
 </s> add             num1 = reducer(img1 * img2, kernel) * 2.0
            den1 = reducer(tf.square(img1) + tf.square(img2), kernel)
            c_s = (num1 - num0 + c_two) / (den1 - den0 + c_two) </s> remove                 imgs = [tf.reshape(x, tf.concat([h, t], 0))
                        for x, h, t in zip(downscaled, heads, tails)]
 </s> add                 zipper = zip(downscaled, heads, tails)
                imgs = [tf.reshape(x, tf.concat([h, t], 0)) for x, h, t in zipper]
    mcs_and_ssim = tf.stack(mc_s + [tf.nn.relu(ssim_per_channel)], axis=-1)
  
      # Remove the c_s score for the last scale. In the MS-SSIM calculation,
      # we use the l(p) at the highest scale. l(p) * c_s(p) is ssim(p).
      mc_s.pop()  # Remove the c_s score for the last scale.
    mcs_and_ssim = tf.stack(mc_s + [tf.nn.relu(ssim_per_channel)], axis=-1)
      # Take weighted geometric mean across the scale axis.
      ms_ssim = tf.reduce_prod(tf.pow(mc_s_and_ssim, power_factors), [-1])
  
      return tf.reduce_mean(ms_ssim, [-1])  # Avg over color channels.
  
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/model/losses.py