





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case_				=      {'''configuration_dinat''': ['''DINAT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DinatConfig''']}


try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				snake_case_				=      [
				    '''DINAT_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''DinatForImageClassification''',
				    '''DinatModel''',
				    '''DinatPreTrainedModel''',
				    '''DinatBackbone''',
				]

if TYPE_CHECKING:
				from .configuration_dinat import DINAT_PRETRAINED_CONFIG_ARCHIVE_MAP, DinatConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_dinat import (
								    DINAT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    DinatBackbone,
								    DinatForImageClassification,
								    DinatModel,
								    DinatPreTrainedModel,
								)

else:
				import sys

				snake_case_				=      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)







import math
import os

import cva
import numpy as np

_lowerCamelCase							=      255.0





def 							lowerCamelCase    (							UpperCAmelCase_	:      float   ,       UpperCAmelCase_	:      float      )->			float:

       """simple docstring"""




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

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





def 							lowerCamelCase    (							)->			None:

       """simple docstring"""




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

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

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


if __name__ == "__main__":
    main()
