mmdeploy/codebase/mmedit/deploy/super_resolution_model.py
def evaluate(self, output: Union[torch.Tensor, np.ndarray],
                 gt: torch.Tensor):
        """Evaluation function implemented in mmedit.

        Args:
            output (torch.Tensor | np.ndarray): Model output with
                shape (n, c, h, w).
            gt (torch.Tensor): GT Tensor with shape (n, c, h, w).

        Returns:
            dict: Evaluation results.
        """
        crop_border = self.test_cfg.crop_border

        if isinstance(output, np.ndarray):
            output = torch.from_numpy(output)
        output = tensor2img(output)
        gt = tensor2img(gt)

        eval_result = dict()
        for metric in self.test_cfg.metrics:
            eval_result[metric] = self.allowed_metrics[metric](output, gt,
                                                               crop_border)
        return eval_result
Evaluation function implemented in mmedit.

        Args:
            output (torch.Tensor | np.ndarray): Model output with
                shape (n, c, h, w).
            gt (torch.Tensor): GT Tensor with shape (n, c, h, w).

        Returns:
            dict: Evaluation results.
        
Evaluation function implemented in mmedit.
Evaluation function implemented in mmedit .
def evaluate(self, output: Union[torch.Tensor, np.ndarray],
                 gt: torch.Tensor):
        crop_border = self.test_cfg.crop_border
        if isinstance(output, np.ndarray):
            output = torch.from_numpy(output)
        output = tensor2img(output)
        gt = tensor2img(gt)
        eval_result = dict()
        for metric in self.test_cfg.metrics:
            eval_result[metric] = self.allowed_metrics[metric](output, gt,
                                                               crop_border)
        return eval_result
def evaluate ( self , output : Union [ torch . Tensor , np . ndarray ] , gt : torch . Tensor ) : crop_border = self . test_cfg . crop_border if isinstance ( output , np . ndarray ) : output = torch . from_numpy ( output ) output = tensor2img ( output ) gt = tensor2img ( gt ) eval_result = dict ( ) for metric in self . test_cfg . metrics : eval_result [ metric ] = self . allowed_metrics [ metric ] ( output , gt , crop_border ) return eval_result
Evaluation function implemented in mmedit.
Evaluation function implemented in mmedit .
"""Evaluation function implemented in mmedit.

        Args:
            output (torch.Tensor | np.ndarray): Model output with
                shape (n, c, h, w).
            gt (torch.Tensor): GT Tensor with shape (n, c, h, w).

        Returns:
            dict: Evaluation results.
        """
None
dict
self
output
Union[torch.Tensor, np.ndarray]
Model output with
shape (n, c, h, w).
Model output with shape ( n c h w ) .
gt
torch.Tensor
GT Tensor with shape (n, c, h, w).
GT Tensor with shape ( n c h w ) .