


import math
import os

import cva
import numpy as np

lowerCamelCase						 =	2_55.0




def      a_				(   SCREAMING_SNAKE_CASE__ :				float		,      SCREAMING_SNAKE_CASE__ :				float					):
       '''simple docstring'''





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

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




def      a_				(   ):
       '''simple docstring'''





       _lowerCamelCase	:		int          =os.path.dirname(os.path.realpath(SCREAMING_SNAKE_CASE__					)					)
       # Loading images (original image and compressed image)
       _lowerCamelCase	:		str          =cva.imread(os.path.join(SCREAMING_SNAKE_CASE__		,      'image_data/original_image.png'					)					)
       _lowerCamelCase	:		List[str]          =cva.imread(os.path.join(SCREAMING_SNAKE_CASE__		,      'image_data/compressed_image.png'					)		,      1					)

       _lowerCamelCase	:		Union[str, Any]          =cva.imread(os.path.join(SCREAMING_SNAKE_CASE__		,      'image_data/PSNR-example-base.png'					)					)
       _lowerCamelCase	:		Tuple          =cva.imread(
           os.path.join(SCREAMING_SNAKE_CASE__		,      '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(SCREAMING_SNAKE_CASE__		,      SCREAMING_SNAKE_CASE__					)} dB'''					)

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


if __name__ == "__main__":
 main()






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase						 =	{'configuration_visual_bert': ['VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VisualBertConfig']}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase						 =	[
     '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

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


