class_docstr: This module implements the task- and model-specific estimator for PyTorch GOTURN (object tracking).
class_docstr_tok: ["This","module","implements","the","task-","and","model-specific","estimator","for","PyTorch","GOTURN","(","object","tracking",")","."]
docstr: Preprocess image before forward pass, this is the same preprocessing used during training, please refer to
  collate function in train.py for reference
  
  :param img: Single frame od shape (nb_samples, height, width, nb_channels).
  :return: Preprocessed frame.
docstr_tok: ["Preprocess","image","before","forward","pass",",","this","is","the","same","preprocessing","used","during","training",",","please","refer","to","collate","function","in","train.py","for","reference",":","param","img",":","Single","frame","od","shape","(","nb_samples",",","height",",","width",",","nb_channels",")",".",":","return",":","Preprocessed","frame","."]
code: def _preprocess(self, img: "torch.Tensor") -> "torch.Tensor":
      """
      Preprocess image before forward pass, this is the same preprocessing used during training, please refer to
      collate function in train.py for reference
  
      :param img: Single frame od shape (nb_samples, height, width, nb_channels).
      :return: Preprocessed frame.
      """
      import torch
      from torch.nn.functional import interpolate
  
      from art.preprocessing.standardisation_mean_std.pytorch import (
          StandardisationMeanStdPyTorch,
      )
  
      if self.preprocessing is not None and isinstance(
          self.preprocessing, StandardisationMeanStdPyTorch
      ):
          mean_np = self.preprocessing.mean
          std_np = self.preprocessing.std
      else:
          mean_np = np.ones(shape=(3, 1, 1), dtype=float)
          std_np = np.ones(shape=(3, 1, 1), dtype=float)
      mean = torch.from_numpy(mean_np).reshape((3, 1, 1))
      std = torch.from_numpy(std_np).reshape((3, 1, 1))
      img = img.permute(2, 0, 1)
      img = img * std + mean
      img = torch.unsqueeze(img, dim=0)
      img = interpolate(
          img,
          size=(self.input_shape[1], self.input_shape[2]),
          mode="bicubic",
      )
      if self.clip_values is not None:
          img = torch.clamp(
              img,
              float(self.clip_values[0]),
              float(self.clip_values[1]),
          )
      img = torch.squeeze(img)
      img = (img - mean) / std
      return img
  
imports: import logging
  import time
  from typing import List, Dict, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from art.estimators.object_tracking.object_tracker import ObjectTrackerMixin
  from art.estimators.pytorch import PyTorchEstimator
label_desc: Use image node_id 7 for calling the PyTorchGoturn obj's underlying member method code with example usage: obj._preprocess(img) and returns: img