docstr: Takes in an image or list of images and returns predictions
  for object locations.
  
  :param images: An image or list of images to predict on. If the
      images have not already been transformed into torch.Tensor
      objects, the default transformations contained in
      :func:`detecto.utils.default_transforms` will be applied.
  :type images: list or numpy.ndarray or torch.Tensor
  :return: If given a single image, returns a tuple of size
      three. The first element is a list of string labels of size N,
      the number of detected objects. The second element is a
      torch.Tensor of size (N, 4), giving the ``xmin``, ``ymin``,
      ``xmax``, and ``ymax`` coordinates of the boxes around each
      object. The third element is a torch.Tensor of size N containing
      the scores of each predicted object (ranges from 0.0 to 1.0). If
      given a list of images, returns a list of the tuples described
      above, each tuple corresponding to a single image.
  :rtype: tuple or list of tuple
  
  **Example**::
  
      >>> from detecto.core import Model
      >>> from detecto.utils import read_image
  
      >>> model = Model.load('model_weights.pth', ['horse', 'zebra'])
      >>> image = read_image('image.jpg')
      >>> labels, boxes, scores = model.predict(image)
      >>> print(labels[0])
      >>> print(boxes[0])
      >>> print(scores[0])
      horse
      tensor([   0.0000,  428.0744, 1617.1860, 1076.3607])
      tensor(0.9397)
docstr_tok: ["Takes","in","an","image","or","list","of","images","and","returns","predictions","for","object","locations",".",":","param","images",":","An","image","or","list","of","images","to","predict","on",".","If","the","images","have","not","already","been","transformed","into","torch.Tensor","objects",",","the","default","transformations","contained","in",":","func",":","`","detecto.utils.default_transforms","`","will","be","applied",".",":","type","images",":","list","or","numpy.ndarray","or","torch.Tensor",":","return",":","If","given","a","single","image",",","returns","a","tuple","of","size","three",".","The","first","element","is","a","list","of","string","labels","of","size","N",",","the","number","of","detected","objects",".","The","second","element","is","a","torch.Tensor","of","size","(","N",",","4",")",",","giving","the","``","xmin","``",",","``","ymin","``",",","``","xmax","``",",","and","``","ymax","``","coordinates","of","the","boxes","around","each","object",".","The","third","element","is","a","torch.Tensor","of","size","N","containing","the","scores","of","each","predicted","object","(","ranges","from","0.0","to","1.0",")",".","If","given","a","list","of","images",",","returns","a","list","of","the","tuples","described","above",",","each","tuple","corresponding","to","a","single","image",".",":","rtype",":","tuple","or","list","of","tuple","*","*","Example","*","*",":",":",">",">",">","from","detecto.core","import","Model",">",">",">","from","detecto.utils","import","read_image",">",">",">","model","=","Model.load","(","'model_weights.pth","'",",","[","'horse","'",",","'zebra","'","]",")",">",">",">","image","=","read_image","(","'image.jpg","'",")",">",">",">","labels",",","boxes",",","scores","=","model.predict","(","image",")",">",">",">","print","(","labels","[","0","]",")",">",">",">","print","(","boxes","[","0","]",")",">",">",">","print","(","scores","[","0","]",")","horse","tensor","(","[","0.0000",",","428.0744",",","1617.1860",",","1076.3607","]",")","tensor","(","0.9397",")"]
code: def predict(self, images):
      """Takes in an image or list of images and returns predictions
      for object locations.
  
      :param images: An image or list of images to predict on. If the
          images have not already been transformed into torch.Tensor
          objects, the default transformations contained in
          :func:`detecto.utils.default_transforms` will be applied.
      :type images: list or numpy.ndarray or torch.Tensor
      :return: If given a single image, returns a tuple of size
          three. The first element is a list of string labels of size N,
          the number of detected objects. The second element is a
          torch.Tensor of size (N, 4), giving the ``xmin``, ``ymin``,
          ``xmax``, and ``ymax`` coordinates of the boxes around each
          object. The third element is a torch.Tensor of size N containing
          the scores of each predicted object (ranges from 0.0 to 1.0). If
          given a list of images, returns a list of the tuples described
          above, each tuple corresponding to a single image.
      :rtype: tuple or list of tuple
  
      **Example**::
  
          >>> from detecto.core import Model
          >>> from detecto.utils import read_image
  
          >>> model = Model.load('model_weights.pth', ['horse', 'zebra'])
          >>> image = read_image('image.jpg')
          >>> labels, boxes, scores = model.predict(image)
          >>> print(labels[0])
          >>> print(boxes[0])
          >>> print(scores[0])
          horse
          tensor([   0.0000,  428.0744, 1617.1860, 1076.3607])
          tensor(0.9397)
      """
  
      # Convert all to lists but keep track if a single image was given
      is_single_image = not _is_iterable(images)
      images = [images] if is_single_image else images
      preds = self._get_raw_predictions(images)
  
      results = []
      for pred in preds:
          # Convert predicted ints into their corresponding string labels
          result = (
              [self._classes[val] for val in pred["labels"]],
              pred["boxes"],
              pred["scores"],
          )
          results.append(result)
  
      return results[0] if is_single_image else results
  
imports: import os
  import pandas
  import random
  import torch
  import torchvision
  from detecto.config import config
  from detecto.utils import default_transforms, filter_top_predictions, xml_to_csv, _is_iterable, read_image
  from torchvision import transforms
  from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj.predict(images) and returns: unknown