class_docstr: Provide methods to access metadata for :class:`ILSVRC12` dataset.
class_docstr_tok: ["Provide","methods","to","access","metadata","for",":","class",":","`","ILSVRC12","`","dataset","."]
docstr: Args:
      size (tuple): image size in (h, w). Defaults to (256, 256).
  Returns:
      np.ndarray: per-pixel mean of shape (h, w, 3 (BGR)) in range [0, 255].
docstr_tok: ["Args",":","size","(","tuple",")",":","image","size","in","(","h",",","w",")",".","Defaults","to","(","256",",","256",")",".","Returns",":","np.ndarray",":","per-pixel","mean","of","shape","(","h",",","w",",","3","(","BGR",")",")","in","range","[","0",",","255","]","."]
code: def get_per_pixel_mean(self, size=None):
      """
      Args:
          size (tuple): image size in (h, w). Defaults to (256, 256).
      Returns:
          np.ndarray: per-pixel mean of shape (h, w, 3 (BGR)) in range [0, 255].
      """
      if self.caffepb is None:
          self.caffepb = get_caffe_pb()
      obj = self.caffepb.BlobProto()
  
      mean_file = os.path.join(self.dir, "imagenet_mean.binaryproto")
      with open(mean_file, "rb") as f:
          obj.ParseFromString(f.read())
      arr = np.array(obj.data).reshape((3, 256, 256)).astype("float32")
      arr = np.transpose(arr, [1, 2, 0])
      if size is not None:
          arr = cv2.resize(arr, size[::-1])
      return arr
  
imports: import numpy
  import os
  import tarfile
  import tqdm
  from pathlib import Path
  from ...utils import logger
  from ...utils.fs import download, get_dataset_path, mkdir_p
  from ...utils.loadcaffe import get_caffe_pb
  from ...utils.timer import timed_operation
  from ..base import RNGDataFlow
label_desc: Use image node_id 6 for calling the ILSVRCMeta obj's underlying member method code with example usage: obj.get_per_pixel_mean(size) and returns: arr