Example #1
0
    def render(self, metrics: DetectionMetrics, md_list: DetectionMetricDataList) -> None:
        """
        Renders various PR and TP curves.
        :param metrics: DetectionMetrics instance.
        :param md_list: DetectionMetricDataList instance.
        """
        if self.verbose:
            print('Rendering PR and TP curves')

        def savepath(name):
            return os.path.join(self.plot_dir, name + '.pdf')

        summary_plot(md_list, metrics, min_precision=self.cfg.min_precision, min_recall=self.cfg.min_recall,
                     dist_th_tp=self.cfg.dist_th_tp, savepath=savepath('summary'))

        for detection_name in self.cfg.class_names:
            class_pr_curve(md_list, metrics, detection_name, self.cfg.min_precision, self.cfg.min_recall,
                           savepath=savepath(detection_name + '_pr'))

            class_tp_curve(md_list, metrics, detection_name, self.cfg.min_recall, self.cfg.dist_th_tp,
                           savepath=savepath(detection_name + '_tp'))

        for dist_th in self.cfg.dist_ths:
            dist_pr_curve(md_list, metrics, dist_th, self.cfg.min_precision, self.cfg.min_recall,
                          savepath=savepath('dist_pr_' + str(dist_th)))
Example #2
0
    def render(self, md_list: MetricDataList, metrics: DetectionMetrics):
        def savepath(name):
            return os.path.join(self.plot_dir, name + '.pdf')

        summary_plot(md_list,
                     metrics,
                     min_precision=self.cfg.min_precision,
                     min_recall=self.cfg.min_recall,
                     dist_th_tp=self.cfg.dist_th_tp,
                     savepath=savepath('summary'))

        for detection_name in self.cfg.class_names:
            class_pr_curve(md_list,
                           metrics,
                           detection_name,
                           self.cfg.min_precision,
                           self.cfg.min_recall,
                           savepath=savepath(detection_name + '_pr'))

            class_tp_curve(md_list,
                           metrics,
                           detection_name,
                           self.cfg.min_recall,
                           self.cfg.dist_th_tp,
                           savepath=savepath(detection_name + '_tp'))

        for dist_th in self.cfg.dist_ths:
            dist_pr_curve(md_list,
                          metrics,
                          dist_th,
                          self.cfg.min_precision,
                          self.cfg.min_recall,
                          savepath=savepath('dist_pr_' + str(dist_th)))