




import math
import os

import cva
import numpy as np

SCREAMING_SNAKE_CASE_						:					Union[str, Any]			   =       2_5_5.0
def        __lowerCAmelCase (UpperCAmelCase_   ,    UpperCAmelCase_		):
    a__      =       np.mean((original - contrast) ** 2		)
    if mse == 0:
        return 100

    return 20 * math.logaa(PIXEL_MAX / math.sqrt(UpperCAmelCase_		)		)
def        __lowerCAmelCase ():
    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()












from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE_						:					List[str]			   =       {'''configuration_vit_hybrid''': ['''VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTHybridConfig''']}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE_						:					Tuple			   =       [
     '''VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''ViTHybridForImageClassification''',
     '''ViTHybridModel''',
     '''ViTHybridPreTrainedModel''',
 ]

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE_						:					int			   =       ['''ViTHybridImageProcessor''']


if TYPE_CHECKING:
 from .configuration_vit_hybrid import VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTHybridConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit_hybrid import (
      VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTHybridForImageClassification,
      ViTHybridModel,
      ViTHybridPreTrainedModel,
  )

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .image_processing_vit_hybrid import ViTHybridImageProcessor


else:
 import sys

 SCREAMING_SNAKE_CASE_						:					Any			   =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






