lfcnn.metrics package

Submodules

lfcnn.metrics.metrics module

class lfcnn.metrics.metrics.BadPix01(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Calculate the amount of pixels in percent that deviate more than 0.01 from the true value.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.BadPix03(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Calculate the amount of pixels in percent that deviate more than 0.03 from the true value.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.BadPix07(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Calculate the amount of pixels in percent that deviate more than 0.07 from the true value.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.CosineProximity(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the cosine proximity of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.MeanAbsoluteError(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the mean absolute error of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.MeanSquaredError(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the mean squared error of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.MultiScaleStructuralSimilarity(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the multiscale structural similarity of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.PSNR(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the PSNR of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.SpectralInformationDivergence(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the spectral information divergence of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.StructuralSimilarity(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the structural similarity of y_pred and y_true.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

class lfcnn.metrics.metrics.TotalVariation(*args, **kwargs)[source]

Bases: tensorflow.python.keras.metrics.MeanMetricWrapper

Computes the total variation of y_pred.

Creates a MeanMetricWrapper instance.

Parameters
  • fn – The metric function to wrap, with signature fn(y_true, y_pred, **kwargs).

  • name – (Optional) string name of the metric instance.

  • dtype – (Optional) data type of the metric result.

  • **kwargs – The keyword arguments that are passed on to fn.

lfcnn.metrics.metrics.get_central_metrics_fullsize(k1=0.01, k2=0.03, ssim_filter_size=11, ms_ssim_filter_size=11, ms_ssim_power_factors=0.0448, 0.2856, 0.3001, 0.2363, 0.1333)[source]

Returns metrics used to evaluate multispectral central views.

The SSIM and MS-SSIM values are set with the values presented in the according papers [1, 2]. In particular, the MS-SSIM is calculated on 5 scales with a filter length of 11. Hence, the input images should have a spatial resolution of at least 256 x 256.

Returns

MeanAbsoluteError, MeanSquaredError, PSNR StructuralSimilarity, MultiscaleStructuralSimilarity and NormalizedCosineProximity

Return type

List of Metric instances containing

lfcnn.metrics.metrics.get_central_metrics_small()[source]

Returns metrics used to evaluate multispectral central views.

The SSIM and MS-SSIM values are adapted to be used with small sized images of spatial resolutions around 32 x 32. The SSIM filter size is chosen to be 5. The MS-SSIM filter size is chosen to be 3. The MS-SSIM is calculated on 3 scales with power factors 0.5, 0.3, 0.2

Returns

MeanAbsoluteError, MeanSquaredError, PSNR StructuralSimilarity, MultiscaleStructuralSimilarity and NormalizedCosineProximity

Return type

List of Metric instances containing

lfcnn.metrics.metrics.get_disparity_metrics()[source]

Returns metrics used to evaluate disparity maps.

Returns

MeanAbsoluteError, MeanSquaredError, TotalVariation, BadPix01, BadPix03, BadPix07

Return type

List of Metric objects containing

lfcnn.metrics.metrics.get_lf_metrics()[source]

Returns metrics used to evaluate light fields.

Returns

MeanAbsoluteError, MeanSquaredError, PSNR

Return type

List of Metric instances containing

Module contents

The LFCNN metrics module.

lfcnn.metrics.get(metric)[source]

Given a metric name, returns an keras Metric instance.

Parameters

metric (str) – Name of the metric.

Return type

Metric

Returns

Metric instance.