界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
设计与创意 · SKILL.md

inference-visualization

inference-visualization

【设计与创意】Run Detectron2 inference, inspect model outputs, and visualize predictions safely without depending on the source demo script.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: inference-visualization description: "Run Detectron2 inference, inspect model outputs, and visualize predictions safely without depending on the source demo script." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

Detectron2 Inference & Visualization

Use this sub-skill when a task asks to run Detectron2 inference, call DefaultPredictor, call a built model directly, inspect Instances/Boxes/masks, visualize predictions, plan demo-style image/video/webcam commands, or validate COCO-style prediction JSON before drawing it.

Fast Routing

Safe Defaults

  • Set inference device before model or predictor construction: Yacs configs use cfg.MODEL.DEVICE = "cpu" or the CLI override MODEL.DEVICE cpu.
  • Do not instantiate DefaultPredictor during no-download validation if cfg.MODEL.WEIGHTS points to a URL or detectron2:// URI; it loads weights during construction.
  • Treat OpenCV images as BGR, but pass RGB images to Visualizer; convert with image_rgb = image_bgr[:, :, ::-1].
  • Move predictions to CPU before visualization: instances = outputs["instances"].to("cpu").
  • Check instances.has("pred_boxes"), instances.has("scores"), and metadata class names before assuming labels or boxes exist.

Boundaries

This sub-skill owns inference calls, model input/output formats, Instances, Boxes, BoxMode, BitMasks, PolygonMasks, ImageList, Visualizer, ColorMode, demo-style flags, confidence thresholds, CPU overrides, and prediction JSON sanity checks.

Route model-zoo config/checkpoint selection to ../configuration-model-zoo/. Route dataset registration, catalog metadata, and dataset dict validation to ../data-datasets/. Route training, evaluation loops, evaluators, and metrics to ../training-evaluation/. Route TorchScript, tracing, Caffe2, and deployment packaging to ../deployment-export/.

我的收藏