11import torch
2- from torchstain .torch .utils import cov , percentile
2+ from torchstain .torch .utils import percentile
33
44"""
55Implementation of the multi-target normalizer from the paper: https://arxiv.org/pdf/2406.02077
@@ -50,7 +50,7 @@ def __compute_matrices_single(self, I, Io, alpha, beta):
5050 OD , ODhat = self .__convert_rgb2od (I , Io = Io , beta = beta )
5151
5252 # _, eigvecs = torch.symeig(cov(ODhat.T), eigenvectors=True)
53- _ , eigvecs = torch .linalg .eigh (cov (ODhat .T ), UPLO = 'U' )
53+ _ , eigvecs = torch .linalg .eigh (torch . cov (ODhat .T ), UPLO = 'U' )
5454 eigvecs = eigvecs [:, [1 , 2 ]]
5555
5656 HE = self .__find_HE (ODhat , eigvecs , alpha )
@@ -77,7 +77,7 @@ def fit(self, Is, Io=240, alpha=1, beta=0.15):
7777 OD = torch .cat (ODs , dim = 0 )
7878 ODhat = torch .cat (ODhats , dim = 0 )
7979
80- eigvecs = torch .symeig (cov (ODhat .T ), eigenvectors = True )[1 ][:, [1 , 2 ]]
80+ eigvecs = torch .symeig (torch . cov (ODhat .T ), eigenvectors = True )[1 ][:, [1 , 2 ]]
8181
8282 HE = self .__find_HE (ODhat , eigvecs , alpha )
8383
@@ -91,7 +91,7 @@ def fit(self, Is, Io=240, alpha=1, beta=0.15):
9191 for I in Is
9292 ))
9393
94- eigvecs = torch .stack ([torch .symeig (cov (ODhat .T ), eigenvectors = True )[1 ][:, [1 , 2 ]] for ODhat in ODhats ]).mean (dim = 0 )
94+ eigvecs = torch .stack ([torch .symeig (torch . cov (ODhat .T ), eigenvectors = True )[1 ][:, [1 , 2 ]] for ODhat in ODhats ]).mean (dim = 0 )
9595
9696 OD = torch .cat (ODs , dim = 0 )
9797 ODhat = torch .cat (ODhats , dim = 0 )
0 commit comments