inference-evaluation
Routes DINO checkpoint evaluation on COCO, single-image inference, normalized box postprocessing, notebook-independent visualization, and bounded GFLOPS inspection.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-evaluation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Routes DINO checkpoint evaluation on COCO, single-image inference, normalized box postprocessing, notebook-independent visualization, and bounded GFLOPS inspection.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md8.9 KB
- 参考文档references/benchmarking.md3.8 KB
- 参考文档references/troubleshooting.md6.7 KB
- 参考文档references/workflows.md6.8 KB
- 脚本scripts/inference_smoke.py15.7 KB
03 SKILL.md 正文
DINO inference and evaluation
Use this route when a Researcher needs to inspect a pretrained DINO detector,
measure COCO box AP, run one custom image, understand the raw and postprocessed
box tensors, or obtain a bounded architecture/FPS/GFLOPS smoke measurement.
The route assumes a prepared DINO project root, a compatible config/checkpoint,
and the verified runtime (torch 2.5.1+cu121, torchvision 0.20.1+cu121, and an
importable MultiScaleDeformableAttention extension). Ordinary COCO detection
also needs pycocotools; panopticapi is only needed for a panoptic path. It
does not download weights/data or start a long evaluation by default.
Route boundaries
- Include here: pretrained checkpoint evaluation, one-image inference,
COCO AP interpretation,
pred_boxes/PostProcesssemantics, thresholding, output inspection, notebook-derived visualization, and safe benchmark interpretation. - Route training away: training, fine-tuning, resume orchestration,
distributed launch, Slurm/Submitit scheduling, and optimizer changes →
../training/. - Route setup away: installing the package, compiling or repairing the
deformable-attention extension, COCO directory preparation, and config/data
mutation →
../data-model-setup/.
Treat checkpoints as trusted local pickle-like artifacts; do not load an untrusted file. Do not claim a model is evaluated merely because it loads. A COCO result needs an evaluation log and the COCO evaluator's reported AP; a custom-image result needs the image/config/checkpoint identity and the postprocessing coordinate space.
Fast route
-
Preflight the triplet. Pair a 4-scale checkpoint with
config/DINO/DINO_4scale.pyand a 5-scale checkpoint withconfig/DINO/DINO_5scale.py; also match the backbone and class vocabulary. Check that the extension and optional Python imports listed above work. Confirm the COCO root hastrain2017/,val2017/, andannotations/instances_{train,val}2017.json. See troubleshooting before changing anything. -
Run COCO evaluation only when requested. Use the bundled evaluator planner to replace the source shell wrappers. It prints a command and does not launch unless
--launchis supplied:python skills/disco/dino/scripts/run_dino_eval.py \ --project-root /path/to/DINO \ --config config/DINO/DINO_4scale.py \ --coco-path /path/to/COCODIR \ --checkpoint /path/to/checkpoint \ --output-dir /path/to/eval-outputAdd
--launchonly after reviewing the command and setup gate. For a direct, explicit run use:python main.py \ --output_dir /path/to/eval-output \ -c config/DINO/DINO_4scale.py \ --coco_path /path/to/COCODIR \ --eval --resume /path/to/checkpoint \ --options dn_scalar=100 embed_init_tgt=TRUE \ dn_label_coef=1.0 dn_bbox_coef=1.0 use_ema=False \ dn_box_noise_scale=1.0This constructs the validation loader and evaluates the full requested split. Do not substitute
--pretrain_model_pathfor--resumewhen the goal is evaluation: the former is the partial-load/fine-tuning path. -
Run one custom image with the bundled smoke tool. It reimplements the notebook's RGB → resize → tensor → ImageNet normalization → model → bbox postprocess flow and does not import the notebook or source visualizer:
python skills/disco/dino/sub-skills/inference-evaluation/scripts/inference_smoke.py \ --project-root /path/to/DINO \ --config config/DINO/DINO_4scale.py \ --checkpoint /path/to/checkpoint \ --image /path/to/image.jpg \ --device cuda \ --score-threshold 0.30 \ --output-json /tmp/dino-predictions.json \ --visualize /tmp/dino-predictions.pngThe project root is intentionally explicit; no checkout or environment path is embedded in the script. A CPU invocation is useful for parser, transform, or dependency diagnostics but may fail at the CUDA deformable attention operator and is not an equivalent inference result. The command has one image and one forward pass as its default scope.
-
Interpret the result. Raw
pred_boxesare normalized(center_x, center_y, width, height)values. The bbox postprocessor selects the top-scoring query/class pairs, converts boxes toxyxy, and scales them by(image_width, image_height, image_width, image_height). For COCO AP it receives each target's original[height, width]; for visualization the transformed, unpadded size is the correct pixel target size. The bundled script intentionally passes[[1.0, 1.0]]toPostProcess, then derives normalized boxes and resized-image pixel boxes for its visualization output. -
Benchmark narrowly. Use
tools/benchmark.pyonly for an explicitly requested architecture/FPS/GFLOPS check. It is CUDA-only, uses 20 validation images and repeated warmups, does not load a checkpoint, and can warn about unsupported traced operations. See benchmarking.
Read next
- API reference for parser flags, config
families, tensor shapes, class IDs, and exact
PostProcessoutput. - Workflows for checkpoint/COCO evaluation and custom-image inference with expected artifacts.
- Benchmarking for the bounded GFLOPS/FPS command, output schema, and limitations.
- Troubleshooting for useful failure recovery, normalization mistakes, and optional visualization dependencies.
- Bundled smoke script for a safe, parser-checked, notebook-independent one-image run.
- Root evaluation planner for a print-only replacement of the source shell launchers.
Completion and evidence
Record the config path, checkpoint path/key, device, COCO root or image, command, score threshold, transformed/original image sizes, output files, and any warnings. A successful load is a smoke result, not an AP claim. Keep long benchmark/evaluation logs outside this skill directory.
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).