From d1875172687fc854df35fa9bfc6ac07a148d7f18 Mon Sep 17 00:00:00 2001 From: Daniil Kazantsev Date: Sat, 12 May 2018 19:03:26 +0100 Subject: fixed objective2 --- Wrappers/Python/ccpi/plugins/regularisers.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Wrappers/Python/ccpi') diff --git a/Wrappers/Python/ccpi/plugins/regularisers.py b/Wrappers/Python/ccpi/plugins/regularisers.py index 9f4d3fc..46464a9 100644 --- a/Wrappers/Python/ccpi/plugins/regularisers.py +++ b/Wrappers/Python/ccpi/plugins/regularisers.py @@ -34,9 +34,8 @@ class _ROF_TV_(Operator): self.device = device # string for 'cpu' or 'gpu' def __call__(self,x): # evaluate objective function of TV gradient - # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity) EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2) - return EnergyValTV + return 0.5*EnergyValTV[0] def prox(self,x,Lipshitz): pars = {'algorithm' : ROF_TV, \ 'input' : np.asarray(x.as_array(), dtype=np.float32),\ @@ -62,9 +61,8 @@ class _FGP_TV_(Operator): self.device = device # string for 'cpu' or 'gpu' def __call__(self,x): # evaluate objective function of TV gradient - # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity) EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2) - return EnergyValTV + return 0.5*EnergyValTV[0] def prox(self,x,Lipshitz): pars = {'algorithm' : FGP_TV, \ 'input' : np.asarray(x.as_array(), dtype=np.float32),\ @@ -96,9 +94,8 @@ class _SB_TV_(Operator): self.device = device # string for 'cpu' or 'gpu' def __call__(self,x): # evaluate objective function of TV gradient - # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity) EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2) - return EnergyValTV + return 0.5*EnergyValTV[0] def prox(self,x,Lipshitz): pars = {'algorithm' : SB_TV, \ 'input' : np.asarray(x.as_array(), dtype=np.float32),\ -- cgit v1.2.3