


'''simple docstring'''

import math
import os

import cva
import numpy as np

__lowercase:		Tuple    						=  2_5_5.0



def 							SCREAMING_SNAKE_CASE__(		_UpperCamelCase   :					float     ,		_UpperCamelCase   :					float )		->       float:





   '''simple docstring'''







   UpperCamelCase__			    =    np.mean((original - contrast) ** 2 )
   if mse == 0:
      return 1_00

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



def 							SCREAMING_SNAKE_CASE__(		)		->       None:





   '''simple docstring'''







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

   UpperCamelCase__			    =    cva.imread(os.path.join(_UpperCamelCase     ,		"image_data/PSNR-example-base.png" ) )
   UpperCamelCase__			    =    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()







'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_A      :     Optional[int]       	={'''configuration_visual_bert''': ['''VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VisualBertConfig''']}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_A      :     Optional[int]       	=[
			    '''VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
			    '''VisualBertForMultipleChoice''',
			    '''VisualBertForPreTraining''',
			    '''VisualBertForQuestionAnswering''',
			    '''VisualBertForRegionToPhraseAlignment''',
			    '''VisualBertForVisualReasoning''',
			    '''VisualBertLayer''',
			    '''VisualBertModel''',
			    '''VisualBertPreTrainedModel''',
			]


if TYPE_CHECKING:
			from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_visual_bert import (
						    VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
						    VisualBertForMultipleChoice,
						    VisualBertForPreTraining,
						    VisualBertForQuestionAnswering,
						    VisualBertForRegionToPhraseAlignment,
						    VisualBertForVisualReasoning,
						    VisualBertLayer,
						    VisualBertModel,
						    VisualBertPreTrainedModel,
						)


else:
			import sys

			_A      :     int       	=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

