Regularizers
CPU
DeconvOptim.TV
— FunctionTV(; <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 overweights=nothing
: A array containing weights to weight the contribution of different dimensions. Ifweights=nothing
all dimensions are weighted equally.step=1
: A integer indicating the step width for the array indexingmode="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
DeconvOptim.Tikhonov
— FunctionTikhonov(; <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 overweights=nothing
: A array containing weights to weight the contribution of different dimensions. Ifweights=nothing
all dimensions are weighted equally.step=1
: A integer indicating the step width for the array indexingmode="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
DeconvOptim.GR
— FunctionGR(; <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 regularizedsum_dims=[1, 2]
: A array containing the dimensions we want to sum overweights=nothing
: A array containing weights to weight the contribution of different dimensions. Ifweights=nothing
all dimensions are weighted equally.step=1
: A integer indicating the step width for the array indexingmode="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
DeconvOptim.TH
— FunctionTH(; <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
DeconvOptim.HS
— FunctionHS(; p=1)
Hessian Schatten norm. p
determines which Schatten norm is used.
This regularizer only works with 2D arrays at the moment.
CUDA
DeconvOptim.TV_cuda
— FunctionTV_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