class_docstr: Feature extractor based on ResNet (or others) backbones.
class_docstr_tok: ["Feature","extractor","based","on","ResNet","(","or","others",")","backbones","."]
code: def __init__(
      self,
      backbone,
      input_size,
      layers=("layer1", "layer2", "layer3"),
      **kwargs,
  ):
      super(FeatureExtractor, self).__init__(
          backbone, layers, pre_trained=True, requires_grad=False
      )
      self.channels = self.feature_extractor.feature_info.channels()
      self.scale_factors = (
          self.feature_extractor.feature_info.reduction()
      )
      self.scales = range(len(self.scale_factors))
  
      self.feature_normalizations = nn.ModuleList()
      for in_channels, scale in zip(self.channels, self.scale_factors):
          self.feature_normalizations.append(
              nn.LayerNorm(
                  [
                      in_channels,
                      int(input_size[0] / scale),
                      int(input_size[1] / scale),
                  ],
                  elementwise_affine=True,
              )
          )
  
      for param in self.feature_extractor.parameters():
          param.requires_grad = False
  
file_path: anomalib/src/anomalib/models/uflow/feature_extraction.py
imports: from typing import Tuple
  import timm
  import torch
  import torch.nn.functional
  from torch import nn
  from anomalib.models.components.feature_extractors import TimmFeatureExtractor
label_desc: Use image node_id 1 to create a new FeatureExtractor object from inherited base classes: TimmFeatureExtractor with example: obj = FeatureExtractor(backbone, input_size, layers)