class_docstr: PL Lightning Module for the EfficientAd algorithm.
  
  Args:
      teacher_file_name (str): path to the pre-trained teacher model
      teacher_out_channels (int): number of convolution output channels
      image_size (tuple): size of input images
      model_size (str): size of student and teacher model
      lr (float): learning rate
      weight_decay (float): optimizer weight decay
      padding (bool): use padding in convoluional layers
      pad_maps (bool): relevant if padding is set to False. In this case, pad_maps = True pads the
          output anomaly maps so that their size matches the size in the padding = True case.
      batch_size (int): batch size for imagenet dataloader
class_docstr_tok: ["PL","Lightning","Module","for","the","EfficientAd","algorithm",".","Args",":","teacher_file_name","(","str",")",":","path","to","the","pre-trained","teacher","model","teacher_out_channels","(","int",")",":","number","of","convolution","output","channels","image_size","(","tuple",")",":","size","of","input","images","model_size","(","str",")",":","size","of","student","and","teacher","model","lr","(","float",")",":","learning","rate","weight_decay","(","float",")",":","optimizer","weight","decay","padding","(","bool",")",":","use","padding","in","convoluional","layers","pad_maps","(","bool",")",":","relevant","if","padding","is","set","to","False",".","In","this","case",",","pad_maps","=","True","pads","the","output","anomaly","maps","so","that","their","size","matches","the","size","in","the","padding","=","True","case",".","batch_size","(","int",")",":","batch","size","for","imagenet","dataloader"]
docstr: Calculate 90% and 99.5% quantiles of the student(st) and autoencoder(ae).
  
  Args:
      dataloader (DataLoader): Dataloader of the respective dataset.
  
  Returns:
      dict[str, Tensor]: Dictionary of both the 90% and 99.5% quantiles
      of both the student and autoencoder feature maps.
docstr_tok: ["Calculate","90","%","and","99.5","%","quantiles","of","the","student","(","st",")","and","autoencoder","(","ae",")",".","Args",":","dataloader","(","DataLoader",")",":","Dataloader","of","the","respective","dataset",".","Returns",":","dict","[","str",",","Tensor","]",":","Dictionary","of","both","the","90","%","and","99.5","%","quantiles","of","both","the","student","and","autoencoder","feature","maps","."]
code: def map_norm_quantiles(
      self, dataloader: DataLoader
  ) -> dict[str, Tensor]:
      """Calculate 90% and 99.5% quantiles of the student(st) and autoencoder(ae).
  
      Args:
          dataloader (DataLoader): Dataloader of the respective dataset.
  
      Returns:
          dict[str, Tensor]: Dictionary of both the 90% and 99.5% quantiles
          of both the student and autoencoder feature maps.
      """
      maps_st = []
      maps_ae = []
      logger.info("Calculate Validation Dataset Quantiles")
      for batch in tqdm.tqdm(
          dataloader,
          desc="Calculate Validation Dataset Quantiles",
          position=0,
          leave=True,
      ):
          for img, label in zip(batch["image"], batch["label"]):
              if label == 0:  # only use good images of validation set!
                  output = self.model(
                      img.to(self.device), normalize=False
                  )
                  map_st = output["map_st"]
                  map_ae = output["map_ae"]
                  maps_st.append(map_st)
                  maps_ae.append(map_ae)
  
      qa_st, qb_st = self._get_quantiles_of_maps(maps_st)
      qa_ae, qb_ae = self._get_quantiles_of_maps(maps_ae)
      return {
          "qa_st": qa_st,
          "qa_ae": qa_ae,
          "qb_st": qb_st,
          "qb_ae": qb_ae,
      }
  
imports: from __future__ import annotations
  import logging
  from pathlib import Path
  import albumentations
  import numpy
  import torch
  import tqdm
  from albumentations.pytorch import ToTensorV2
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor, optim
  from torch.utils.data import DataLoader
  from torchvision.datasets import ImageFolder
  from anomalib.data.utils import DownloadInfo, download_and_extract
  from anomalib.models.components import AnomalyModule
  from .torch_model import EfficientAdModel, EfficientAdModelSize, reduce_tensor_elems
label_desc: Use image node_id 5 for calling the EfficientAd obj's underlying member method code with example usage: obj.map_norm_quantiles(dataloader) and returns: dict