AGENT SKILL

legacy-models

Operate the repository's legacy TensorRT Caffe demos: build GoogLeNet classification and the three-stage MTCNN face detector, compile the pytrt Cython bridge, validate model/label assets, and diagnose version-bound runtime failures.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
legacy-models
license
MIT
metadata
{ "disco-role": "operating" }
description
Operate the repository's legacy TensorRT Caffe demos: build GoogLeNet classification and the three-stage MTCNN face detector, compile the pytrt Cython bridge, validate model/label assets, and diagnose version-bound runtime failures.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Legacy Caffe models: GoogLeNet and MTCNN

Use this sub-skill when a task concerns the googlenet/ or mtcnn/ demos, pytrt.pyx/pytrt.pxd, trt_googlenet*.py, trt_mtcnn.py, or utils/mtcnn.py. It describes the repository snapshot's legacy Caffe and TensorRT execution path. It does not install packages, download models, or ship generated engines, shared libraries, Caffe weights, or installers.

The normal working directory for every command below is the repository root. Run python3 scripts/validate-legacy-model-assets.py --repo-root . before a build. Read references/workflows.md for the ordered build/inference procedure, api-reference.md for tensor and threshold contracts, and compatibility.md before selecting a TensorRT version.

Operating boundary

  • Treat the checked-out repository and its documented source files as the evidence boundary. The checkout may contain large model weights, but this skill intentionally references them by path rather than copying them.
  • Engine files are TensorRT-version-, platform-, and GPU-dependent outputs. Build them on the target and do not reuse an engine from another host unless deserialization has been explicitly proven for the exact runtime.
  • The Caffe parser and the Cython pytrt extension are required for these two demos. A CPU-only Python check cannot prove inference readiness.
  • Native --help is conditional: both demo scripts import pytrt at module import time, so help succeeds only after a compatible extension has been built and its TensorRT/CUDA libraries can load.
  • Keep generated *.engine, *.so, pytrt.cpp, and build directories out of this runtime skill tree. The supplied validator is read-only.

Quick decision table

Need Entry point Required generated assets
Classify an image or stream trt_googlenet.py googlenet/deploy.engine, built pytrt
Detect faces and landmarks trt_mtcnn.py mtcnn/det1.engine, det2.engine, det3.engine, built pytrt
Build GoogLeNet engine googlenet/create_engine.cpp deploy.prototxt, deploy.caffemodel, TensorRT Caffe parser
Build MTCNN engines mtcnn/create_engines.cpp three det*_relu prototxt/weights, TensorRT Caffe parser
Build Python bridge root Makefile → setup.py Cython, NumPy, CUDA/TensorRT headers and libraries
Check source/assets without mutation scripts/validate-legacy-model-assets.py Python standard library only

If the request is to modernize these demos, export them, or replace Caffe, stop at the compatibility boundary and describe the migration separately; do not silently reinterpret a legacy workflow as modern TensorRT support.

Core workflow

  1. Confirm assets and runtime. Validate source descriptors and expected filenames. Confirm that the target has a matching NVIDIA driver, CUDA, TensorRT Caffe parser/runtime, a C++ toolchain, Python 3, NumPy, OpenCV, and Cython. For Jetson, identify the JetPack/TensorRT pairing first.
  2. Build engines on the target. From googlenet/, run make then ./create_engine; from mtcnn/, run make then ./create_engines. The programs serialize and immediately deserialize engines and print binding information. A successful compiler invocation alone is insufficient.
  3. Build pytrt. From the repository root, run make PYTHON=python3. This invokes setup.py build_ext -if, compiles the Cython module against trtNet.cpp, and removes only the temporary build/ directory. The resulting extension is generated at the root and is intentionally not part of this skill.
  4. Run a low-risk image trial. Use --image with a local image and keep the process in a display-capable session. Image input repeats indefinitely; press Esc to stop. Use --copy_frame for live sources if inference can outpace capture and the displayed frame is modified in place.
  5. Check outputs. GoogLeNet must return a prob tensor with 1000 scores and display top three labels. MTCNN must return (N,5) boxes and (N,10) landmarks, with no NaNs and coordinates clipped to the image bounds. Record the exact TensorRT version, GPU, source commit, engine build command, and input mode with the result.

Safety and failure handling

Do not run install*.sh, download_yolo.sh, sudo pip, or network fetches as part of this workflow. Do not infer that an absent weight is safe to replace with a random or newer model: descriptor/weight compatibility is required. Use the read-only validator to distinguish missing assets from a broken build. For failures, classify them as missing source/weight, toolchain/header/linker, engine deserialization/version, extension import, input/GStreamer, or model post-processing. See troubleshooting.md.

Difficult synthetic usability cases

  1. MTCNN scale-and-threshold case: Given a 1920×1080 BGR frame and the default minsize=40, predict that TrtMtcnn.detect rescales to at most 1280×720, raises the effective minimum size but never below 40, converts BGR→RGB, and applies PNet/RNet/ONet thresholds 0.7/0.6/0.7. Confirm that a caller asking for minsize=32 is rejected rather than silently accepted.
  2. Mixed-runtime asset case: Given all six Caffe model files and descriptors but no generated engines or pytrt, use the validator to report source/model readiness with generated-runtime warnings; explain why both demo --help commands remain blocked until a compatible extension and engines exist.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351