def __init__(self, dataset, train_dataset, cls, dets, detname):
    """
    Expects cached detections in Table format to be passed in.
    The dets should not have the 'cls_ind' column, as they should all be of the
    same class.
    """
    Detector.__init__(self,dataset,train_dataset,cls,detname)
    self.dets = dets
    # TODO: hack for csc_X
    suffix = detname[4:]

    if self.detname=='dpm':
      self.classif = DPMClassifier()
    else:
      self.classif = CSCClassifier(suffix, cls, train_dataset, dataset)
 def compute_score(self, image, oracle=False, dets=None):
   """
   Return the 0/1 decision of whether the cls of this detector is present in
   the image, given the detections table.
   If oracle=True, returns the correct answer (look up the ground truth).
   """
   if oracle:
     return Detector.compute_score(self, image, oracle)
   if not dets:
     img_ind = self.dataset.get_img_ind(image)
     dets = self.dets.filter_on_column('img_ind',img_ind)
   scores = dets.subset_arr('score')
   score = self.classif.classify_image(scores)
   dt = 0
   # TODO: figure out the dt situation above
   return (score,dt)
Esempio n. 3
0
 def test_subclass(self):
     d = Detector(self.train_dataset, self.train_dataset, 'dog')
     assert(isinstance(d, Detector))