class_docstr: ShanghaiTech DataModule class.
  
  Args:
      root (Path | str): Path to the root of the dataset
      scene (int): Index of the dataset scene (category) in range [1, 13]
      clip_length_in_frames (int, optional): Number of video frames in each clip.
      frames_between_clips (int, optional): Number of frames between each consecutive video clip.
      target_frame (VideoTargetFrame): Specifies the target frame in the video clip, used for ground truth retrieval
      task TaskType): Task type, 'classification', 'detection' or 'segmentation'
      image_size (int | tuple[int, int] | None, optional): Size of the input image.
          Defaults to None.
      center_crop (int | tuple[int, int] | None, optional): When provided, the images will be center-cropped
          to the provided dimensions.
      normalize (bool): When True, the images will be normalized to the ImageNet statistics.
      train_batch_size (int, optional): Training batch size. Defaults to 32.
      eval_batch_size (int, optional): Test batch size. Defaults to 32.
      num_workers (int, optional): Number of workers. Defaults to 8.
      transform_config_train (str | A.Compose | None, optional): Config for pre-processing
          during training.
          Defaults to None.
      transform_config_val (str | A.Compose | None, optional): Config for pre-processing
          during validation.
          Defaults to None.
      val_split_mode (ValSplitMode): Setting that determines how the validation subset is obtained.
      val_split_ratio (float): Fraction of train or test images that will be reserved for validation.
      seed (int | None, optional): Seed which may be set to a fixed value for reproducibility.
class_docstr_tok: ["ShanghaiTech","DataModule","class",".","Args",":","root","(","Path","|","str",")",":","Path","to","the","root","of","the","dataset","scene","(","int",")",":","Index","of","the","dataset","scene","(","category",")","in","range","[","1",",","13","]","clip_length_in_frames","(","int",",","optional",")",":","Number","of","video","frames","in","each","clip",".","frames_between_clips","(","int",",","optional",")",":","Number","of","frames","between","each","consecutive","video","clip",".","target_frame","(","VideoTargetFrame",")",":","Specifies","the","target","frame","in","the","video","clip",",","used","for","ground","truth","retrieval","task","TaskType",")",":","Task","type",",","'classification","'",",","'detection","'","or","'segmentation'","image_size","(","int","|","tuple","[","int",",","int","]","|","None",",","optional",")",":","Size","of","the","input","image",".","Defaults","to","None",".","center_crop","(","int","|","tuple","[","int",",","int","]","|","None",",","optional",")",":","When","provided",",","the","images","will","be","center-cropped","to","the","provided","dimensions",".","normalize","(","bool",")",":","When","True",",","the","images","will","be","normalized","to","the","ImageNet","statistics",".","train_batch_size","(","int",",","optional",")",":","Training","batch","size",".","Defaults","to","32.","eval_batch_size","(","int",",","optional",")",":","Test","batch","size",".","Defaults","to","32.","num_workers","(","int",",","optional",")",":","Number","of","workers",".","Defaults","to","8.","transform_config_train","(","str","|","A.Compose","|","None",",","optional",")",":","Config","for","pre-processing","during","training",".","Defaults","to","None",".","transform_config_val","(","str","|","A.Compose","|","None",",","optional",")",":","Config","for","pre-processing","during","validation",".","Defaults","to","None",".","val_split_mode","(","ValSplitMode",")",":","Setting","that","determines","how","the","validation","subset","is","obtained",".","val_split_ratio","(","float",")",":","Fraction","of","train","or","test","images","that","will","be","reserved","for","validation",".","seed","(","int","|","None",",","optional",")",":","Seed","which","may","be","set","to","a","fixed","value","for","reproducibility","."]
code: def __init__(
      self,
      root: Path | str,
      scene: int,
      clip_length_in_frames: int = 1,
      frames_between_clips: int = 1,
      target_frame: VideoTargetFrame = VideoTargetFrame.LAST,
      task: TaskType = TaskType.SEGMENTATION,
      image_size: int | tuple[int, int] | None = None,
      center_crop: int | tuple[int, int] | None = None,
      normalization: InputNormalizationMethod
      | str = InputNormalizationMethod.IMAGENET,
      train_batch_size: int = 32,
      eval_batch_size: int = 32,
      num_workers: int = 8,
      transform_config_train: str | A.Compose | None = None,
      transform_config_eval: str | A.Compose | None = None,
      val_split_mode: ValSplitMode = ValSplitMode.FROM_TEST,
      val_split_ratio: float = 0.5,
      seed: int | None = None,
  ):
      super().__init__(
          train_batch_size=train_batch_size,
          eval_batch_size=eval_batch_size,
          num_workers=num_workers,
          val_split_mode=val_split_mode,
          val_split_ratio=val_split_ratio,
          seed=seed,
      )
  
      self.root = Path(root)
      self.scene = scene
  
      transform_train = get_transforms(
          config=transform_config_train,
          image_size=image_size,
          center_crop=center_crop,
          normalization=InputNormalizationMethod(normalization),
      )
      transform_eval = get_transforms(
          config=transform_config_eval,
          image_size=image_size,
          center_crop=center_crop,
          normalization=InputNormalizationMethod(normalization),
      )
  
      self.train_data = ShanghaiTechDataset(
          task=task,
          transform=transform_train,
          clip_length_in_frames=clip_length_in_frames,
          frames_between_clips=frames_between_clips,
          target_frame=target_frame,
          root=root,
          scene=scene,
          split=Split.TRAIN,
      )
  
      self.test_data = ShanghaiTechDataset(
          task=task,
          transform=transform_eval,
          clip_length_in_frames=clip_length_in_frames,
          frames_between_clips=frames_between_clips,
          target_frame=target_frame,
          root=root,
          scene=scene,
          split=Split.TEST,
      )
  
imports: from __future__ import annotations
  import logging
  from pathlib import Path
  from shutil import move
  from typing import Any
  import albumentations
  import numpy
  import pandas
  import torch
  from pandas import DataFrame
  from torch import Tensor
  from anomalib.data.base import AnomalibVideoDataModule, AnomalibVideoDataset
  from anomalib.data.base.video import VideoTargetFrame
  from anomalib.data.task_type import TaskType
  from anomalib.data.utils import DownloadInfo, InputNormalizationMethod, Split, ValSplitMode, download_and_extract, get_transforms, read_image
  from anomalib.data.utils.video import ClipsIndexer, convert_video
label_desc: Use image node_id 1 to create a new ShanghaiTech object from inherited base classes: AnomalibVideoDataModule with example: obj = ShanghaiTech(root, scene, clip_length_in_frames, frames_between_clips, target_frame, task, image_size, center_crop, normalization, train_batch_size, eval_batch_size, num_workers, transform_config_train, transform_config_eval, val_split_mode, val_split_ratio, seed)