class_docstr: Show action that visualizes selected entries on an image
class_docstr_tok: ["Show","action","that","visualizes","selected","entries","on","an","image"]
code: def execute_on_outputs(
      cls: type,
      context: Dict[str, Any],
      entry: Dict[str, Any],
      outputs: Instances,
  ):
      import cv2
      import numpy as np
  
      visualizer = context["visualizer"]
      extractor = context["extractor"]
      image_fpath = entry["file_name"]
      logger.info(f"Processing {image_fpath}")
      image = cv2.cvtColor(entry["image"], cv2.COLOR_BGR2GRAY)
      image = np.tile(image[:, :, np.newaxis], [1, 1, 3])
      data = extractor(outputs)
      image_vis = visualizer.visualize(image, data)
      entry_idx = context["entry_idx"] + 1
      out_fname = cls._get_out_fname(entry_idx, context["out_fname"])
      out_dir = os.path.dirname(out_fname)
      if len(out_dir) > 0 and not os.path.exists(out_dir):
          os.makedirs(out_dir)
      cv2.imwrite(out_fname, image_vis)
      logger.info(f"Output saved to {out_fname}")
      context["entry_idx"] += 1
  
imports: import argparse
  import glob
  import logging
  import os
  import sys
  from typing import Any, ClassVar, Dict, List
  import torch
  from detectron2.config import CfgNode, get_cfg
  from detectron2.data.detection_utils import read_image
  from detectron2.engine.defaults import DefaultPredictor
  from detectron2.structures.instances import Instances
  from detectron2.utils.logger import setup_logger
  from densepose import add_densepose_config
  from densepose.structures import DensePoseChartPredictorOutput, DensePoseEmbeddingPredictorOutput
  from densepose.utils.logger import verbosity_to_level
  from densepose.vis.base import CompoundVisualizer
  from densepose.vis.bounding_box import ScoredBoundingBoxVisualizer
  from densepose.vis.densepose_outputs_vertex import DensePoseOutputsTextureVisualizer, DensePoseOutputsVertexVisualizer, get_texture_atlases
  from densepose.vis.densepose_results import DensePoseResultsContourVisualizer, DensePoseResultsFineSegmentationVisualizer, DensePoseResultsUVisualizer, DensePoseResultsVVisualizer
  from densepose.vis.densepose_results_textures import DensePoseResultsVisualizerWithTexture, get_texture_atlas
  from densepose.vis.extractor import CompoundExtractor, DensePoseOutputsExtractor, DensePoseResultExtractor, create_extractor
label_desc: Use image node_id 4 for calling the ShowAction obj's underlying member method code with example usage: obj.execute_on_outputs(cls, context, entry, outputs) without return types