Add comprehensive knowledge base documentation across multiple domains
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# MODELING DOMAIN KNOWLEDGE BASE
|
||||
|
||||
## OVERVIEW
|
||||
`opengait/modeling/` defines model contracts and algorithm implementations: `BaseModel`, loss aggregation, backbones, concrete model classes.
|
||||
|
||||
## STRUCTURE
|
||||
```text
|
||||
opengait/modeling/
|
||||
├── base_model.py # canonical train/test lifecycle
|
||||
├── loss_aggregator.py # training_feat -> weighted summed loss
|
||||
├── modules.py # shared NN building blocks
|
||||
├── backbones/ # backbone registry + implementations
|
||||
├── losses/ # loss registry + implementations
|
||||
└── models/ # concrete methods (Baseline, ScoNet, DeepGaitV2, ...)
|
||||
```
|
||||
|
||||
## WHERE TO LOOK
|
||||
| Task | Location | Notes |
|
||||
|------|----------|-------|
|
||||
| Add new model | `models/*.py` + `docs/4.how_to_create_your_model.md` | must inherit `BaseModel` |
|
||||
| Add new loss | `losses/*.py` | expose via dynamic registry |
|
||||
| Change training lifecycle | `base_model.py` | affects every model |
|
||||
| Debug feature/loss key mismatches | `loss_aggregator.py` | checks `training_feat` keys vs `loss_cfg.log_prefix` |
|
||||
|
||||
## CONVENTIONS
|
||||
- `forward()` output contract is fixed dict with keys: `training_feat`, `visual_summary`, `inference_feat`.
|
||||
- `training_feat` subkeys must align with configured `loss_cfg[*].log_prefix`.
|
||||
- Backbones/losses/models are discovered dynamically via package `__init__.py`; filenames matter operationally.
|
||||
|
||||
## ANTI-PATTERNS
|
||||
- Do not return arbitrary forward outputs; `LossAggregator` and evaluator assume fixed contract.
|
||||
- Do not put model classes outside `models/`; config lookup by `getattr(models, name)` depends on registry.
|
||||
- Do not ignore DDP loss wrapping (`get_ddp_module`) in loss construction.
|
||||
@@ -0,0 +1,23 @@
|
||||
# MODEL ZOO IMPLEMENTATION KNOWLEDGE BASE
|
||||
|
||||
## OVERVIEW
|
||||
This directory is the algorithm zoo. Each file usually contributes one `BaseModel` subclass selected by `model_cfg.model`.
|
||||
|
||||
## WHERE TO LOOK
|
||||
| Task | Location | Notes |
|
||||
|------|----------|-------|
|
||||
| Baseline pattern | `baseline.py` | minimal template for silhouette models |
|
||||
| Scoliosis pipeline | `sconet.py` | label remapping + screening-specific head |
|
||||
| Large-model fusion | `BiggerGait_DINOv2.py`, `BigGait.py` | external pretrained dependencies |
|
||||
| Diffusion/noise handling | `denoisinggait.py`, `diffgait_utils/` | high-complexity flow/feature fusion |
|
||||
| Skeleton variants | `skeletongait++.py`, `gaitgraph1.py`, `gaitgraph2.py` | pose-map/graph assumptions |
|
||||
|
||||
## CONVENTIONS
|
||||
- Most models follow: preprocess input -> backbone -> temporal pooling -> horizontal pooling -> neck/head -> contract dict.
|
||||
- Input modality assumptions differ by model (silhouette / RGB / pose / multimodal); config and preprocess script must match.
|
||||
- Many models rely on utilities from `modeling/modules.py`; shared changes there are high blast-radius.
|
||||
|
||||
## ANTI-PATTERNS
|
||||
- Don’t mix modality assumptions silently (e.g., pose tensor layout vs silhouette layout).
|
||||
- Don’t rename classes without updating `model_cfg.model` references in configs.
|
||||
- Don’t treat `BigGait_utils`/`diffgait_utils` as generic utilities; they are model-family specific.
|
||||
Reference in New Issue
Block a user