inference-export
Run D-FINE inference, export, deployment, benchmark, visualization, and EMA checkpoint workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-export
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Run D-FINE inference, export, deployment, benchmark, visualization, and EMA checkpoint workflows.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/deployment-and-benchmarks.md7.0 KB
- 参考文档references/inference-and-export.md8.8 KB
- 参考文档references/troubleshooting.md8.2 KB
- 脚本scripts/dfine_benchmark_command.py3.0 KB
- 脚本scripts/dfine_export_command.py4.8 KB
- 脚本scripts/dfine_inference_command.py6.2 KB
- 脚本scripts/extract_ema_checkpoint.py2.8 KB
03 SKILL.md 正文
D-FINE Inference and Export Router
Use this sub-skill when the user needs D-FINE deployment or inference commands, backend prerequisites, generated result filenames, benchmark commands, or EMA-only checkpoint extraction.
Route by task
- PyTorch image/video inference: collect a D-FINE config, checkpoint, input image/video, and device; then use references/inference-and-export.md or
scripts/dfine_inference_command.py --backend torch. - ONNX export or ONNX Runtime inference: collect config, checkpoint, ONNX model path, input image/video, and optional check/simplify requirements; then use references/inference-and-export.md and
scripts/dfine_export_command.pyorscripts/dfine_inference_command.py --backend onnx. - TensorRT engine build, inference, or latency: collect ONNX model, engine output/input, CUDA device, image directory for latency, and TensorRT toolchain availability; then use references/deployment-and-benchmarks.md,
scripts/dfine_export_command.py --build-trt,scripts/dfine_inference_command.py --backend trt, orscripts/dfine_benchmark_command.py --benchmark trt. - OpenVINO inference: collect an OpenVINO IR/XML model and image path; then use references/inference-and-export.md or
scripts/dfine_inference_command.py --backend openvino. - FLOPs/MACs/params or FiftyOne visualization: use references/deployment-and-benchmarks.md and
scripts/dfine_benchmark_command.py --benchmark flopsfor static model info. - EMA checkpoint extraction: use
scripts/extract_ema_checkpoint.pywhen a checkpoint hasema.moduleand the user needs a{model: ...}checkpoint for simpler loading/export.
Required inputs to ask for
- Config file for config-bound workflows, for example a COCO, Objects365, CrowdHuman, or custom D-FINE YAML.
- Checkpoint for PyTorch inference, ONNX export, FiftyOne, or EMA extraction.
- ONNX model for ONNX Runtime inference or TensorRT engine creation.
- TensorRT engine for TensorRT inference/latency; OpenVINO IR/XML model for OpenVINO inference.
- Image/video path for visualization inference; image directory for TensorRT latency benchmark.
- Device string where the native script accepts one, such as
cpu,cuda:0, or TensorRT CUDA device. - Expected output filename: PyTorch uses
torch_results.jpgortorch_results.mp4; ONNX Runtime usesonnx_result.jpgoronnx_result.mp4; TensorRT usestrt_result.jpgortrt_result.mp4; OpenVINO writesopenvino_result.jpg.
Boundaries
- This sub-skill covers inference, export, deployment conversion, benchmark commands, optional backend prerequisites, output files, and deployment-oriented checkpoint conversion.
- Route training, resume, tuning, evaluation, checkpoint creation, and long experiment launch decisions to the training/evaluation sub-skill.
- Route dataset layout and data config editing to the data/config sub-skill.
- Route architecture internals to the architecture/API sub-skill, except for deploy-mode facts needed for export and inference.
Failure handling
Start with references/troubleshooting.md for missing checkpoint keys, HGNetv2.pretrained, ONNX opset/check/simplify, TensorRT/trtexec, OpenVINO IR/device, preprocessing, shifted boxes, and output filename mismatches.
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).