Regularizers

CPU

DeconvOptim.TVFunction
TV(; <keyword arguments>)

This function returns a function to calculate the Total Variation regularizer of a n-dimensional array.

Arguments

  • num_dims=2:
  • sum_dims=1:num_dims: A array containing the dimensions we want to sum over
  • weights=nothing: A array containing weights to weight the contribution of different dimensions. If weights=nothing all dimensions are weighted equally.
  • step=1: A integer indicating the step width for the array indexing
  • mode="forward": Either "central" or "forward" accounting for different modes of the spatial gradient. Default is "forward".
  • ϵ=1f-8 is a smoothness variable, to make it differentiable

Examples

To create a regularizer for a 3D dataset where the third dimension has different contribution. For the derivative we use forward mode.

julia> reg = TV(num_dims=2, sum_dims=[1, 2], weights=[1, 1], mode="forward");

julia> reg([1 2 3; 4 5 6; 7 8 9])
12.649111f0
source
DeconvOptim.TikhonovFunction
Tikhonov(; <keyword arguments>)

This function returns a function to calculate the Tikhonov regularizer of a n-dimensional array.

Arguments

  • num_dims=2:
  • sum_dims=[1, 2]: A array containing the dimensions we want to sum over
  • weights=nothing: A array containing weights to weight the contribution of different dimensions. If weights=nothing all dimensions are weighted equally.
  • step=1: A integer indicating the step width for the array indexing
  • mode="laplace": Either "laplace", "spatial_grad_square", "identity" accounting for different modes of the Tikhonov regularizer. Default is "laplace".

Examples

To create a regularizer for a 3D dataset where the third dimension has different contribution.

julia> reg = Tikhonov(num_dims=2, sum_dims=[1, 2], weights=[1, 1], mode="identity");

julia> reg([1 2 3; 4 5 6; 7 8 9])
285
source
DeconvOptim.GRFunction
GR(; <keyword arguments>)

This function returns a function to calculate the Good's roughness regularizer of a n-dimensional array.

Arguments

  • num_dims=2: Dimension of the array that should be regularized
  • sum_dims=[1, 2]: A array containing the dimensions we want to sum over
  • weights=nothing: A array containing weights to weight the contribution of different dimensions. If weights=nothing all dimensions are weighted equally.
  • step=1: A integer indicating the step width for the array indexing
  • mode="forward": Either "central" or "forward" accounting for different modes of the spatial gradient. Default is "forward".
  • ϵ=1f-8 is a smoothness variable, to make it differentiable

Examples

To create a regularizer for a 3D dataset where the third dimension has different contribution. For the derivative we use forward mode.

julia> reg = GR(num_dims=2, sum_dims=[1, 2], weights=[1, 1], mode="forward");

julia> reg([1 2 3; 4 5 6; 7 8 9])
-26.36561871738898
source
DeconvOptim.THFunction
TH(; <keyword arguments>)

This function returns a function to calculate the Total Hessian norm of a n-dimensional array.

Arguments

  • num_dims=2
  • ϵ=1f-8 is a smoothness variable, to make it differentiable
source
DeconvOptim.HSFunction
HS(; p=1)

Hessian Schatten norm. p determines which Schatten norm is used.

This regularizer only works with 2D arrays at the moment.

source

CUDA

DeconvOptim.TV_cudaFunction
TV_cuda(; num_dims=2)

This function returns a function to calculate the Total Variation regularizer of a 2 or 3 dimensional array. num_dims can be either 2 or 3.

julia> using CUDA

julia> reg = TV_cuda(num_dims=2);

julia> reg(CuArray([1 2 3; 4 5 6; 7 8 9]))
12.649111f0
source