def compute(self) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
        """Compute distribution statistics from accumulated scores and maps.

        Returns:
            tuple containing:
                - image_mean: Mean of log-transformed image anomaly scores
                - image_std: Standard deviation of log-transformed image scores
                - pixel_mean: Mean of log-transformed pixel anomaly maps
                - pixel_std: Standard deviation of log-transformed pixel maps
        """
        anomaly_scores = torch.hstack(self.anomaly_scores)
        anomaly_scores = torch.log(anomaly_scores)

        self.image_mean = anomaly_scores.mean()
        self.image_std = anomaly_scores.std()

        if self.anomaly_maps:
            anomaly_maps = torch.vstack(self.anomaly_maps)
            anomaly_maps = torch.log(anomaly_maps).cpu()

            self.pixel_mean = anomaly_maps.mean(dim=0).squeeze()
            self.pixel_std = anomaly_maps.std(dim=0).squeeze()

        return self.image_mean, self.image_std, self.pixel_mean, self.pixel_std
Compute distribution statistics from accumulated scores and maps.

        Returns:
            tuple containing:
                - image_mean: Mean of log-transformed image anomaly scores
                - image_std: Standard deviation of log-transformed image scores
                - pixel_mean: Mean of log-transformed pixel anomaly maps
                - pixel_std: Standard deviation of log-transformed pixel maps
        
src/anomalib/metrics/anomaly_score_distribution.py