Generates the visual report
503111
def _generate_report(self):
        
        from niworkflows.viz.utils import plot_registration
        NIWORKFLOWS_LOG.info('Generating visual report')

        fixed_image_nii = load_img(self._fixed_image)
        moving_image_nii = load_img(self._moving_image)
        contour_nii = load_img(self._contour) if self._contour is not None else None

        if self._fixed_image_mask:
            fixed_image_nii = unmask(apply_mask(fixed_image_nii,
                                                self._fixed_image_mask),
                                     self._fixed_image_mask)
            # since the moving image is already in the fixed image space we
            # should apply the same mask
            moving_image_nii = unmask(apply_mask(moving_image_nii,
                                                 self._fixed_image_mask),
                                      self._fixed_image_mask)
            mask_nii = load_img(self._fixed_image_mask)
        else:
            mask_nii = threshold_img(fixed_image_nii, 1e-3)

        n_cuts = 7
        if not self._fixed_image_mask and contour_nii:
            cuts = cuts_from_bbox(contour_nii, cuts=n_cuts)
        else:
            cuts = cuts_from_bbox(mask_nii, cuts=n_cuts)

        # Call composer
        compose_view(
            plot_registration(fixed_image_nii, 'fixed-image',
                              estimate_brightness=True,
                              cuts=cuts,
                              label=self._fixed_image_label,
                              contour=contour_nii,
                              compress=self.inputs.compress_report),
            plot_registration(moving_image_nii, 'moving-image',
                              estimate_brightness=True,
                              cuts=cuts,
                              label=self._moving_image_label,
                              contour=contour_nii,
                              compress=self.inputs.compress_report),
            out_file=self._out_report
        )
1078093
def _create_graphical_report(inputfile, pwm, background, closest_match, outdir, stats, best_id=None):
    """"""
    if best_id is None:
        best_id = {}

    logger.debug("Creating graphical report")
    
    class ReportMotif(object):
        """Placeholder for motif stats."""
        pass

    config = MotifConfig()
    
    imgdir = os.path.join(outdir, "images")
    if not os.path.exists(imgdir):
        os.mkdir(imgdir)
    
    motifs = read_motifs(pwm, fmt="pwm")
    
    roc_img_file = "%s_roc.%s"

    dbpwm = config.get_default_params()["motif_db"]
    pwmdir = config.get_motif_dir()

    dbmotifs = read_motifs(os.path.join(pwmdir, dbpwm), as_dict=True)
    
    report_motifs = []
    for motif in motifs:
        
        rm = ReportMotif()
        rm.id = motif.id
        rm.id_href = {"href": "#%s" % motif.id}
        rm.id_name = {"name": motif.id}
        rm.img = {"src":  os.path.join("images", "%s.png" % motif.id)}
        motif.to_img(os.path.join(outdir, "images/{}.png".format(motif.id)), fmt="PNG")
        
        # TODO: fix best ID
        rm.best = "Gimme"#best_id[motif.id]

        rm.consensus = motif.to_consensus()
        rm.stars = int(np.mean(
                [stats[str(motif)][bg].get("stars", 0) for bg in background]
                ) + 0.5)

        rm.bg = {}
        for bg in background:
            rm.bg[bg] = {}
            this_stats = stats.get(str(motif), {}).get(bg)
            # TODO: fix these stats
            rm.bg[bg]["e"] = "%0.2f" % this_stats.get("enr_at_fpr", 1.0)
            rm.bg[bg]["p"] = "%0.2f" % this_stats.get("phyper_at_fpr", 1.0)
            rm.bg[bg]["auc"] = "%0.3f" % this_stats.get("roc_auc", 0.5)
            rm.bg[bg]["mncp"] = "%0.3f" % this_stats.get("mncp", 1.0)
            rm.bg[bg]["roc_img"] = {"src": "images/" + os.path.basename(roc_img_file % (motif.id, bg)) + ".png"}
            rm.bg[bg][u"roc_img_link"] = {u"href": "images/" + os.path.basename(roc_img_file % (motif.id, bg)) + ".png"}

        rm.histogram_img = {"data":"images/%s_histogram.svg" % motif.id}
        rm.histogram_link= {"href":"images/%s_histogram.svg" % motif.id}
        
        match_id = closest_match[motif.id][0]
        dbmotifs[match_id].to_img(os.path.join(outdir, "images/{}.png".format(match_id)), fmt="PNG")
    
        rm.match_img = {"src":  "images/{}.png".format(match_id)}
        rm.match_id = closest_match[motif.id][0]
        rm.match_pval = "%0.2e" % closest_match[motif.id][1][-1]

        report_motifs.append(rm)
    
    total_report = os.path.join(outdir, "motif_report.html")

    star_img = os.path.join(config.get_template_dir(), "star.png")
    shutil.copyfile(star_img, os.path.join(outdir, "images", "star.png"))

    env = jinja2.Environment(loader=jinja2.FileSystemLoader([config.get_template_dir()]))
    template = env.get_template("report_template.jinja.html")
    # TODO: title
    result = template.render(
                    motifs=report_motifs, 
                    inputfile=inputfile, 
                    date=datetime.today().strftime("%d/%m/%Y"), 
                    version=__version__,
                    bg_types=list(background.keys()))

    with open(total_report, "wb") as f:
        f.write(result.encode('utf-8'))
455870
def generate(self):
    
    self._setup()

    header_html = self._generate_header()
    footer_html = self._generate_footer()
    results_topbar_html = self._generate_topbar("results")
    summary_topbar_html = self._generate_topbar("summary")
    logs_topbar_html = self._generate_topbar("logs")
    diff_topbar_html = self._generate_topbar("diff")

    summary_body_html = self._generate_summary_body()
    diff_body_html = self._generate_diff_body()
    summary_html = header_html + summary_topbar_html + summary_body_html + footer_html
    diff_html = header_html + diff_topbar_html + diff_body_html+ footer_html
    Reporter._make_file(summary_html, self.report_info.home_page)
    Reporter._make_file(diff_html,self.report_info.diff_page)

    log_body_html = self._generate_log_body()
    log_html = header_html + logs_topbar_html + log_body_html+footer_html
    Reporter._make_file(log_html, self.report_info.log_page)

    for config_name in self.report_info.config_to_test_names_map.keys():
      config_dir = os.path.join(self.report_info.resource_dir, config_name)
      utils.makedirs(config_dir)

      config_body_html = self._generate_config_body(config_name)
      config_html = header_html + results_topbar_html + config_body_html + footer_html
      config_file = os.path.join(config_dir, config_name + self.report_info.report_file_sfx)
      Reporter._make_file(config_html, config_file)

      for test_name in self.data_source.get_test_names(config_name):
        test_body_html = self._generate_test_body(config_name, test_name)
        test_html = header_html + results_topbar_html + test_body_html + footer_html
        test_file = os.path.join(config_dir, test_name + self.report_info.report_file_sfx)
        Reporter._make_file(test_html, test_file)
1034092
def do_visualize(model, model_path, nr_visualize=100, output_dir='output'):
    
    df = get_train_dataflow()   # we don't visualize mask stuff
    df.reset_state()

    pred = OfflinePredictor(PredictConfig(
        model=model,
        session_init=get_model_loader(model_path),
        input_names=['image', 'gt_boxes', 'gt_labels'],
        output_names=[
            'generate_{}_proposals/boxes'.format('fpn' if cfg.MODE_FPN else 'rpn'),
            'generate_{}_proposals/scores'.format('fpn' if cfg.MODE_FPN else 'rpn'),
            'fastrcnn_all_scores',
            'output/boxes',
            'output/scores',
            'output/labels',
        ]))

    if os.path.isdir(output_dir):
        shutil.rmtree(output_dir)
    utils.fs.mkdir_p(output_dir)
    with tqdm.tqdm(total=nr_visualize) as pbar:
        for idx, dp in itertools.islice(enumerate(df), nr_visualize):
            img, gt_boxes, gt_labels = dp['image'], dp['gt_boxes'], dp['gt_labels']

            rpn_boxes, rpn_scores, all_scores, \
                final_boxes, final_scores, final_labels = pred(img, gt_boxes, gt_labels)

            # draw groundtruth boxes
            gt_viz = draw_annotation(img, gt_boxes, gt_labels)
            # draw best proposals for each groundtruth, to show recall
            proposal_viz, good_proposals_ind = draw_proposal_recall(img, rpn_boxes, rpn_scores, gt_boxes)
            # draw the scores for the above proposals
            score_viz = draw_predictions(img, rpn_boxes[good_proposals_ind], all_scores[good_proposals_ind])

            results = [DetectionResult(*args) for args in
                       zip(final_boxes, final_scores, final_labels,
                           [None] * len(final_labels))]
            final_viz = draw_final_outputs(img, results)

            viz = tpviz.stack_patches([
                gt_viz, proposal_viz,
                score_viz, final_viz], 2, 2)

            if os.environ.get('DISPLAY', None):
                tpviz.interactive_imshow(viz)
            cv2.imwrite("{}/{:03d}.png".format(output_dir, idx), viz)
            pbar.update()
592931
public function buildAdminScreen()
    {

        $p = new DesignPanel($this, "ADMIN");
        $this->initializePanels("ADMIN");
        $this->setAttribute("ReportTitle", ReporticoApp::get('menu_title'));
        ReporticoLang::loadModeLanguagePack("languages", $this->output_charset);
        ReporticoLang::loadModeLanguagePack("admin", $this->output_charset);
        ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);

        if (ReporticoApp::getConfig("project") != "admin") {
            return;
        }

        if (ReporticoApp::get("static_menu") && is_array(ReporticoApp::get("static_menu"))) {
            $ct = 0;
            foreach (ReporticoApp::get("static_menu") as $menuitem) {
                if ($menuitem["title"] == "<AUTO>") {
                    // Generate Menu from XML files
                    if (is_dir(ReporticoApp::get("projpath"))) {
                        if ($dh = opendir(ReporticoApp::get("projpath"))) {
                            while (($file = readdir($dh)) !== false) {
                                $mtch = "/" . $menuitem["report"] . "/";
                                if (preg_match($mtch, $file)) {
                                    $repxml = new XmlReader($this, $file, false, "ReportTitle");
                                    $this->panels["MENU"]->setMenuItem($file, $repxml->search_response);
                                }
                            }
                            closedir($dh);
                        }
                    }
                } else {
                    $this->panels["MENU"]->setMenuItem($menuitem["report"], ReporticoLang::templateXlate($menuitem["title"]));
                }
                $ct++;
            }

            if ($ct == 0) {
                ReporticoApp::handleError("No Menu Items Available - Check Language - " . ReporticoApp::get("language"));
            }

            // Generate list of projects to choose from by finding all folders above the
            // current project area (i.e. the projects folder) and looking for any folder
            // that contains a config.php file (which means it proably is a project)
            $projpath = $this->projects_folder;
            if (!is_dir($projpath)) {
                ReporticoUtility::findFileToInclude($projpath, $projpath);
            }

            if (is_dir($projpath)) {
                $ct = 0;
                if ($dh = opendir($projpath)) {
                    while (($file = readdir($dh)) !== false) {
                        if ($file == ".") {
                            continue;
                        }

                        if (is_dir($projpath . "/" . $file)) {
                            if (is_file($projpath . "/" . $file . "/config.php")) {
                                //$repxml = new XmlReader($this, $file, false, "ReportTitle");
                                $this->panels["ADMIN"]->setProjectItem($file, $file);
                            }
                        }

                    }
                    closedir($dh);
                }
            }

        }
    }
370417
def summary(images, max)
      return <<-EOF

        Creating a sprite from following images:
        \n#{images.map{|i| "        #{report_path(i[:filename])} (#{i[:width]}x#{i[:height]})" }.join("\n")}

        Output files:
          #{report_path(output_image_file)}
          #{report_path(output_style_file)}

        Output size:
          #{max[:width]}x#{max[:height]}

      EOF
    end
260715
def visual(title, X, name):
    
    assert len(X.shape) == 4
    X = X.transpose((0, 2, 3, 1))
    X = np.clip((X - np.min(X))*(255.0/(np.max(X) - np.min(X))), 0, 255).astype(np.uint8)
    n = np.ceil(np.sqrt(X.shape[0]))
    buff = np.zeros((int(n*X.shape[1]), int(n*X.shape[2]), int(X.shape[3])), dtype=np.uint8)
    for i, img in enumerate(X):
        fill_buf(buff, i, img, X.shape[1:3])
    buff = buff[:, :, ::-1]
    plt.imshow(buff)
    plt.title(title)
    plt.savefig(name)
786472
def generate_py():
    """"""
    model = {}

    vk = init()
    format_vk(vk)
    model_alias(vk, model)
    model_typedefs(vk, model)
    model_enums(vk, model)
    model_macros(vk, model)
    model_funcpointers(vk, model)
    model_exceptions(vk, model)
    model_constructors(vk, model)
    model_functions(vk, model)
    model_ext_functions(vk, model)

    env = jinja2.Environment(
        autoescape=False,
        trim_blocks=True,
        lstrip_blocks=True,
        loader=jinja2.FileSystemLoader(HERE)
    )

    out_file = path.join(HERE, path.pardir, 'vulkan', '_vulkan.py')
    with open(out_file, 'w') as out:
        out.write(env.get_template('vulkan.template.py').render(model=model))
217647
def _generate(self):
        

        needs_close = False

        if sys.hexversion >= 0x03000000:
            if self._opts.output == '-':
                from io import TextIOWrapper

                pyfile = TextIOWrapper(sys.stdout.buffer, encoding='utf8')
            else:
                pyfile = open(self._opts.output, 'wt', encoding='utf8')
                needs_close = True
        else:
            if self._opts.output == '-':
                pyfile = sys.stdout
            else:
                pyfile = open(self._opts.output, 'wt')
                needs_close = True

        import_from = self._opts.import_from

        if import_from:
            from_imports = True
        elif self._opts.from_imports:
            from_imports = True
            import_from = '.'
        else:
            from_imports = False

        compileUi(self._ui_file, pyfile, self._opts.execute, self._opts.indent,
                from_imports, self._opts.resource_suffix, import_from)

        if needs_close:
            pyfile.close()
1213818
def report(ctx, board, done, output):
    ctx.obj['board_id'] = board
    ts = TrelloStats(ctx.obj)
    
    ct = cycle_time(ts, board, done)
    env = get_env()

    #  Get all render functions from the module and filter out the ones we don't want.
    render_functions = [target for target in
                     dir(sys.modules['trellostats.reports'])
                     if target.startswith("render_") and
                     target.endswith(output)]
    
    for render_func in render_functions:
        print globals()[render_func](env, **dict(cycle_time=ct))
858704
def report(output)
      sortings = output.options[:sort] || [:sum, :mean]
      sortings.each do |sorting|
        report_table(output, sorting, title: "#{title} - by #{sorting}")
      end

      if options[:total]
        output.puts
        output.puts "#{output.colorize(title, :white, :bold)} - total: " + output.colorize(display_value(sum_overall), :brown, :bold)
      end
    end
385279
def generate_view_data(self):
        """"""
        self.view_data['version'] = '{} {}'.format('Glances', __version__)
        self.view_data['psutil_version'] = ' with psutil {}'.format(psutil_version)

        try:
            self.view_data['configuration_file'] = 'Configuration file: {}'.format(self.config.loaded_config_file)
        except AttributeError:
            pass

        msg_col = ' {0:1}  {1:35}'
        msg_col2 = '   {0:1}  {1:35}'
        self.view_data['sort_auto'] = msg_col.format('a', 'Sort processes automatically')
        self.view_data['sort_network'] = msg_col2.format('b', 'Bytes or bits for network I/O')
        self.view_data['sort_cpu'] = msg_col.format('c', 'Sort processes by CPU%')
        self.view_data['show_hide_alert'] = msg_col2.format('l', 'Show/hide alert logs')
        self.view_data['sort_mem'] = msg_col.format('m', 'Sort processes by MEM%')
        self.view_data['sort_user'] = msg_col.format('u', 'Sort processes by USER')
        self.view_data['delete_warning_alerts'] = msg_col2.format('w', 'Delete warning alerts')
        self.view_data['sort_proc'] = msg_col.format('p', 'Sort processes by name')
        self.view_data['delete_warning_critical_alerts'] = msg_col2.format('x', 'Delete warning and critical alerts')
        self.view_data['sort_io'] = msg_col.format('i', 'Sort processes by I/O rate')
        self.view_data['percpu'] = msg_col2.format('1', 'Global CPU or per-CPU stats')
        self.view_data['sort_cpu_times'] = msg_col.format('t', 'Sort processes by TIME')
        self.view_data['show_hide_help'] = msg_col2.format('h', 'Show/hide this help screen')
        self.view_data['show_hide_diskio'] = msg_col.format('d', 'Show/hide disk I/O stats')
        self.view_data['show_hide_irq'] = msg_col2.format('Q', 'Show/hide IRQ stats')
        self.view_data['view_network_io_combination'] = msg_col2.format('T', 'View network I/O as combination')
        self.view_data['show_hide_filesystem'] = msg_col.format('f', 'Show/hide filesystem stats')
        self.view_data['view_cumulative_network'] = msg_col2.format('U', 'View cumulative network I/O')
        self.view_data['show_hide_network'] = msg_col.format('n', 'Show/hide network stats')
        self.view_data['show_hide_filesytem_freespace'] = msg_col2.format('F', 'Show filesystem free space')
        self.view_data['show_hide_sensors'] = msg_col.format('s', 'Show/hide sensors stats')
        self.view_data['generate_graphs'] = msg_col2.format('g', 'Generate graphs for current history')
        self.view_data['show_hide_left_sidebar'] = msg_col.format('2', 'Show/hide left sidebar')
        self.view_data['reset_history'] = msg_col2.format('r', 'Reset history')
        self.view_data['enable_disable_process_stats'] = msg_col.format('z', 'Enable/disable processes stats')
        self.view_data['quit'] = msg_col2.format('q', 'Quit (Esc and Ctrl-C also work)')
        self.view_data['enable_disable_top_extends_stats'] = msg_col.format('e', 'Enable/disable top extended stats')
        self.view_data['enable_disable_short_processname'] = msg_col.format('/', 'Enable/disable short processes name')
        self.view_data['enable_disable_irix'] = msg_col.format('0', 'Enable/disable Irix process CPU')
        self.view_data['enable_disable_docker'] = msg_col2.format('D', 'Enable/disable Docker stats')
        self.view_data['enable_disable_quick_look'] = msg_col.format('3', 'Enable/disable quick look plugin')
        self.view_data['show_hide_ip'] = msg_col2.format('I', 'Show/hide IP module')
        self.view_data['diskio_iops'] = msg_col2.format('B', 'Count/rate for Disk I/O')
        self.view_data['show_hide_top_menu'] = msg_col2.format('5', 'Show/hide top menu (QL, CPU, MEM, SWAP and LOAD)')
        self.view_data['enable_disable_gpu'] = msg_col.format('G', 'Enable/disable gpu plugin')
        self.view_data['enable_disable_mean_gpu'] = msg_col2.format('6', 'Enable/disable mean gpu')
        self.view_data['edit_pattern_filter'] = 'ENTER: Edit the process filter pattern'
615233
def generate_data_files():
    
    assets_folder = path.join('source', 'rafcon', 'gui', 'assets')
    share_folder = path.join(assets_folder, 'share')
    themes_folder = path.join(share_folder, 'themes', 'RAFCON')
    examples_folder = path.join('share', 'examples')
    libraries_folder = path.join('share', 'libraries')

    gui_data_files = [
        get_data_files_tuple(assets_folder, 'splashscreens'),
        get_data_files_tuple(assets_folder, 'fonts', 'FontAwesome'),
        get_data_files_tuple(assets_folder, 'fonts', 'Source Sans Pro'),
        get_data_files_tuple(themes_folder, 'gtk-3.0', 'gtk.css', path_to_file=True),
        get_data_files_tuple(themes_folder, 'gtk-3.0', 'gtk-dark.css', path_to_file=True),
        get_data_files_tuple(themes_folder, 'assets'),
        get_data_files_tuple(themes_folder, 'sass'),
        get_data_files_tuple(themes_folder, 'gtk-sourceview'),
        get_data_files_tuple(themes_folder, 'colors.json', path_to_file=True),
        get_data_files_tuple(themes_folder, 'colors-dark.json', path_to_file=True)
    ]
    # print("gui_data_files", gui_data_files)

    icon_data_files = get_data_files_recursively(path.join(share_folder, 'icons'), share_target_root="icons")
    # print("icon_data_files", icon_data_files)

    locale_data_files = create_mo_files()
    # example tuple
    # locale_data_files = [('share/rafcon/locale/de/LC_MESSAGES', ['source/rafcon/locale/de/LC_MESSAGES/rafcon.mo'])]
    # print("locale_data_files", locale_data_files)

    version_data_file = [("./", ["VERSION"])]
    desktop_data_file = [("share/applications", [path.join('share', 'applications', 'de.dlr.rm.RAFCON.desktop')])]

    examples_data_files = get_data_files_recursively(examples_folder, share_target_root=path.join("rafcon", "examples"))
    libraries_data_files = get_data_files_recursively(libraries_folder, share_target_root=path.join("rafcon",
                                                                                                    "libraries"))
    generated_data_files = gui_data_files + icon_data_files + locale_data_files + version_data_file + \
                           desktop_data_file + examples_data_files + libraries_data_files
    # for elem in generated_data_files:
    #     print(elem)
    return generated_data_files
15694
def generate(self, output_dir, catalogue, results, label):
        """"""
        data = results.get_raw_data()
        labels = catalogue.ordered_labels
        ngrams = self._generate_results(output_dir, labels, data)
        ngram_table = self._generate_ngram_table(output_dir, labels, data)
        corpus_table = self._generate_corpus_table(labels, ngrams)
        context = {'corpus_table': corpus_table, 'focus_label': label,
                   'labels': labels, 'ngram_table': ngram_table, 'sep': os.sep}
        report_name = 'lifetime-{}.html'.format(label)
        self._write(context, output_dir, report_name)
1026092
def generate_report(self):
        
        # Find register
        lines = ['Register Assignment\n-------------------']
        register, fit = self.heptad_register()
        lines.append('{}\n{}\n'.format(register, '\n'.join(self.cc.sequences)))
        lines.append('Fit Quality - Mean Angular Discrepancy = {:3.2f} (Std Dev = {:3.2f})\n'.format(*fit))
        # Find coiled coil parameters
        lines.append('Coiled Coil Parameters\n----------------------')
        layer_info = (self.radii_layers, self.alpha_layers, self.ca_layers)
        r_layer_aves, a_layer_aves, c_layer_aves = [self.calc_average_parameters(x) for x in layer_info]
        start_line = ['Res#'.rjust(5), 'Radius'.rjust(9), 'Alpha'.rjust(9), 'CrAngle'.rjust(9)]
        lines.append(''.join(start_line))
        for i in range(len(r_layer_aves[0])):
            residue = '{:>5}'.format(i+1)
            average_r = '{:+3.3f}'.format(r_layer_aves[0][i]).rjust(9)
            average_a = '{:+3.3f}'.format(a_layer_aves[0][i]).rjust(9)
            average_c = '{:+3.3f}'.format(c_layer_aves[0][i]).rjust(9)
            line = [residue, average_r, average_a, average_c]
            lines.append(''.join(line))
        # Average for assembly
        lines.append('-'*32)
        residue = '  Ave'
        average_r = '{:+3.3f}'.format(r_layer_aves[1]).rjust(9)
        average_a = '{:+3.3f}'.format(a_layer_aves[1]).rjust(9)
        average_c = '{:+3.3f}'.format(c_layer_aves[1]).rjust(9)
        line = [residue, average_r, average_a, average_c]
        lines.append(''.join(line))
        # Std dev
        residue = 'Std D'
        std_d_r = '{:+3.3f}'.format(numpy.std(r_layer_aves[0])).rjust(9)
        std_d_a = '{:+3.3f}'.format(numpy.std(a_layer_aves[0][:-1])).rjust(9)
        std_d_c = '{:+3.3f}'.format(numpy.std(c_layer_aves[0][:-1])).rjust(9)
        line = [residue, std_d_r, std_d_a, std_d_c]
        lines.append(''.join(line))
        return '\n'.join(lines)
125848
def generate_report(self, output_file):
        

        if self.TEMPLATE_NAME is not None:
            template = TEMPLATE_ENV.get_template(self.TEMPLATE_NAME)
            report = template.render(self._context())

            if isinstance(report, six.string_types):
                report = report.encode('utf-8')

            output_file.write(report)
501617
def draw_final_outputs(img, results):
    
    if len(results) == 0:
        return img

    # Display in largest to smallest order to reduce occlusion
    boxes = np.asarray([r.box for r in results])
    areas = np_area(boxes)
    sorted_inds = np.argsort(-areas)

    ret = img
    tags = []

    for result_id in sorted_inds:
        r = results[result_id]
        if r.mask is not None:
            ret = draw_mask(ret, r.mask)

    for r in results:
        tags.append(
            "{},{:.2f}".format(cfg.DATA.CLASS_NAMES[r.class_id], r.score))
    ret = viz.draw_boxes(ret, boxes, tags)
    return ret