def __init__(self, ground_truth_filename=None, proposal_filename=None, ground_truth_fields=GROUND_TRUTH_FIELDS, proposal_fields=PROPOSAL_FIELDS, tiou_thresholds=np.linspace(0.5, 0.95, 10), max_avg_nr_proposals=None, subset='validation', verbose=False, check_status=False): if not ground_truth_filename: raise IOError('Please input a valid ground truth file.') if not proposal_filename: raise IOError('Please input a valid proposal file.') self.subset = subset self.tiou_thresholds = tiou_thresholds self.max_avg_nr_proposals = max_avg_nr_proposals self.verbose = verbose self.gt_fields = ground_truth_fields self.pred_fields = proposal_fields self.recall = None self.avg_recall = None self.proposals_per_video = None self.check_status = check_status # Retrieve blocked videos from server. if self.check_status: self.blocked_videos = get_blocked_videos() else: self.blocked_videos = list() # Import ground truth and proposals. self.ground_truth, self.activity_index = self._import_ground_truth( ground_truth_filename) self.proposal = self._import_proposal(proposal_filename) if self.verbose: print('[INIT] Loaded annotations from {} subset.'.format(subset)) nr_gt = len(self.ground_truth) print('\tNumber of ground truth instances: {}'.format(nr_gt)) nr_pred = len(self.proposal) print('\tNumber of proposals: {}'.format(nr_pred)) print('\tFixed threshold for tiou score: {}'.format( self.tiou_thresholds))
def __init__(self, ground_truth_filename=None, prediction_filename=None, ground_truth_fields=GROUND_TRUTH_FIELDS, prediction_fields=PREDICTION_FIELDS, tiou_thresholds=np.linspace(0.5, 0.95, 10), subset='validation', verbose=False, check_status=True): if not ground_truth_filename: raise IOError('Please input a valid ground truth file.') if not prediction_filename: raise IOError('Please input a valid prediction file.') self.subset = subset self.tiou_thresholds = tiou_thresholds self.verbose = verbose self.gt_fields = ground_truth_fields self.pred_fields = prediction_fields self.ap = None self.check_status = check_status # Retrieve blocked videos from server. # TODO: we can filter the blocked_videos for validation and test dataset, # improve efficiency if self.check_status: self.blocked_videos = get_blocked_videos() else: self.blocked_videos = list() # Import ground truth and predictions. self.ground_truth, self.activity_index = self._import_ground_truth( ground_truth_filename) self.prediction = self._import_prediction(prediction_filename) if self.verbose: print('[INIT] Loaded annotations from {} subset.'.format(subset)) nr_gt = len(self.ground_truth) print('\tNumber of ground truth instances: {}'.format(nr_gt)) nr_pred = len(self.prediction) print('\tNumber of predictions: {}'.format(nr_pred)) print('\tFixed threshold for tiou score: {}'.format( self.tiou_thresholds))