inference-and-demo
Plan tf-faster-rcnn pretrained demo/image inference, checkpoint selection, NMS behavior, visualization, and dry-run command building without running the model.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference-and-demo
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Plan tf-faster-rcnn pretrained demo/image inference, checkpoint selection, NMS behavior, visualization, and dry-run command building without running the model.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/demo-inference.md3.6 KB
- 参考文档references/nms-and-postprocessing.md2.6 KB
- 参考文档references/troubleshooting.md3.2 KB
- 脚本scripts/demo_command_builder.py5.8 KB
03 SKILL.md 正文
tf-faster-rcnn Inference and Demo
Use this sub-skill for the repo's pretrained demo flow: choosing the backbone/dataset pair, validating the TensorFlow checkpoint prefix, reasoning about tools/demo.py and lib/model/test.py, and diagnosing inference-time image, visualization, and NMS failures.
Route here for
- Building or explaining the stock demo command for the bundled sample images.
- Deciding between
vgg16andres101fortools/demo.py. - Checking the checkpoint prefix and
.metafile before demo runs. - Understanding the VOC class list, demo thresholds, and output window behavior.
- Debugging
cv2.imread,plt.show(), or ResNet101 memory pressure during demo.
Do not handle here
- Dataset folder creation, checkpoint downloads, or symlink layout: use
../dataset-and-assets/SKILL.md. - Native extension builds,
nms.gpu_nmsinstallation, CUDA/toolkit setup, orUSE_GPU_NMSbuild recovery: use../installation-and-configuration/SKILL.md. - Dataset-wide AP runs,
tools/test_net.py,tools/reval.py, or training/evaluation launchers: use../training-and-evaluation/SKILL.md. - Backbone internals, feature-map shapes, or custom architecture changes: use
../api-and-architecture/SKILL.md.
Fast path
- Confirm the checkpoint family matches the requested network/dataset pair.
- Validate the TensorFlow checkpoint prefix under
output/<net>/<train_imdb>/default/<snapshot>.ckpt. - Remember the demo script only supports
--net {vgg16,res101}and--dataset {pascal_voc,pascal_voc_0712}. - Use the bundled command builder to print a safe command and validation result without running inference.
- Expect a matplotlib window after each bundled demo image; on headless systems, use an off-screen backend or save figures in a local copy of the script.
Bundled references
references/demo-inference.md: demo control flow, selectors, class labels, command shapes, and output expectations.references/nms-and-postprocessing.md: NMS dispatch, threshold handling, bbox postprocessing, and import caveats.references/troubleshooting.md: checkpoint, OpenCV, NMS, visualization, and memory failure modes.
Bundled helper
scripts/demo_command_builder.pyprints a shell command for the demo script and validates the expected checkpoint files.- It accepts
--repo-root,--net,--dataset,--gpu-id,--cpu, and--validate-only. - It never downloads assets, trains, or runs inference.
Key facts to keep straight
tools/demo.pyhardcodes the five sample images underdata/demo/.- The demo uses the Pascal VOC class list: background plus 20 foreground labels.
- Demo thresholds are fixed in source:
CONF_THRESH = 0.8andNMS_THRESH = 0.3. cfg.USE_GPU_NMS=Falsechanges dispatch, but it does not remove the top-levelnms.gpu_nmsimport innms_wrapper.py.lib/model/test.pyis the sharedim_detect/test_netcore; the demo flow is a thin wrapper around it.
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).