training
Route for SSD Keras model building, compilation, training, and fine-tuning.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route for SSD Keras model building, compilation, training, and fine-tuning.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/troubleshooting.md2.0 KB
- 脚本scripts/smoke.py4.9 KB
03 SKILL.md 正文
Training
Use this route when the task is about building a trainable SSD model, loading pretrained weights, compiling the loss, wiring the encoder, or running a fitting loop.
What this route covers
- building SSD300, SSD512, or SSD7-style trainable models
- loading pretrained VGG or SSD weights by name
- compiling with
SSDLoss - creating
SSDInputEncoderinstances that match the model anchors - fitting on VOC, CSV, or synthetic data batches
- adapting classifier weights when the class count changes
- using the SSD7 template as a starting point for alternate backbones
What this route excludes
- dataset parsing details and augmentation internals
- decoding predictions
- VOC / COCO evaluation
Send those tasks to data-preparation or inference-evaluation.
First things to check
- Open
references/model-architecture.mdto confirm the model / encoder / loss contract. - Open
references/workflows.mdfor the notebook-derived training sequence. - Open
references/compatibility.mdif the old TensorFlow / Keras stack is not importing. - Run
scripts/smoke.pyfor a tiny synthetic model / encoder / train-step check.
Typical training workflow
1. Pick the model family
ssd_300is the canonical path and matches the main Pascal VOC / COCO notebook recipes.ssd_512uses the same design at a larger input size.build_modelis the smaller SSD7 template and is the best smoke path or custom-backbone starting point.
2. Match the anchor settings
The model builder and the encoder must agree on:
- scales
- aspect ratios
- steps
- offsets
- variances
- coordinate convention
- coordinate normalization
If these drift apart, the model will build but the targets or decoded boxes will be wrong.
3. Load pretrained weights carefully
- Use
load_weights(..., by_name=True)when the source weights were saved with a different head shape. - If the source and target class counts differ, adapt the classifier weights with
sample_tensorsbefore loading them. - The weight-sampling tutorial is the right reference when you are reusing a pretrained detector with a new class list.
4. Compile and fit
- Use
SSDLoss.compute_lossas the model loss. - Keep the optimizer settings consistent with the notebook recipe when you need to reproduce the historical results.
- Feed the model from
DataGeneratorthrough the data-preparation route. - Keep an eye on early training instability:
OOMandNaNare the two common failure modes.
5. Save and resume
- Save the whole model when you need to reload custom layers later.
- If you resume training, keep the loss, encoder, and model config exactly aligned with the original run.
Fine-tuning / transfer learning
When the class set changes, do not edit the pretrained weights by hand.
Instead:
- Inspect the source classifier kernel and bias shapes.
- Select the classes to keep.
- Use
sample_tensorsto sub-sample or up-sample the classifier tensors consistently. - Load the adapted weights into the new model head.
Useful source objects
ssd_300ssd_512build_modelSSDLossSSDInputEncodersample_tensorsAnchorBoxesL2NormalizationDecodeDetectionsDecodeDetectionsFast
Script path
scripts/smoke.py— builds a small model, encodes a synthetic batch, runs one training step, and exercises the weight-sampling utility.
Quick decision guide
- Need the canonical VOC / COCO recipe? Start with
ssd_300. - Need a faster smoke path or a custom backbone template? Start with
build_model. - Need to change the class count on pretrained weights? Stay in this route and use
sample_tensorsbefore loading the new head.
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).