

import math
import os

import cva
import numpy as np

__A	:   int	=					2_55.0




def        __UpperCamelCase     (      _A					:							float      ,  _A					:							float		)				->float:



							"""simple docstring"""
							lowerCamelCase_								=np.mean((original - contrast) ** 2		)
							if mse == 0:
														return 100

							return 20 * math.logaa(PIXEL_MAX / math.sqrt(_A		)		)




def        __UpperCamelCase     (      )				->None:



							"""simple docstring"""
							lowerCamelCase_								=os.path.dirname(os.path.realpath(_A		)		)
							# Loading images (original image and compressed image)
							lowerCamelCase_								=cva.imread(os.path.join(_A      ,  """image_data/original_image.png"""		)		)
							lowerCamelCase_								=cva.imread(os.path.join(_A      ,  """image_data/compressed_image.png"""		)      ,  1		)

							lowerCamelCase_								=cva.imread(os.path.join(_A      ,  """image_data/PSNR-example-base.png"""		)		)
							lowerCamelCase_								=cva.imread(
							    os.path.join(_A      ,  """image_data/PSNR-example-comp-10.jpg"""		)      ,  1		)

							# Value expected: 29.73dB
							print("""-- First Test --"""		)
							print(f'PSNR value is {peak_signal_to_noise_ratio(_A      ,  _A		)} dB'		)

							# # Value expected: 31.53dB (Wikipedia Example)
							print("""\n-- Second Test --"""		)
							print(f'PSNR value is {peak_signal_to_noise_ratio(_A      ,  _A		)} dB'		)


if __name__ == "__main__":
	main()



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
    is_vision_available,
)


__A	:   Optional[int]	=					{
    'configuration_mobilevitv2': [
        'MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'MobileViTV2Config',
        'MobileViTV2OnnxConfig',
    ],
}


try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__A	:   Tuple	=					[
	    'MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'MobileViTV2ForImageClassification',
	    'MobileViTV2ForSemanticSegmentation',
	    'MobileViTV2Model',
	    'MobileViTV2PreTrainedModel',
	]

if TYPE_CHECKING:
	from .configuration_mobilevitva import (
	    MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    MobileViTVaConfig,
	    MobileViTVaOnnxConfig,
	)

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_mobilevitva import (
		    MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST,
		    MobileViTVaForImageClassification,
		    MobileViTVaForSemanticSegmentation,
		    MobileViTVaModel,
		    MobileViTVaPreTrainedModel,
		)

else:
	import sys

	__A	:   List[str]	=					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
