class_docstr: Encapsulates an object detection model behavior.
  
  In order to perform object detection with a model implemented within
  Luminoth, this class should be used.
  
  Attributes:
      classes (list of str): Ordered class names for the detector.
      prob (float): Default probability threshold for predictions.
  
  TODO:
      - Don't create a TF session internally (or make its creation optional)
        in order to be compatible with both TF-Eager and Jupyter Notebooks.
      - Manage multiple instantiations correctly in order to avoid creating
        the same TF objects over and over (which appends the `_N` suffix to
        the graph and makes the checkpoint loading fail).
class_docstr_tok: ["Encapsulates","an","object","detection","model","behavior",".","In","order","to","perform","object","detection","with","a","model","implemented","within","Luminoth",",","this","class","should","be","used",".","Attributes",":","classes","(","list","of","str",")",":","Ordered","class","names","for","the","detector",".","prob","(","float",")",":","Default","probability","threshold","for","predictions",".","TODO",":","-","Do","n't","create","a","TF","session","internally","(","or","make","its","creation","optional",")","in","order","to","be","compatible","with","both","TF-Eager","and","Jupyter","Notebooks",".","-","Manage","multiple","instantiations","correctly","in","order","to","avoid","creating","the","same","TF","objects","over","and","over","(","which","appends","the","`","_N","`","suffix","to","the","graph","and","makes","the","checkpoint","loading","fail",")","."]
docstr: Instantiate a detector object with the appropriate config.
  
  Arguments:
      checkpoint (str): Checkpoint id or alias to instantiate the
          detector as.
      config (dict): Configuration parameters describing the desired
          model. See `get_config` to load a config file.
  
  Note:
      Only one of the parameters must be specified. If none is, we
      default to loading the checkpoint indicated by
      `DEFAULT_CHECKPOINT`.
docstr_tok: ["Instantiate","a","detector","object","with","the","appropriate","config",".","Arguments",":","checkpoint","(","str",")",":","Checkpoint","id","or","alias","to","instantiate","the","detector","as",".","config","(","dict",")",":","Configuration","parameters","describing","the","desired","model",".","See","`","get_config","`","to","load","a","config","file",".","Note",":","Only","one","of","the","parameters","must","be","specified",".","If","none","is",",","we","default","to","loading","the","checkpoint","indicated","by","`","DEFAULT_CHECKPOINT","`","."]
code: def __init__(
      self, checkpoint=None, config=None, prob=0.7, classes=None
  ):
      """Instantiate a detector object with the appropriate config.
  
      Arguments:
          checkpoint (str): Checkpoint id or alias to instantiate the
              detector as.
          config (dict): Configuration parameters describing the desired
              model. See `get_config` to load a config file.
  
      Note:
          Only one of the parameters must be specified. If none is, we
          default to loading the checkpoint indicated by
          `DEFAULT_CHECKPOINT`.
      """
      if checkpoint is not None and config is not None:
          raise ValueError(
              "Only one of `checkpoint` or `config` must be specified in "
              "order to instantiate a Detector."
          )
  
      if checkpoint is None and config is None:
          # Neither checkpoint no config specified, default to
          # `DEFAULT_CHECKPOINT`.
          checkpoint = self.DEFAULT_CHECKPOINT
  
      if checkpoint:
          config = get_checkpoint_config(checkpoint)
  
      # Prevent the model itself from filtering its proposals (default
      # value of 0.5 is in use in the configs).
      # TODO: A model should always return all of its predictions. The
      # filtering should be done (if at all) by PredictorNetwork.
      if config.model.type == "fasterrcnn":
          config.model.rcnn.proposals.min_prob_threshold = 0.0
      elif config.model.type == "ssd":
          config.model.proposals.min_prob_threshold = 0.0
  
      # TODO: Remove dependency on `PredictorNetwork` or clearly separate
      # responsibilities.
      self._network = PredictorNetwork(config)
  
      self.prob = prob
  
      # Use the labels when available, integers when not.
      self._model_classes = (
          self._network.class_labels
          if self._network.class_labels
          else list(range(config.model.network.num_classes))
      )
      if classes:
          self.classes = set(classes)
          if not set(self._model_classes).issuperset(self.classes):
              raise ValueError(
                  "`classes` must be contained in the detector's classes. "
                  "Available classes are: {}.".format(
                      self._model_classes
                  )
              )
      else:
          self.classes = set(self._model_classes)
  
imports: from luminoth.tools.checkpoint import get_checkpoint_config
  from luminoth.utils.predicting import PredictorNetwork
label_desc: Use image node_id 1 to create a new Detector object from inherited base classes: object with example: obj = Detector(checkpoint, config, prob, classes)