open-mmlab / mmeval

A unified evaluation library for multiple machine learning libraries

Home Page:https://mmeval.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some question about PSNR metric

BIGWangYuDong opened this issue · comments

Codes:

def add(self, predictions: Sequence[np.ndarray], groundtruths: Sequence[np.ndarray], channel_order: Optional[str] = None) -> None: # type: ignore # yapf: disable # noqa: E501
"""Add PSNR score of batch to ``self._results``
Args:
predictions (Sequence[np.ndarray]): Predictions of the model.
groundtruths (Sequence[np.ndarray]): The ground truth images.
channel_order (Optional[str]): The channel order of the input
samples. If not passed, will set as :attr:`self.channel_order`.
Defaults to None.
"""
if channel_order is None:
channel_order = self.channel_order
for prediction, groundtruth in zip(predictions, groundtruths):
assert groundtruth.shape == prediction.shape, (
f'Image shapes are different: \
{groundtruth.shape}, {prediction.shape}.')
groundtruth = reorder_and_crop(
groundtruth,
crop_border=self.crop_border,
input_order=self.input_order,
convert_to=self.convert_to,
channel_order=self.channel_order)
prediction = reorder_and_crop(
prediction,
crop_border=self.crop_border,
input_order=self.input_order,
convert_to=self.convert_to,
channel_order=self.channel_order)

Seems channel_order will not be used if channel_order is not None

way to fix:

maybe change self.channel_order -> channel_order is OK?

@BIGWangYuDong, thanks for your reporting! I will check all metrics related to low-level vision and fix this problem as soon as possible!

closed by #89