Esempio n. 1
0
 def result_per_category(self):
     """See base class."""
     sq = base_metric.realdiv_maybe_zero(self.iou_per_class,
                                         self.tp_per_class)
     rq = base_metric.realdiv_maybe_zero(
         self.tp_per_class, self.tp_per_class + 0.5 * self.fn_per_class +
         0.5 * self.fp_per_class)
     return np.multiply(sq, rq)
Esempio n. 2
0
    def detailed_results(self, is_thing=None):
        """See base class."""
        valid_categories = self._valid_categories()

        # If known, break down which categories are valid _and_ things/stuff.
        category_sets = collections.OrderedDict()
        category_sets['All'] = valid_categories
        if is_thing is not None:
            category_sets['Things'] = np.logical_and(valid_categories,
                                                     is_thing)
            category_sets['Stuff'] = np.logical_and(valid_categories,
                                                    np.logical_not(is_thing))

        # Compute individual per-class metrics that constitute factors of PQ.
        sq = base_metric.realdiv_maybe_zero(self.iou_per_class,
                                            self.tp_per_class)
        rq = base_metric.realdiv_maybe_zero(
            self.tp_per_class, self.tp_per_class + 0.5 * self.fn_per_class +
            0.5 * self.fp_per_class)
        pq = np.multiply(sq, rq)

        # Assemble detailed results dictionary.
        results = {}
        for category_set_name, in_category_set in six.iteritems(category_sets):
            if np.any(in_category_set):
                results[category_set_name] = {
                    'pq': np.mean(pq[in_category_set]),
                    'sq': np.mean(sq[in_category_set]),
                    'rq': np.mean(rq[in_category_set]),
                    # The number of categories in this subset.
                    'n': np.sum(in_category_set.astype(np.int32)),
                }
            else:
                results[category_set_name] = {
                    'pq': 0,
                    'sq': 0,
                    'rq': 0,
                    'n': 0
                }

        return results
Esempio n. 3
0
 def result_per_category(self):
   """See base class."""
   return base_metric.realdiv_maybe_zero(self.weighted_iou_per_class,
                                         self.gt_area_per_class)
Esempio n. 4
0
 def result_per_category(self):
   """See base class."""
   return base_metric.realdiv_maybe_zero(self.weighted_iou_per_class,
                                         self.gt_area_per_class)