detection
Object detection and instance segmentation with InternImage in MMDetection 2.x, including config selection, command templates, custom plugin registration, SAM-prompted masks, and troubleshooting.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- detection
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Object detection and instance segmentation with InternImage in MMDetection 2.x, including config selection, command templates, custom plugin registration, SAM-prompted masks, and troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/config-catalog.md9.6 KB
- 参考文档references/sam-integration.md5.2 KB
- 参考文档references/troubleshooting.md10.6 KB
- 参考文档references/workflows.md11.4 KB
- 脚本scripts/build_detection_command.py19.6 KB
03 SKILL.md 正文
InternImage Detection Sub-skill
Use this sub-skill when the user is working with InternImage object detection or instance segmentation on the repository's MMDetection 2.x stack: choosing COCO, LVIS, OpenImages, VOC, or CrowdHuman configs; building train/test/demo commands; diagnosing custom MMDetection registry issues; or planning SAM-prompted masks from detector boxes.
Operating flow
- Identify the user's goal: train, distributed train, test/evaluate, distributed test, single-image demo, or SAM-prompted instance segmentation.
- Choose a compatible config family from
references/config-catalog.md; keep the dataset, detector head, backbone size, checkpoint, and evaluation metric aligned. - Generate a dry-run shell template with
scripts/build_detection_command.pyinstead of copying source launch snippets by hand. The helper prints commands only and never runs training, inference, downloads, or CUDA builds. - Before execution, check
references/workflows.mdfor environment, data, output, distributed, Slurm, and custom-plugin requirements. - For SAM workflows, read
references/sam-integration.mdbefore choosing a detector config or SAM checkpoint. - If an import, registry, DCNv3, dataset, checkpoint, output, distributed, or SAM error occurs, use
references/troubleshooting.mdfirst.
Runtime guardrails
- Full detection training/evaluation/demo/SAM runs require a prepared OpenMMLab environment, local datasets, checkpoints, GPU-compatible PyTorch, and usually the DCNv3 CUDA extension. This generated skill only verified self-contained files and helper behavior.
- The detection stack is the MMDetection 2.28-era API. Do not silently translate these configs to MMDetection 3.x commands.
- Preserve custom registration: the source entrypoints import
mmcv_customandmmdet_custombefore model or dataset construction, and InternImage backbones import the localops_dcnv3package. - TensorRT/mmdeploy export is a deployment workflow. Route detailed export/build tasks to the sibling deployment sub-skill; keep only detection config/checkpoint selection here.
- Do not ask users to open original repository docs or scripts for instructions; use the bundled references and helper script.
Command-builder examples
# List distilled detection config keys.
python scripts/build_detection_command.py --list-configs
# Build a one-GPU COCO Mask R-CNN evaluation template.
python scripts/build_detection_command.py test \
--repo-root <INTERNIMAGE_REPO> \
--config-key coco/mask_rcnn_internimage_t_fpn_1x_coco \
--checkpoint checkpoints/mask_rcnn_internimage_t_fpn_1x_coco.pth \
--eval bbox segm
# Build a distributed DINO evaluation template.
python scripts/build_detection_command.py dist-test \
--repo-root <INTERNIMAGE_REPO> \
--config-key coco/dino_4scale_internimage_t_1x_coco_layer_wise_lr \
--checkpoint checkpoints/dino_4scale_internimage_t_1x_coco.pth \
--gpus 8 --eval bbox
# Build a single-image visualization template.
python scripts/build_detection_command.py image-demo \
--repo-root <INTERNIMAGE_REPO> \
--image images/example.jpg \
--config-key coco/mask_rcnn_internimage_t_fpn_1x_coco \
--checkpoint checkpoints/mask_rcnn_internimage_t_fpn_1x_coco.pth \
--device cuda:0 --palette coco --out demo
# Build a SAM-prompted mask-evaluation template.
python scripts/build_detection_command.py sam \
--repo-root <INTERNIMAGE_REPO> \
--config-key coco/mask_rcnn_internimage_t_fpn_1x_coco \
--checkpoint checkpoints/mask_rcnn_internimage_t_fpn_1x_coco.pth \
--sam-checkpoint checkpoints/sam_vit_b.pth \
--sam-type vit_b --eval segm --out sam_results.pkl
Bundled materials
references/workflows.md- train/test/demo/distributed/Slurm workflows, output semantics, custom plugin registration, and export routing.references/config-catalog.md- distilled model/config families, dataset roots, metric choices, and checkpoint compatibility notes.references/sam-integration.md- detector plus Segment Anything route, requirements, command shape, and limitations.references/troubleshooting.md- detection-specific failure modes and fixes.scripts/build_detection_command.py- standalone dry-run command builder fortrain,dist-train,test,dist-test,image-demo, andsammodes.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).