





import math
import os

import cva
import numpy as np

a__							:							Optional[Any]			=255.0
def     lowercase__       (       __lowercase						:  Optional[int]    ,  __lowercase						:  Any					)			->				float:



       """simple docstring"""






       __UpperCamelCase	=  np.mean((original - contrast) ** 2					)
       if mse == 0:
              return 100

       return 20 * math.logaa(PIXEL_MAX / math.sqrt(__lowercase					)					)
def     lowercase__       (       )			->				None:



       """simple docstring"""






       __UpperCamelCase	=  os.path.dirname(os.path.realpath(__lowercase					)					)
       # Loading images (original image and compressed image)
       __UpperCamelCase	=  cva.imread(os.path.join(__lowercase    ,  'image_data/original_image.png'					)					)
       __UpperCamelCase	=  cva.imread(os.path.join(__lowercase    ,  'image_data/compressed_image.png'					)    ,  1					)

       __UpperCamelCase	=  cva.imread(os.path.join(__lowercase    ,  'image_data/PSNR-example-base.png'					)					)
       __UpperCamelCase	=  cva.imread(
           os.path.join(__lowercase    ,  '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(__lowercase    ,  __lowercase					)} dB'''					)

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


if __name__ == "__main__":
    main()







'''simple docstring'''
a__							:							int			='''
# Transformers installation
! pip install transformers datasets evaluate
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/transformers.git
'''

a__							:							List[Any]			=[{'''type''': '''code''', '''content''': INSTALL_CONTENT}]
a__							:							Dict			={
    '''{processor_class}''': '''FakeProcessorClass''',
    '''{model_class}''': '''FakeModelClass''',
    '''{object_class}''': '''FakeObjectClass''',
}
