class_docstr: Extract image feature using pretrained CNN network.
class_docstr_tok: ["Extract","image","feature","using","pretrained","CNN","network","."]
code: def extract(self, image, path=None):
      # check whether initialize CNN network.
      # extract the image feature
      if "faster_r_cnn" not in self.image_mode:
          transform = self.transform(image).unsqueeze(0)
          if self.use_cuda:
              transform = transform.cuda()
          with torch.no_grad():
              feature = self.netCNN(transform)
      else:
          raise RuntimeError("detectron support has been removed.")
      # save the feature
      if path is not None:
          import parlai.utils.torch as torch_utils
  
          torch_utils.atomic_save(feature.cpu(), path)
      return feature
  
imports: import parlai.core.build_data
  import parlai.utils.logging
  from parlai.utils.io import PathManager
  import os
  from PIL import Image
  import torch
  from zipfile import ZipFile
label_desc: Use image node_id 8 for calling the ImageLoader obj's underlying member method code with example usage: obj.extract(image, path) and returns: feature