Add files using upload-large-folder tool
Browse files- gmnet/FILES.sha256 +0 -0
- gmnet/MANIFEST.csv +0 -0
- gmnet/MANIFEST.json +0 -0
- gmnet/README.md +22 -0
- gmnet/deploy/README.md +75 -0
- gmnet/deploy/task_matrix.yaml +800 -0
- gmnet/legacy_assets/acc_latency3.pdf +0 -0
- gmnet/legacy_assets/extract_freq.py +76 -0
- gmnet/legacy_assets/heat_map.py +62 -0
- gmnet/legacy_assets/plot.py +162 -0
- gmnet/project/gmnet_tpami/E4_MECHANISM_UNIFIED_CONCLUSIONS.md +259 -0
- gmnet/project/gmnet_tpami/E4_SOURCE_EQUIVALENCE_AUDIT.md +227 -0
- gmnet/project/gmnet_tpami/GMNET_TPAMI_JOURNAL_EXTENSION_PLAN.md +1202 -0
- gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_AUDIT_PROTOCOL.md +513 -0
- gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_DIAGNOSTIC_20260720.md +267 -0
- gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_IMPLEMENTATION_CHECKLIST.md +150 -0
- gmnet/project/gmnet_tpami/IMAGENET_V2_PREGATE_CONCLUSIONS.md +21 -0
- gmnet/project/gmnet_tpami/IMAGENET_V2_REVISED_PROTOCOL.md +177 -0
- gmnet/project/gmnet_tpami/LOCAL_EXPERIMENT_CONCLUSIONS.md +321 -0
- gmnet/project/gmnet_tpami/README.md +50 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/README.md +81 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/benchmark_onnx.py +273 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/export_coreml.py +43 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/gment.py +176 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/requirements.txt +9 -0
- gmnet/project/gmnet_tpami/reference/GmNet-code/train_imagenet.py +1286 -0
- gmnet/project/gmnet_tpami/reference/source/00README.json +25 -0
- gmnet/project/gmnet_tpami/reference/source/fancyhdr.sty +485 -0
- gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.bib +24 -0
- gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.bst +1440 -0
- gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.sty +246 -0
- gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.tex +86 -0
- gmnet/project/gmnet_tpami/reference/source/imgs/acc_latency3.pdf +0 -0
- gmnet/project/gmnet_tpami/reference/source/imgs/variants.pdf +0 -0
- gmnet/project/gmnet_tpami/reference/source/main.bib +454 -0
- gmnet/project/gmnet_tpami/reference/source/math_commands.tex +508 -0
- gmnet/project/gmnet_tpami/reference/source/natbib.sty +1246 -0
- gmnet/project/gmnet_tpami/reference/source/sec/0_abstract.tex +21 -0
- gmnet/project/gmnet_tpami/reference/source/sec/1_intro.tex +126 -0
- gmnet/project/gmnet_tpami/reference/source/sec/3_method.tex +83 -0
- gmnet/project/gmnet_tpami/reference/source/sec/6_statements.tex +8 -0
- gmnet/project/gmnet_tpami/reference/source/sec/X_suppl.tex +583 -0
- gmnet/project/gmnet_tpami/reference/source/sec/author.tex +33 -0
- gmnet/project/gmnet_tpami/scripts/run_e4_imagenet_spectral_audit.py +0 -0
- gmnet/project/gmnet_tpami/scripts/summarize_e4_mechanism.py +645 -0
- gmnet/project/gmnet_tpami/scripts/summarize_tpami_seed0_confirmatory.py +528 -0
- gmnet/project/gmnet_tpami/scripts/upload_gmnet_backup.py +367 -0
- gmnet/project/gmnet_tpami/tests/test_e4_imagenet_spectral_audit.py +430 -0
- gmnet/spectral_audit/README.md +152 -0
- gmnet/spectral_audit/input_manifest.json +229 -0
gmnet/FILES.sha256
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gmnet/MANIFEST.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gmnet/MANIFEST.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gmnet/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet journal backup
|
| 2 |
+
|
| 3 |
+
This directory is a curated backup of the GmNet TPAMI extension as of
|
| 4 |
+
2026-07-21 UTC. It contains:
|
| 5 |
+
|
| 6 |
+
- journal plans, protocols, analysis scripts, and the paper source/reference;
|
| 7 |
+
- frozen training/evaluation code and the confirmatory code snapshot;
|
| 8 |
+
- all prepared deployment YAML and shell launch files;
|
| 9 |
+
- all local experiment conclusions and machine-readable summaries;
|
| 10 |
+
- all 21 completed ImageNet run checkpoints, configs, logs, and certified
|
| 11 |
+
fixed-last official evaluations;
|
| 12 |
+
- the latest matched five-arm spectral audit snapshot and its implementation;
|
| 13 |
+
- selected legacy analysis assets.
|
| 14 |
+
|
| 15 |
+
The payload contains 1,438 source files totaling
|
| 16 |
+
2,665,249,145 bytes before repository-side
|
| 17 |
+
storage. `MANIFEST.csv`, `MANIFEST.json`, and `FILES.sha256` record every source
|
| 18 |
+
path, size, and SHA256 digest.
|
| 19 |
+
|
| 20 |
+
Excluded content consists of datasets, W&B raw cache, transient caches/locks,
|
| 21 |
+
the opaque legacy archive, and three redundant spectral partial snapshots.
|
| 22 |
+
No Hugging Face token is stored in this directory.
|
gmnet/deploy/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet ImageNet-v2 Long-Run Configurations
|
| 2 |
+
|
| 3 |
+
This directory keeps the requested `depoly` spelling. The active matrix is the
|
| 4 |
+
staged ImageNet-v2 protocol in
|
| 5 |
+
`journal_exp/configs/imagenet_v2_protocol.yaml`; generation never invokes
|
| 6 |
+
`launchjob`.
|
| 7 |
+
|
| 8 |
+
The post-hoc, single-seed mechanism follow-up requested after the legacy jobs
|
| 9 |
+
completed is isolated in `single_seed_followup_20260715/`. Its task names,
|
| 10 |
+
outputs, approvals, and protocol are separate from the formal ImageNet-v2
|
| 11 |
+
matrix; see that directory's README before submitting any YAML.
|
| 12 |
+
|
| 13 |
+
## Current Protocol State
|
| 14 |
+
|
| 15 |
+
Exactly 21 YAMLs are prepared below `imagenet_v2/`:
|
| 16 |
+
|
| 17 |
+
| Role | Runs | Initial status |
|
| 18 |
+
|---|---:|---|
|
| 19 |
+
| S3 confirmatory: ReLU6/ReLU/corrected learned-smooth/ReLU6-only/no-gate, 3 seeds each | 15 | 1 ready, 14 held |
|
| 20 |
+
| S3 fixed-smooth-c6 diagnostic, seed 0 | 1 | held |
|
| 21 |
+
| Release-hyperparameter recipe audits with paper BN and historical full BN | 2 | conditional |
|
| 22 |
+
| S1/S2/S4 ReLU6 scale context, seed 0 | 3 | held |
|
| 23 |
+
| **Total** | **21** | **1 ready, 18 held, 2 conditional** |
|
| 24 |
+
|
| 25 |
+
Only `imv2_e0_s3_relu6_seed0` has `submission_allowed: true`. Every other YAML
|
| 26 |
+
is intentionally prepared but locked. A YAML file existing is not permission
|
| 27 |
+
to submit it; `task_matrix.yaml` is authoritative for current status,
|
| 28 |
+
dependencies, role, and phase.
|
| 29 |
+
|
| 30 |
+
All run names contain `imv2` and outputs are isolated below
|
| 31 |
+
`/nfs/ywang29/GmNet/runs/imagenet_v2`. Jobs read ImageNet-1K from
|
| 32 |
+
`/s3-code/ywang29/datasets/imagenet-1k`, whose canonical source is
|
| 33 |
+
`s3://snap-research-cv-code/ywang29/datasets/imagenet-1k/`.
|
| 34 |
+
|
| 35 |
+
Every generated command supplies
|
| 36 |
+
`CODE_MANIFEST_PATH=configs/imagenet_v2_code_manifest.json`. The launcher
|
| 37 |
+
refuses code/config drift before training and before official evaluation.
|
| 38 |
+
`imagenet_v2/data_manifest_canonical.json` freezes exact sample counts, the
|
| 39 |
+
full relative-path/target index, and one deterministic raw-file content sample
|
| 40 |
+
per class.
|
| 41 |
+
|
| 42 |
+
## Staged Unlock
|
| 43 |
+
|
| 44 |
+
1. Submit only the phase-0 ReLU6 S3 seed-0 anchor after manual review.
|
| 45 |
+
2. Validate its fixed-epoch metrics, logs, checkpoint, and recipe before
|
| 46 |
+
unlocking phase-1 seed-0 gate comparisons.
|
| 47 |
+
3. Unlock each gate's seeds 1 and 2 only after that gate's seed-0 run is valid.
|
| 48 |
+
4. Run fixed-c6 and S1/S2/S4 only as diagnostics after their dependencies pass.
|
| 49 |
+
5. Keep recipe audits conditional. The paper-BN audit requires a documented
|
| 50 |
+
anchor discrepancy; historical full-BN additionally requires an unresolved
|
| 51 |
+
topology discrepancy. These are approximate recipe-bundle diagnostics using
|
| 52 |
+
this repository's runner, not release-exact timm reproductions.
|
| 53 |
+
|
| 54 |
+
Held and conditional YAMLs have a default-deny shell guard in both setup and
|
| 55 |
+
training commands. They require the exact task-specific
|
| 56 |
+
`GMNET_PROTOCOL_UNLOCK_TASK` value after documented prerequisite review.
|
| 57 |
+
|
| 58 |
+
The primary confirmatory result is the three-seed fixed-epoch comparison. Do
|
| 59 |
+
not select checkpoints or gates by the ImageNet validation maximum.
|
| 60 |
+
|
| 61 |
+
## Generate And Validate
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
cd /nfs/ywang29/GmNet/journal_exp
|
| 65 |
+
python scripts/generate_deploy.py
|
| 66 |
+
python scripts/generate_deploy.py --check
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Generation copies resources, image, mounts, ownership, and cost fields from
|
| 70 |
+
`/nfs/ywang29/LongLive/deploy/jul11_vgp/j11_vgp01_base.yaml`. It also removes
|
| 71 |
+
unexpected stale YAMLs only when they carry the generator header; hand-written
|
| 72 |
+
YAMLs are never deleted. `--check` reports both missing/drifted expected files
|
| 73 |
+
and stale generated files without changing the filesystem.
|
| 74 |
+
|
| 75 |
+
No launchjob has been submitted by this preparation step.
|
gmnet/deploy/task_matrix.yaml
ADDED
|
@@ -0,0 +1,800 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by journal_exp/scripts/generate_deploy.py; do not edit.
|
| 2 |
+
schema_version: 2
|
| 3 |
+
protocol_id: imagenet-v2-confirmatory-20260714-local-cache
|
| 4 |
+
protocol_source: /nfs/ywang29/GmNet/journal_exp/configs/imagenet_v2_protocol.yaml
|
| 5 |
+
generated_by: /nfs/ywang29/GmNet/journal_exp/scripts/generate_deploy.py
|
| 6 |
+
source_template: /nfs/ywang29/LongLive/deploy/jul11_vgp/j11_vgp01_base.yaml
|
| 7 |
+
policy:
|
| 8 |
+
one_yaml_per_task: true
|
| 9 |
+
launchjob_submitted_by_generator: false
|
| 10 |
+
initial_submission_limit: 1
|
| 11 |
+
primary_checkpoint: checkpoint_last.pt
|
| 12 |
+
primary_metric: fixed_epoch_val_top1
|
| 13 |
+
familywise_claim_scope: confirmatory_gate_comparison
|
| 14 |
+
unlock_requires_manual_protocol_review: true
|
| 15 |
+
unlock_environment_variable: GMNET_PROTOCOL_UNLOCK_TASK
|
| 16 |
+
technical_validity:
|
| 17 |
+
definition: A run is technically valid only when it exits successfully, verifies the frozen code/config and canonical data manifests, reaches its configured final epoch, writes checkpoint_last.pt with matching seed/config/data/RNG identities, passes non-finite and topology checks, and writes a successful strict official-evaluation checks.json certificate.
|
| 18 |
+
required_artifacts:
|
| 19 |
+
- train.log
|
| 20 |
+
- config_resolved.yaml
|
| 21 |
+
- data_manifest.json
|
| 22 |
+
- metrics.jsonl
|
| 23 |
+
- checkpoint_last.pt
|
| 24 |
+
- official_eval/results.json
|
| 25 |
+
- official_eval/checks.json
|
| 26 |
+
resume_scope: every rank restores Python, NumPy, torch CPU/CUDA and DataLoader generator streams at complete-epoch boundaries; persistent workers are disabled; nondeterministic CUDA kernels mean this is RNG-exact, not a claim of bitwise-identical floating-point replay
|
| 27 |
+
performance_is_never_a_validity_criterion: true
|
| 28 |
+
seed0_replication_unlock: valid means only protocol adherence, completeness, and finite artifacts; seed-0 accuracy must not be used to select which predeclared seeds 1/2 run
|
| 29 |
+
external_prerequisites:
|
| 30 |
+
smooth_local_pregate:
|
| 31 |
+
decision_rule: smooth_local_pregate
|
| 32 |
+
required_state: passed
|
| 33 |
+
state: passed
|
| 34 |
+
evidence_required: true
|
| 35 |
+
evidence: /nfs/ywang29/GmNet/local_results/imagenet_v2_pregate/CONCLUSIONS.md
|
| 36 |
+
review_result: 'PASS: 7/7 runs complete and finite; learned cap minimum 1.6864 exceeds the predefined severe-collapse boundary 0.6; fixed-c6 remains 6.0'
|
| 37 |
+
description: Manual review of the completed matched CIFAR-100 zero-WD controller pre-gate has passed; the ImageNet learned-smooth seed-0 task remains held behind its internal anchor prerequisite
|
| 38 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 39 |
+
data_staging:
|
| 40 |
+
mode: full_archive_to_local_scratch
|
| 41 |
+
source_archive_uri: s3://snap-research-cv-code/ywang29/datasets/imagenet-1k/imagenet-1k.tar
|
| 42 |
+
destination_root: /tmp/gmnet_data/imagenet-1k
|
| 43 |
+
cache_root: /tmp/gmnet_cache
|
| 44 |
+
keep_archive: false
|
| 45 |
+
expected_archive_bytes: 161381969920
|
| 46 |
+
minimum_free_bytes: 350000000000
|
| 47 |
+
canonical_data_uri: s3://snap-research-cv-code/ywang29/datasets/imagenet-1k/
|
| 48 |
+
canonical_data_manifest:
|
| 49 |
+
path: /nfs/ywang29/GmNet/depoly/imagenet_v2/data_manifest_canonical.json
|
| 50 |
+
manifest_sha256: bb70bc9f530db6bb24f70e648624b35281bfbc76a57775d589a2e0209dd98661
|
| 51 |
+
sample_index_sha256:
|
| 52 |
+
train: e74104e28ef79fff114e729e81d050a7b4f0c294c4d82345bad13c320d7255b2
|
| 53 |
+
val: 5ed16b5cd3ebd64e90cd7a8380b4e19d4c0d82eedcca3489dfa29313ce88d6f6
|
| 54 |
+
sampled_content_sha256:
|
| 55 |
+
train: dea27b5dbcb5f110ed47c075d473ebd0f6aefc446b45ab1e62d8246f2a153798
|
| 56 |
+
val: d80a57419bc9396df7c01e29a2b17698c02c3a9a68dc4006a1fe87ef129ed166
|
| 57 |
+
run_root: /nfs/ywang29/GmNet/runs/imagenet_v2
|
| 58 |
+
code_manifest: /nfs/ywang29/GmNet/journal_exp/configs/imagenet_v2_code_manifest.json
|
| 59 |
+
summary:
|
| 60 |
+
launch_yaml_count: 21
|
| 61 |
+
submission_allowed_count: 1
|
| 62 |
+
by_status:
|
| 63 |
+
conditional: 2
|
| 64 |
+
held: 18
|
| 65 |
+
ready: 1
|
| 66 |
+
by_phase:
|
| 67 |
+
phase_0_anchor: 1
|
| 68 |
+
phase_1_gate_screen: 4
|
| 69 |
+
phase_2_replication: 10
|
| 70 |
+
phase_3_diagnostics: 4
|
| 71 |
+
phase_4_recipe_audit: 2
|
| 72 |
+
by_role:
|
| 73 |
+
conditional_recipe_audit: 2
|
| 74 |
+
confirmatory_anchor: 1
|
| 75 |
+
confirmatory_replication: 10
|
| 76 |
+
confirmatory_screen: 4
|
| 77 |
+
fixed_smooth_control: 1
|
| 78 |
+
scaling_context: 3
|
| 79 |
+
by_experiment:
|
| 80 |
+
E0: 5
|
| 81 |
+
E3: 13
|
| 82 |
+
E5: 3
|
| 83 |
+
decision_rules:
|
| 84 |
+
- id: anchor_technical_qc
|
| 85 |
+
inputs:
|
| 86 |
+
- imv2_e0_s3_relu6_seed0
|
| 87 |
+
pass_when: epoch-300 last checkpoint, paper-default 7,791,544-parameter topology, finite audit, exact 1,281,167/50,000 data counts, matching fingerprints, and strict official-evaluation check-only pass
|
| 88 |
+
- id: anchor_accuracy_sanity
|
| 89 |
+
inputs:
|
| 90 |
+
- imv2_e0_s3_relu6_seed0
|
| 91 |
+
target_source: conference main table and ablation value; the conflicting 81.3 introduction value is not used
|
| 92 |
+
target_top1: 79.3
|
| 93 |
+
operational_window:
|
| 94 |
+
- 78.8
|
| 95 |
+
- 79.8
|
| 96 |
+
interpretation: resource-protection QC for a single seed, not a statistical reproduction claim; a miss opens the conditional recipe audits after technical QC
|
| 97 |
+
- id: baseline_reproduction
|
| 98 |
+
inputs:
|
| 99 |
+
- imv2_e0_s3_relu6_seed0
|
| 100 |
+
- imv2_e0_s3_relu6_seed1
|
| 101 |
+
- imv2_e0_s3_relu6_seed2
|
| 102 |
+
target_source: conference main table and ablation value
|
| 103 |
+
target_top1: 79.3
|
| 104 |
+
tolerance_pp: 0.2
|
| 105 |
+
report: report all seeds, mean, sample standard deviation, and a two-sided 95% confidence interval; label within/missed tolerance rather than testing equality to a published point estimate with unknown uncertainty
|
| 106 |
+
- id: smooth_local_pregate
|
| 107 |
+
inputs:
|
| 108 |
+
- e3_c100_s1_relu6_seed0
|
| 109 |
+
- e3_c100_s1_relu6_seed1
|
| 110 |
+
- e3_c100_s1_relu6_seed2
|
| 111 |
+
- e3_cifar100_pregate_v2_smooth_corrected_seed0
|
| 112 |
+
- e3_cifar100_pregate_v2_smooth_corrected_seed1
|
| 113 |
+
- e3_cifar100_pregate_v2_smooth_corrected_seed2
|
| 114 |
+
- e3_cifar100_pregate_v2_smooth_fixed_c6_seed0
|
| 115 |
+
pass_when: all corrected zero-WD runs are technically complete and finite, learned caps remain above the predefined severe-collapse boundary, and the matched three-seed result is reviewed; accuracy is reported with paired uncertainty and is not a single-seed launch-selection threshold
|
| 116 |
+
- id: confirmatory_analysis
|
| 117 |
+
inputs:
|
| 118 |
+
- imv2_e0_s3_relu6_seed0
|
| 119 |
+
- imv2_e0_s3_relu6_seed1
|
| 120 |
+
- imv2_e0_s3_relu6_seed2
|
| 121 |
+
- imv2_e3_s3_relu_seed0
|
| 122 |
+
- imv2_e3_s3_relu_seed1
|
| 123 |
+
- imv2_e3_s3_relu_seed2
|
| 124 |
+
- imv2_e3_s3_smooth_corrected_seed0
|
| 125 |
+
- imv2_e3_s3_smooth_corrected_seed1
|
| 126 |
+
- imv2_e3_s3_smooth_corrected_seed2
|
| 127 |
+
- imv2_e3_s3_relu6_only_seed0
|
| 128 |
+
- imv2_e3_s3_relu6_only_seed1
|
| 129 |
+
- imv2_e3_s3_relu6_only_seed2
|
| 130 |
+
- imv2_e3_s3_no_gate_seed0
|
| 131 |
+
- imv2_e3_s3_no_gate_seed1
|
| 132 |
+
- imv2_e3_s3_no_gate_seed2
|
| 133 |
+
report: use the primary_analysis hierarchical gatekeeping and secondary_analysis families below
|
| 134 |
+
primary_analysis:
|
| 135 |
+
endpoint: fixed epoch-300 ImageNet validation Top-1 in percentage points
|
| 136 |
+
effect_definition: candidate minus ReLU6 for matched seed and validation image
|
| 137 |
+
alpha: 0.05
|
| 138 |
+
familywise_error_control: fixed_entry_gate_then_parallel_holm
|
| 139 |
+
entry_gate_failure: all downstream hypotheses become exploratory
|
| 140 |
+
seed_pairing: pair identical seed IDs and retain per-seed effects
|
| 141 |
+
confirmatory_inference: paired seed-level t tests with training seed as the statistical unit; always report the three per-seed effects and their sample standard deviation
|
| 142 |
+
sample_sensitivity: a 2,000-replicate hierarchical paired bootstrap resamples training seeds as the outer unit and paired validation images within seed; it is supplemental and does not replace the seed-level confirmatory inference
|
| 143 |
+
margin_rationale: 'thresholds were fixed before ImageNet results: 1.0 pp denotes a material necessity effect, 0.3 pp a negligible gate-shape difference, and 0.2 pp the maximum allowed learned-smooth degradation; they are protocol decision thresholds rather than universal practical-significance constants'
|
| 144 |
+
fixed_entry_gate:
|
| 145 |
+
id: h1_no_gate_material_loss
|
| 146 |
+
candidate_gate: no_gate
|
| 147 |
+
contrast: no-gate minus ReLU6 self-gate
|
| 148 |
+
test: one-sided minimum-effect superiority at alpha 0.05
|
| 149 |
+
success: one-sided test rejects at alpha 0.05 and the two-sided 95% paired-seed confidence interval upper endpoint is below -1.0 pp
|
| 150 |
+
margin_pp: -1.0
|
| 151 |
+
claim_boundary: necessity of the complete gated operator, not multiplication alone
|
| 152 |
+
downstream_holm_family:
|
| 153 |
+
correction: Holm across three valid p-values at family alpha 0.05
|
| 154 |
+
hypotheses:
|
| 155 |
+
- id: h2_relu6_only_noninferiority
|
| 156 |
+
candidate_gate: relu6_only
|
| 157 |
+
contrast: ReLU6-only minus ReLU6 self-gate
|
| 158 |
+
test: one-sided non-inferiority at alpha 0.05
|
| 159 |
+
success: Holm-adjusted p-value is below 0.05 and the two-sided 95% paired-seed confidence interval lower endpoint is above -0.3 pp
|
| 160 |
+
margin_pp: -0.3
|
| 161 |
+
claim_boundary: architecture-level operator replacement total effect
|
| 162 |
+
- id: h3_relu_equivalence
|
| 163 |
+
candidate_gate: relu_self
|
| 164 |
+
contrast: ReLU self-gate minus ReLU6 self-gate
|
| 165 |
+
test: two one-sided tests at alpha 0.05
|
| 166 |
+
success: Holm-adjusted equivalence p-value is below 0.05 and the conservative two-sided 95% paired-seed confidence interval is contained in [-0.3, 0.3] pp
|
| 167 |
+
margins_pp:
|
| 168 |
+
- -0.3
|
| 169 |
+
- 0.3
|
| 170 |
+
- id: h4_smooth_noninferiority
|
| 171 |
+
candidate_gate: smooth_clipped_self
|
| 172 |
+
contrast: corrected learned-smooth minus ReLU6 self-gate
|
| 173 |
+
test: one-sided non-inferiority at alpha 0.05
|
| 174 |
+
success: Holm-adjusted p-value is below 0.05 and the two-sided 95% paired-seed confidence interval lower endpoint is above -0.2 pp
|
| 175 |
+
margin_pp: -0.2
|
| 176 |
+
secondary_analysis:
|
| 177 |
+
checkpoint_policy: fixed final checkpoint only; no best-seed or best-epoch selection
|
| 178 |
+
tested_families:
|
| 179 |
+
- id: classification_quality
|
| 180 |
+
endpoints:
|
| 181 |
+
- Top-5
|
| 182 |
+
- NLL
|
| 183 |
+
- ECE
|
| 184 |
+
contrasts:
|
| 185 |
+
- ReLU
|
| 186 |
+
- corrected learned-smooth
|
| 187 |
+
- ReLU6-only
|
| 188 |
+
- no-gate
|
| 189 |
+
correction: Holm within the 12 unique endpoint-by-contrast hypotheses at alpha 0.05
|
| 190 |
+
aliases_count_once: true
|
| 191 |
+
descriptive_families:
|
| 192 |
+
- id: learned_clip
|
| 193 |
+
endpoints:
|
| 194 |
+
- clip value by block and stage
|
| 195 |
+
- clip-crossing fraction
|
| 196 |
+
inference: descriptive only; applicable only to learned-smooth
|
| 197 |
+
- id: scaling_context
|
| 198 |
+
endpoints:
|
| 199 |
+
- Top-1
|
| 200 |
+
- parameters
|
| 201 |
+
- FLOPs
|
| 202 |
+
inference: single-seed descriptive context only; no scale trend or gate scaling claim
|
| 203 |
+
deferred_families:
|
| 204 |
+
- id: corruption
|
| 205 |
+
reason: canonical datasets, severities, aggregation, and runner are not frozen in this 21-task protocol
|
| 206 |
+
future_unit_of_inference: corruption type, not individual images as mechanism replicates
|
| 207 |
+
- id: frequency
|
| 208 |
+
reason: ImageNet frequency endpoint and runner are not frozen in this 21-task protocol
|
| 209 |
+
interpretation: exploratory until a protocol amendment is registered
|
| 210 |
+
tasks:
|
| 211 |
+
- task_id: imv2_e0_s3_relu6_seed0
|
| 212 |
+
experiment: E0
|
| 213 |
+
model: s3
|
| 214 |
+
gate: relu6_self
|
| 215 |
+
seed: 0
|
| 216 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s3.yaml
|
| 217 |
+
deploy_group: imagenet_v2/confirmatory
|
| 218 |
+
phase: phase_0_anchor
|
| 219 |
+
role: confirmatory_anchor
|
| 220 |
+
depends_on: []
|
| 221 |
+
external_prerequisites: []
|
| 222 |
+
status: ready
|
| 223 |
+
submission_allowed: true
|
| 224 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e0_s3_relu6_seed0.yaml
|
| 225 |
+
job_name: gmnet-imv2-e0-s3-relu6-seed0
|
| 226 |
+
eta_class: '>12h'
|
| 227 |
+
runner: imagenet_classification
|
| 228 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 229 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e0_s3_relu6_seed0
|
| 230 |
+
resolved_config:
|
| 231 |
+
recipe_id: paper-supplementary-table8-v1
|
| 232 |
+
variant: s3
|
| 233 |
+
gate_type: relu6_self
|
| 234 |
+
smooth_clip_trainable: null
|
| 235 |
+
epochs: 300
|
| 236 |
+
final_epoch_only: true
|
| 237 |
+
raw_clip_zero_weight_decay: true
|
| 238 |
+
- task_id: imv2_e0_s3_relu6_seed1
|
| 239 |
+
experiment: E0
|
| 240 |
+
model: s3
|
| 241 |
+
gate: relu6_self
|
| 242 |
+
seed: 1
|
| 243 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s3.yaml
|
| 244 |
+
deploy_group: imagenet_v2/confirmatory
|
| 245 |
+
phase: phase_2_replication
|
| 246 |
+
role: confirmatory_replication
|
| 247 |
+
depends_on:
|
| 248 |
+
- imv2_e0_s3_relu6_seed0
|
| 249 |
+
external_prerequisites: []
|
| 250 |
+
status: held
|
| 251 |
+
submission_allowed: false
|
| 252 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e0_s3_relu6_seed1.yaml
|
| 253 |
+
job_name: gmnet-imv2-e0-s3-relu6-seed1
|
| 254 |
+
eta_class: '>12h'
|
| 255 |
+
runner: imagenet_classification
|
| 256 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 257 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e0_s3_relu6_seed1
|
| 258 |
+
resolved_config:
|
| 259 |
+
recipe_id: paper-supplementary-table8-v1
|
| 260 |
+
variant: s3
|
| 261 |
+
gate_type: relu6_self
|
| 262 |
+
smooth_clip_trainable: null
|
| 263 |
+
epochs: 300
|
| 264 |
+
final_epoch_only: true
|
| 265 |
+
raw_clip_zero_weight_decay: true
|
| 266 |
+
- task_id: imv2_e0_s3_relu6_seed2
|
| 267 |
+
experiment: E0
|
| 268 |
+
model: s3
|
| 269 |
+
gate: relu6_self
|
| 270 |
+
seed: 2
|
| 271 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s3.yaml
|
| 272 |
+
deploy_group: imagenet_v2/confirmatory
|
| 273 |
+
phase: phase_2_replication
|
| 274 |
+
role: confirmatory_replication
|
| 275 |
+
depends_on:
|
| 276 |
+
- imv2_e0_s3_relu6_seed0
|
| 277 |
+
external_prerequisites: []
|
| 278 |
+
status: held
|
| 279 |
+
submission_allowed: false
|
| 280 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e0_s3_relu6_seed2.yaml
|
| 281 |
+
job_name: gmnet-imv2-e0-s3-relu6-seed2
|
| 282 |
+
eta_class: '>12h'
|
| 283 |
+
runner: imagenet_classification
|
| 284 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 285 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e0_s3_relu6_seed2
|
| 286 |
+
resolved_config:
|
| 287 |
+
recipe_id: paper-supplementary-table8-v1
|
| 288 |
+
variant: s3
|
| 289 |
+
gate_type: relu6_self
|
| 290 |
+
smooth_clip_trainable: null
|
| 291 |
+
epochs: 300
|
| 292 |
+
final_epoch_only: true
|
| 293 |
+
raw_clip_zero_weight_decay: true
|
| 294 |
+
- task_id: imv2_e3_s3_relu_seed0
|
| 295 |
+
experiment: E3
|
| 296 |
+
model: s3
|
| 297 |
+
gate: relu_self
|
| 298 |
+
seed: 0
|
| 299 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu.yaml
|
| 300 |
+
deploy_group: imagenet_v2/confirmatory
|
| 301 |
+
phase: phase_1_gate_screen
|
| 302 |
+
role: confirmatory_screen
|
| 303 |
+
depends_on:
|
| 304 |
+
- imv2_e0_s3_relu6_seed0
|
| 305 |
+
external_prerequisites: []
|
| 306 |
+
status: held
|
| 307 |
+
submission_allowed: false
|
| 308 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu_seed0.yaml
|
| 309 |
+
job_name: gmnet-imv2-e3-s3-relu-seed0
|
| 310 |
+
eta_class: '>12h'
|
| 311 |
+
runner: imagenet_classification
|
| 312 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 313 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu_seed0
|
| 314 |
+
resolved_config:
|
| 315 |
+
recipe_id: paper-supplementary-table8-v1
|
| 316 |
+
variant: s3
|
| 317 |
+
gate_type: relu_self
|
| 318 |
+
smooth_clip_trainable: null
|
| 319 |
+
epochs: 300
|
| 320 |
+
final_epoch_only: true
|
| 321 |
+
raw_clip_zero_weight_decay: true
|
| 322 |
+
- task_id: imv2_e3_s3_relu_seed1
|
| 323 |
+
experiment: E3
|
| 324 |
+
model: s3
|
| 325 |
+
gate: relu_self
|
| 326 |
+
seed: 1
|
| 327 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu.yaml
|
| 328 |
+
deploy_group: imagenet_v2/confirmatory
|
| 329 |
+
phase: phase_2_replication
|
| 330 |
+
role: confirmatory_replication
|
| 331 |
+
depends_on:
|
| 332 |
+
- imv2_e3_s3_relu_seed0
|
| 333 |
+
external_prerequisites: []
|
| 334 |
+
status: held
|
| 335 |
+
submission_allowed: false
|
| 336 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu_seed1.yaml
|
| 337 |
+
job_name: gmnet-imv2-e3-s3-relu-seed1
|
| 338 |
+
eta_class: '>12h'
|
| 339 |
+
runner: imagenet_classification
|
| 340 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 341 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu_seed1
|
| 342 |
+
resolved_config:
|
| 343 |
+
recipe_id: paper-supplementary-table8-v1
|
| 344 |
+
variant: s3
|
| 345 |
+
gate_type: relu_self
|
| 346 |
+
smooth_clip_trainable: null
|
| 347 |
+
epochs: 300
|
| 348 |
+
final_epoch_only: true
|
| 349 |
+
raw_clip_zero_weight_decay: true
|
| 350 |
+
- task_id: imv2_e3_s3_relu_seed2
|
| 351 |
+
experiment: E3
|
| 352 |
+
model: s3
|
| 353 |
+
gate: relu_self
|
| 354 |
+
seed: 2
|
| 355 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu.yaml
|
| 356 |
+
deploy_group: imagenet_v2/confirmatory
|
| 357 |
+
phase: phase_2_replication
|
| 358 |
+
role: confirmatory_replication
|
| 359 |
+
depends_on:
|
| 360 |
+
- imv2_e3_s3_relu_seed0
|
| 361 |
+
external_prerequisites: []
|
| 362 |
+
status: held
|
| 363 |
+
submission_allowed: false
|
| 364 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu_seed2.yaml
|
| 365 |
+
job_name: gmnet-imv2-e3-s3-relu-seed2
|
| 366 |
+
eta_class: '>12h'
|
| 367 |
+
runner: imagenet_classification
|
| 368 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 369 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu_seed2
|
| 370 |
+
resolved_config:
|
| 371 |
+
recipe_id: paper-supplementary-table8-v1
|
| 372 |
+
variant: s3
|
| 373 |
+
gate_type: relu_self
|
| 374 |
+
smooth_clip_trainable: null
|
| 375 |
+
epochs: 300
|
| 376 |
+
final_epoch_only: true
|
| 377 |
+
raw_clip_zero_weight_decay: true
|
| 378 |
+
- task_id: imv2_e3_s3_smooth_corrected_seed0
|
| 379 |
+
experiment: E3
|
| 380 |
+
model: s3
|
| 381 |
+
gate: smooth_clipped_self
|
| 382 |
+
seed: 0
|
| 383 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_smooth_corrected.yaml
|
| 384 |
+
deploy_group: imagenet_v2/confirmatory
|
| 385 |
+
phase: phase_1_gate_screen
|
| 386 |
+
role: confirmatory_screen
|
| 387 |
+
depends_on:
|
| 388 |
+
- imv2_e0_s3_relu6_seed0
|
| 389 |
+
external_prerequisites:
|
| 390 |
+
- smooth_local_pregate
|
| 391 |
+
status: held
|
| 392 |
+
submission_allowed: false
|
| 393 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_smooth_corrected_seed0.yaml
|
| 394 |
+
job_name: gmnet-imv2-e3-s3-smooth-corrected-seed0
|
| 395 |
+
eta_class: '>12h'
|
| 396 |
+
runner: imagenet_classification
|
| 397 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 398 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_smooth_corrected_seed0
|
| 399 |
+
resolved_config:
|
| 400 |
+
recipe_id: paper-supplementary-table8-v1
|
| 401 |
+
variant: s3
|
| 402 |
+
gate_type: smooth_clipped_self
|
| 403 |
+
smooth_clip_trainable: true
|
| 404 |
+
epochs: 300
|
| 405 |
+
final_epoch_only: true
|
| 406 |
+
raw_clip_zero_weight_decay: true
|
| 407 |
+
- task_id: imv2_e3_s3_smooth_corrected_seed1
|
| 408 |
+
experiment: E3
|
| 409 |
+
model: s3
|
| 410 |
+
gate: smooth_clipped_self
|
| 411 |
+
seed: 1
|
| 412 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_smooth_corrected.yaml
|
| 413 |
+
deploy_group: imagenet_v2/confirmatory
|
| 414 |
+
phase: phase_2_replication
|
| 415 |
+
role: confirmatory_replication
|
| 416 |
+
depends_on:
|
| 417 |
+
- imv2_e3_s3_smooth_corrected_seed0
|
| 418 |
+
external_prerequisites: []
|
| 419 |
+
status: held
|
| 420 |
+
submission_allowed: false
|
| 421 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_smooth_corrected_seed1.yaml
|
| 422 |
+
job_name: gmnet-imv2-e3-s3-smooth-corrected-seed1
|
| 423 |
+
eta_class: '>12h'
|
| 424 |
+
runner: imagenet_classification
|
| 425 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 426 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_smooth_corrected_seed1
|
| 427 |
+
resolved_config:
|
| 428 |
+
recipe_id: paper-supplementary-table8-v1
|
| 429 |
+
variant: s3
|
| 430 |
+
gate_type: smooth_clipped_self
|
| 431 |
+
smooth_clip_trainable: true
|
| 432 |
+
epochs: 300
|
| 433 |
+
final_epoch_only: true
|
| 434 |
+
raw_clip_zero_weight_decay: true
|
| 435 |
+
- task_id: imv2_e3_s3_smooth_corrected_seed2
|
| 436 |
+
experiment: E3
|
| 437 |
+
model: s3
|
| 438 |
+
gate: smooth_clipped_self
|
| 439 |
+
seed: 2
|
| 440 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_smooth_corrected.yaml
|
| 441 |
+
deploy_group: imagenet_v2/confirmatory
|
| 442 |
+
phase: phase_2_replication
|
| 443 |
+
role: confirmatory_replication
|
| 444 |
+
depends_on:
|
| 445 |
+
- imv2_e3_s3_smooth_corrected_seed0
|
| 446 |
+
external_prerequisites: []
|
| 447 |
+
status: held
|
| 448 |
+
submission_allowed: false
|
| 449 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_smooth_corrected_seed2.yaml
|
| 450 |
+
job_name: gmnet-imv2-e3-s3-smooth-corrected-seed2
|
| 451 |
+
eta_class: '>12h'
|
| 452 |
+
runner: imagenet_classification
|
| 453 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 454 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_smooth_corrected_seed2
|
| 455 |
+
resolved_config:
|
| 456 |
+
recipe_id: paper-supplementary-table8-v1
|
| 457 |
+
variant: s3
|
| 458 |
+
gate_type: smooth_clipped_self
|
| 459 |
+
smooth_clip_trainable: true
|
| 460 |
+
epochs: 300
|
| 461 |
+
final_epoch_only: true
|
| 462 |
+
raw_clip_zero_weight_decay: true
|
| 463 |
+
- task_id: imv2_e3_s3_relu6_only_seed0
|
| 464 |
+
experiment: E3
|
| 465 |
+
model: s3
|
| 466 |
+
gate: relu6_only
|
| 467 |
+
seed: 0
|
| 468 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu6_only.yaml
|
| 469 |
+
deploy_group: imagenet_v2/confirmatory
|
| 470 |
+
phase: phase_1_gate_screen
|
| 471 |
+
role: confirmatory_screen
|
| 472 |
+
depends_on:
|
| 473 |
+
- imv2_e0_s3_relu6_seed0
|
| 474 |
+
external_prerequisites: []
|
| 475 |
+
status: held
|
| 476 |
+
submission_allowed: false
|
| 477 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu6_only_seed0.yaml
|
| 478 |
+
job_name: gmnet-imv2-e3-s3-relu6-only-seed0
|
| 479 |
+
eta_class: '>12h'
|
| 480 |
+
runner: imagenet_classification
|
| 481 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 482 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu6_only_seed0
|
| 483 |
+
resolved_config:
|
| 484 |
+
recipe_id: paper-supplementary-table8-v1
|
| 485 |
+
variant: s3
|
| 486 |
+
gate_type: relu6_only
|
| 487 |
+
smooth_clip_trainable: null
|
| 488 |
+
epochs: 300
|
| 489 |
+
final_epoch_only: true
|
| 490 |
+
raw_clip_zero_weight_decay: true
|
| 491 |
+
- task_id: imv2_e3_s3_relu6_only_seed1
|
| 492 |
+
experiment: E3
|
| 493 |
+
model: s3
|
| 494 |
+
gate: relu6_only
|
| 495 |
+
seed: 1
|
| 496 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu6_only.yaml
|
| 497 |
+
deploy_group: imagenet_v2/confirmatory
|
| 498 |
+
phase: phase_2_replication
|
| 499 |
+
role: confirmatory_replication
|
| 500 |
+
depends_on:
|
| 501 |
+
- imv2_e3_s3_relu6_only_seed0
|
| 502 |
+
external_prerequisites: []
|
| 503 |
+
status: held
|
| 504 |
+
submission_allowed: false
|
| 505 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu6_only_seed1.yaml
|
| 506 |
+
job_name: gmnet-imv2-e3-s3-relu6-only-seed1
|
| 507 |
+
eta_class: '>12h'
|
| 508 |
+
runner: imagenet_classification
|
| 509 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 510 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu6_only_seed1
|
| 511 |
+
resolved_config:
|
| 512 |
+
recipe_id: paper-supplementary-table8-v1
|
| 513 |
+
variant: s3
|
| 514 |
+
gate_type: relu6_only
|
| 515 |
+
smooth_clip_trainable: null
|
| 516 |
+
epochs: 300
|
| 517 |
+
final_epoch_only: true
|
| 518 |
+
raw_clip_zero_weight_decay: true
|
| 519 |
+
- task_id: imv2_e3_s3_relu6_only_seed2
|
| 520 |
+
experiment: E3
|
| 521 |
+
model: s3
|
| 522 |
+
gate: relu6_only
|
| 523 |
+
seed: 2
|
| 524 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_relu6_only.yaml
|
| 525 |
+
deploy_group: imagenet_v2/confirmatory
|
| 526 |
+
phase: phase_2_replication
|
| 527 |
+
role: confirmatory_replication
|
| 528 |
+
depends_on:
|
| 529 |
+
- imv2_e3_s3_relu6_only_seed0
|
| 530 |
+
external_prerequisites: []
|
| 531 |
+
status: held
|
| 532 |
+
submission_allowed: false
|
| 533 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_relu6_only_seed2.yaml
|
| 534 |
+
job_name: gmnet-imv2-e3-s3-relu6-only-seed2
|
| 535 |
+
eta_class: '>12h'
|
| 536 |
+
runner: imagenet_classification
|
| 537 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 538 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_relu6_only_seed2
|
| 539 |
+
resolved_config:
|
| 540 |
+
recipe_id: paper-supplementary-table8-v1
|
| 541 |
+
variant: s3
|
| 542 |
+
gate_type: relu6_only
|
| 543 |
+
smooth_clip_trainable: null
|
| 544 |
+
epochs: 300
|
| 545 |
+
final_epoch_only: true
|
| 546 |
+
raw_clip_zero_weight_decay: true
|
| 547 |
+
- task_id: imv2_e3_s3_no_gate_seed0
|
| 548 |
+
experiment: E3
|
| 549 |
+
model: s3
|
| 550 |
+
gate: no_gate
|
| 551 |
+
seed: 0
|
| 552 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_no_gate.yaml
|
| 553 |
+
deploy_group: imagenet_v2/confirmatory
|
| 554 |
+
phase: phase_1_gate_screen
|
| 555 |
+
role: confirmatory_screen
|
| 556 |
+
depends_on:
|
| 557 |
+
- imv2_e0_s3_relu6_seed0
|
| 558 |
+
external_prerequisites: []
|
| 559 |
+
status: held
|
| 560 |
+
submission_allowed: false
|
| 561 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_no_gate_seed0.yaml
|
| 562 |
+
job_name: gmnet-imv2-e3-s3-no-gate-seed0
|
| 563 |
+
eta_class: '>12h'
|
| 564 |
+
runner: imagenet_classification
|
| 565 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 566 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_no_gate_seed0
|
| 567 |
+
resolved_config:
|
| 568 |
+
recipe_id: paper-supplementary-table8-v1
|
| 569 |
+
variant: s3
|
| 570 |
+
gate_type: no_gate
|
| 571 |
+
smooth_clip_trainable: null
|
| 572 |
+
epochs: 300
|
| 573 |
+
final_epoch_only: true
|
| 574 |
+
raw_clip_zero_weight_decay: true
|
| 575 |
+
- task_id: imv2_e3_s3_no_gate_seed1
|
| 576 |
+
experiment: E3
|
| 577 |
+
model: s3
|
| 578 |
+
gate: no_gate
|
| 579 |
+
seed: 1
|
| 580 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_no_gate.yaml
|
| 581 |
+
deploy_group: imagenet_v2/confirmatory
|
| 582 |
+
phase: phase_2_replication
|
| 583 |
+
role: confirmatory_replication
|
| 584 |
+
depends_on:
|
| 585 |
+
- imv2_e3_s3_no_gate_seed0
|
| 586 |
+
external_prerequisites: []
|
| 587 |
+
status: held
|
| 588 |
+
submission_allowed: false
|
| 589 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_no_gate_seed1.yaml
|
| 590 |
+
job_name: gmnet-imv2-e3-s3-no-gate-seed1
|
| 591 |
+
eta_class: '>12h'
|
| 592 |
+
runner: imagenet_classification
|
| 593 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 594 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_no_gate_seed1
|
| 595 |
+
resolved_config:
|
| 596 |
+
recipe_id: paper-supplementary-table8-v1
|
| 597 |
+
variant: s3
|
| 598 |
+
gate_type: no_gate
|
| 599 |
+
smooth_clip_trainable: null
|
| 600 |
+
epochs: 300
|
| 601 |
+
final_epoch_only: true
|
| 602 |
+
raw_clip_zero_weight_decay: true
|
| 603 |
+
- task_id: imv2_e3_s3_no_gate_seed2
|
| 604 |
+
experiment: E3
|
| 605 |
+
model: s3
|
| 606 |
+
gate: no_gate
|
| 607 |
+
seed: 2
|
| 608 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_no_gate.yaml
|
| 609 |
+
deploy_group: imagenet_v2/confirmatory
|
| 610 |
+
phase: phase_2_replication
|
| 611 |
+
role: confirmatory_replication
|
| 612 |
+
depends_on:
|
| 613 |
+
- imv2_e3_s3_no_gate_seed0
|
| 614 |
+
external_prerequisites: []
|
| 615 |
+
status: held
|
| 616 |
+
submission_allowed: false
|
| 617 |
+
deploy_path: imagenet_v2/confirmatory/imv2_e3_s3_no_gate_seed2.yaml
|
| 618 |
+
job_name: gmnet-imv2-e3-s3-no-gate-seed2
|
| 619 |
+
eta_class: '>12h'
|
| 620 |
+
runner: imagenet_classification
|
| 621 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 622 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_no_gate_seed2
|
| 623 |
+
resolved_config:
|
| 624 |
+
recipe_id: paper-supplementary-table8-v1
|
| 625 |
+
variant: s3
|
| 626 |
+
gate_type: no_gate
|
| 627 |
+
smooth_clip_trainable: null
|
| 628 |
+
epochs: 300
|
| 629 |
+
final_epoch_only: true
|
| 630 |
+
raw_clip_zero_weight_decay: true
|
| 631 |
+
- task_id: imv2_e3_s3_smooth_fixed_c6_seed0
|
| 632 |
+
experiment: E3
|
| 633 |
+
model: s3
|
| 634 |
+
gate: smooth_clipped_self_fixed_c6
|
| 635 |
+
seed: 0
|
| 636 |
+
config_path: configs/e3_gate/imagenet_gmnet_s3_smooth_fixed_c6.yaml
|
| 637 |
+
deploy_group: imagenet_v2/diagnostics
|
| 638 |
+
phase: phase_3_diagnostics
|
| 639 |
+
role: fixed_smooth_control
|
| 640 |
+
depends_on:
|
| 641 |
+
- imv2_e3_s3_smooth_corrected_seed0
|
| 642 |
+
external_prerequisites: []
|
| 643 |
+
status: held
|
| 644 |
+
submission_allowed: false
|
| 645 |
+
deploy_path: imagenet_v2/diagnostics/imv2_e3_s3_smooth_fixed_c6_seed0.yaml
|
| 646 |
+
job_name: gmnet-imv2-e3-s3-smooth-fixed-c6-seed0
|
| 647 |
+
eta_class: '>12h'
|
| 648 |
+
runner: imagenet_classification
|
| 649 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 650 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e3_s3_smooth_fixed_c6_seed0
|
| 651 |
+
resolved_config:
|
| 652 |
+
recipe_id: paper-supplementary-table8-v1
|
| 653 |
+
variant: s3
|
| 654 |
+
gate_type: smooth_clipped_self
|
| 655 |
+
smooth_clip_trainable: false
|
| 656 |
+
epochs: 300
|
| 657 |
+
final_epoch_only: true
|
| 658 |
+
raw_clip_zero_weight_decay: true
|
| 659 |
+
- task_id: imv2_e0_s3_release_paperbn_seed0
|
| 660 |
+
experiment: E0
|
| 661 |
+
model: s3
|
| 662 |
+
gate: relu6_self
|
| 663 |
+
seed: 0
|
| 664 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s3_release_paper_bn.yaml
|
| 665 |
+
deploy_group: imagenet_v2/recipe_audits
|
| 666 |
+
phase: phase_4_recipe_audit
|
| 667 |
+
role: conditional_recipe_audit
|
| 668 |
+
depends_on:
|
| 669 |
+
- imv2_e0_s3_relu6_seed0
|
| 670 |
+
external_prerequisites: []
|
| 671 |
+
status: conditional
|
| 672 |
+
submission_allowed: false
|
| 673 |
+
condition: anchor_technical_qc passes but anchor_accuracy_sanity misses its explicit [78.8, 79.8] operational window; interpret this as an approximate recipe-bundle sensitivity audit, not a release-exact reproduction
|
| 674 |
+
deploy_path: imagenet_v2/recipe_audits/imv2_e0_s3_release_paperbn_seed0.yaml
|
| 675 |
+
job_name: gmnet-imv2-e0-s3-release-paperbn-seed0
|
| 676 |
+
eta_class: '>12h'
|
| 677 |
+
runner: imagenet_classification
|
| 678 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 679 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e0_s3_release_paperbn_seed0
|
| 680 |
+
resolved_config:
|
| 681 |
+
recipe_id: release-readme-legacy-audit-only
|
| 682 |
+
variant: s3
|
| 683 |
+
gate_type: relu6_self
|
| 684 |
+
smooth_clip_trainable: null
|
| 685 |
+
epochs: 310
|
| 686 |
+
final_epoch_only: true
|
| 687 |
+
raw_clip_zero_weight_decay: true
|
| 688 |
+
- task_id: imv2_e0_s3_release_fullbn_seed0
|
| 689 |
+
experiment: E0
|
| 690 |
+
model: s3
|
| 691 |
+
gate: relu6_self
|
| 692 |
+
seed: 0
|
| 693 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s3_release_historical_full_bn.yaml
|
| 694 |
+
deploy_group: imagenet_v2/recipe_audits
|
| 695 |
+
phase: phase_4_recipe_audit
|
| 696 |
+
role: conditional_recipe_audit
|
| 697 |
+
depends_on:
|
| 698 |
+
- imv2_e0_s3_release_paperbn_seed0
|
| 699 |
+
external_prerequisites: []
|
| 700 |
+
status: conditional
|
| 701 |
+
submission_allowed: false
|
| 702 |
+
condition: the release-paper-BN recipe-bundle audit remains outside the explicit reproduction tolerance after technical review; run this matched release-full-BN audit to test, not presume, a topology contribution
|
| 703 |
+
deploy_path: imagenet_v2/recipe_audits/imv2_e0_s3_release_fullbn_seed0.yaml
|
| 704 |
+
job_name: gmnet-imv2-e0-s3-release-fullbn-seed0
|
| 705 |
+
eta_class: '>12h'
|
| 706 |
+
runner: imagenet_classification
|
| 707 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 708 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e0_s3_release_fullbn_seed0
|
| 709 |
+
resolved_config:
|
| 710 |
+
recipe_id: release-readme-legacy-audit-only
|
| 711 |
+
variant: s3
|
| 712 |
+
gate_type: relu6_self
|
| 713 |
+
smooth_clip_trainable: null
|
| 714 |
+
epochs: 310
|
| 715 |
+
final_epoch_only: true
|
| 716 |
+
raw_clip_zero_weight_decay: true
|
| 717 |
+
- task_id: imv2_e5_s1_relu6_seed0
|
| 718 |
+
experiment: E5
|
| 719 |
+
model: s1
|
| 720 |
+
gate: relu6_self
|
| 721 |
+
seed: 0
|
| 722 |
+
config_path: configs/e5_scaling/imagenet_gmnet_s1.yaml
|
| 723 |
+
deploy_group: imagenet_v2/scaling
|
| 724 |
+
phase: phase_3_diagnostics
|
| 725 |
+
role: scaling_context
|
| 726 |
+
depends_on:
|
| 727 |
+
- imv2_e0_s3_relu6_seed0
|
| 728 |
+
external_prerequisites: []
|
| 729 |
+
status: held
|
| 730 |
+
submission_allowed: false
|
| 731 |
+
deploy_path: imagenet_v2/scaling/imv2_e5_s1_relu6_seed0.yaml
|
| 732 |
+
job_name: gmnet-imv2-e5-s1-relu6-seed0
|
| 733 |
+
eta_class: '>12h'
|
| 734 |
+
runner: imagenet_classification
|
| 735 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 736 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e5_s1_relu6_seed0
|
| 737 |
+
resolved_config:
|
| 738 |
+
recipe_id: paper-supplementary-table8-v1
|
| 739 |
+
variant: s1
|
| 740 |
+
gate_type: relu6_self
|
| 741 |
+
smooth_clip_trainable: null
|
| 742 |
+
epochs: 300
|
| 743 |
+
final_epoch_only: true
|
| 744 |
+
raw_clip_zero_weight_decay: true
|
| 745 |
+
- task_id: imv2_e5_s2_relu6_seed0
|
| 746 |
+
experiment: E5
|
| 747 |
+
model: s2
|
| 748 |
+
gate: relu6_self
|
| 749 |
+
seed: 0
|
| 750 |
+
config_path: configs/e0_baseline/imagenet_gmnet_s2.yaml
|
| 751 |
+
deploy_group: imagenet_v2/scaling
|
| 752 |
+
phase: phase_3_diagnostics
|
| 753 |
+
role: scaling_context
|
| 754 |
+
depends_on:
|
| 755 |
+
- imv2_e0_s3_relu6_seed0
|
| 756 |
+
external_prerequisites: []
|
| 757 |
+
status: held
|
| 758 |
+
submission_allowed: false
|
| 759 |
+
deploy_path: imagenet_v2/scaling/imv2_e5_s2_relu6_seed0.yaml
|
| 760 |
+
job_name: gmnet-imv2-e5-s2-relu6-seed0
|
| 761 |
+
eta_class: '>12h'
|
| 762 |
+
runner: imagenet_classification
|
| 763 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 764 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e5_s2_relu6_seed0
|
| 765 |
+
resolved_config:
|
| 766 |
+
recipe_id: paper-supplementary-table8-v1
|
| 767 |
+
variant: s2
|
| 768 |
+
gate_type: relu6_self
|
| 769 |
+
smooth_clip_trainable: null
|
| 770 |
+
epochs: 300
|
| 771 |
+
final_epoch_only: true
|
| 772 |
+
raw_clip_zero_weight_decay: true
|
| 773 |
+
- task_id: imv2_e5_s4_relu6_seed0
|
| 774 |
+
experiment: E5
|
| 775 |
+
model: s4
|
| 776 |
+
gate: relu6_self
|
| 777 |
+
seed: 0
|
| 778 |
+
config_path: configs/e5_scaling/imagenet_gmnet_s4.yaml
|
| 779 |
+
deploy_group: imagenet_v2/scaling
|
| 780 |
+
phase: phase_3_diagnostics
|
| 781 |
+
role: scaling_context
|
| 782 |
+
depends_on:
|
| 783 |
+
- imv2_e0_s3_relu6_seed0
|
| 784 |
+
external_prerequisites: []
|
| 785 |
+
status: held
|
| 786 |
+
submission_allowed: false
|
| 787 |
+
deploy_path: imagenet_v2/scaling/imv2_e5_s4_relu6_seed0.yaml
|
| 788 |
+
job_name: gmnet-imv2-e5-s4-relu6-seed0
|
| 789 |
+
eta_class: '>12h'
|
| 790 |
+
runner: imagenet_classification
|
| 791 |
+
data_root: /tmp/gmnet_data/imagenet-1k
|
| 792 |
+
output_dir: /nfs/ywang29/GmNet/runs/imagenet_v2/imv2_e5_s4_relu6_seed0
|
| 793 |
+
resolved_config:
|
| 794 |
+
recipe_id: paper-supplementary-table8-v1
|
| 795 |
+
variant: s4
|
| 796 |
+
gate_type: relu6_self
|
| 797 |
+
smooth_clip_trainable: null
|
| 798 |
+
epochs: 300
|
| 799 |
+
final_epoch_only: true
|
| 800 |
+
raw_clip_zero_weight_decay: true
|
gmnet/legacy_assets/acc_latency3.pdf
ADDED
|
Binary file (22.9 kB). View file
|
|
|
gmnet/legacy_assets/extract_freq.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
def extract_frequency_bands(image_path, frequency_bands):
|
| 5 |
+
"""
|
| 6 |
+
提取图像中不同频率区间的成分并保存。
|
| 7 |
+
|
| 8 |
+
参数:
|
| 9 |
+
image_path (str): 输入图像的路径。
|
| 10 |
+
frequency_bands (list of tuples): 每个元组代表一个频率带 (min_radius, max_radius)。
|
| 11 |
+
例如: [(0, 10), (10, 20), (20, 50)]
|
| 12 |
+
"""
|
| 13 |
+
# 读取图片
|
| 14 |
+
img = cv2.imread(image_path)
|
| 15 |
+
if img is None:
|
| 16 |
+
print(f"Error: Could not read image from {image_path}.")
|
| 17 |
+
return
|
| 18 |
+
|
| 19 |
+
# 将图片转换为浮点数类型以便进行计算
|
| 20 |
+
img_float = np.float32(img)
|
| 21 |
+
b, g, r = cv2.split(img_float)
|
| 22 |
+
|
| 23 |
+
# 对每个通道进行傅里叶变换
|
| 24 |
+
dft_b = cv2.dft(b, flags=cv2.DFT_COMPLEX_OUTPUT)
|
| 25 |
+
dft_g = cv2.dft(g, flags=cv2.DFT_COMPLEX_OUTPUT)
|
| 26 |
+
dft_r = cv2.dft(r, flags=cv2.DFT_COMPLEX_OUTPUT)
|
| 27 |
+
|
| 28 |
+
# 移动零频率分量到图像中心,便于处理
|
| 29 |
+
dft_shift_b = np.fft.fftshift(dft_b)
|
| 30 |
+
dft_shift_g = np.fft.fftshift(dft_g)
|
| 31 |
+
dft_shift_r = np.fft.fftshift(dft_r)
|
| 32 |
+
|
| 33 |
+
rows, cols = b.shape
|
| 34 |
+
center_row, center_col = rows // 2, cols // 2
|
| 35 |
+
|
| 36 |
+
# 创建并应用每个频率带的掩码
|
| 37 |
+
for i, (min_radius, max_radius) in enumerate(frequency_bands):
|
| 38 |
+
# 创建一个全零的掩码
|
| 39 |
+
mask = np.zeros((rows, cols, 2), np.uint8)
|
| 40 |
+
|
| 41 |
+
# 在掩码上绘制一个大圆
|
| 42 |
+
cv2.circle(mask, (center_col, center_row), max_radius, (255, 255, 255), -1)
|
| 43 |
+
|
| 44 |
+
# 在掩码上绘制一个内圈,以创建环形带通滤波器
|
| 45 |
+
if min_radius > 0:
|
| 46 |
+
cv2.circle(mask, (center_col, center_row), min_radius, (0, 0, 0), -1)
|
| 47 |
+
|
| 48 |
+
# 对每个通道应用掩码
|
| 49 |
+
band_dft_b = dft_shift_b * mask.astype(dft_shift_b.dtype)
|
| 50 |
+
band_dft_g = dft_shift_g * mask.astype(dft_shift_g.dtype)
|
| 51 |
+
band_dft_r = dft_shift_r * mask.astype(dft_shift_r.dtype)
|
| 52 |
+
|
| 53 |
+
# 逆傅里叶变换回图像空间
|
| 54 |
+
band_img_b = cv2.idft(np.fft.ifftshift(band_dft_b))
|
| 55 |
+
band_img_g = cv2.idft(np.fft.ifftshift(band_dft_g))
|
| 56 |
+
band_img_r = cv2.idft(np.fft.ifftshift(band_dft_r))
|
| 57 |
+
|
| 58 |
+
# 合并通道并归一化以保存
|
| 59 |
+
band_img = cv2.merge([band_img_b[:, :, 0], band_img_g[:, :, 0], band_img_r[:, :, 0]])
|
| 60 |
+
band_img = cv2.normalize(band_img, None, 0, 255, cv2.NORM_MINMAX)
|
| 61 |
+
band_img = np.uint8(band_img)
|
| 62 |
+
|
| 63 |
+
# 保存结果
|
| 64 |
+
output_filename = f'frequency_band_{min_radius}-{max_radius}.png'
|
| 65 |
+
cv2.imwrite(output_filename, band_img)
|
| 66 |
+
print(f"保存了 {min_radius}-{max_radius} 频率带的图片到 {output_filename}")
|
| 67 |
+
|
| 68 |
+
# 示例用法
|
| 69 |
+
if __name__ == '__main__':
|
| 70 |
+
# 替换为你的图片路径
|
| 71 |
+
input_image_path = 'ILSVRC2012_val_00023267.JPEG'
|
| 72 |
+
|
| 73 |
+
# 定义你感兴趣的频率带(以像素距离为单位)
|
| 74 |
+
bands = [(0, 15), (15, 30), (20, 50000)]
|
| 75 |
+
|
| 76 |
+
extract_frequency_bands(input_image_path, bands)
|
gmnet/legacy_assets/heat_map.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch, torch.nn.functional as F
|
| 2 |
+
from torchvision import models, transforms
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import numpy as np, cv2
|
| 5 |
+
|
| 6 |
+
# 1) 准备模型与目标层(以 ResNet50 为例)
|
| 7 |
+
model = models.resnet50(weights=models.ResNet50_Weights.IMAGENET1K_V2).eval()
|
| 8 |
+
target_layer_name = 'layer4' # 最后一个卷积block
|
| 9 |
+
|
| 10 |
+
# 2) 预处理
|
| 11 |
+
preprocess = transforms.Compose([
|
| 12 |
+
transforms.Resize(256), transforms.CenterCrop(224),
|
| 13 |
+
transforms.ToTensor(),
|
| 14 |
+
transforms.Normalize(mean=[0.485,0.456,0.406],
|
| 15 |
+
std=[0.229,0.224,0.225]),
|
| 16 |
+
])
|
| 17 |
+
|
| 18 |
+
def load_image(path):
|
| 19 |
+
img = Image.open(path).convert('RGB')
|
| 20 |
+
tens = preprocess(img).unsqueeze(0)
|
| 21 |
+
return img, tens
|
| 22 |
+
|
| 23 |
+
# 3) 注册hook抓取前向特征与反向梯度
|
| 24 |
+
feats = {}
|
| 25 |
+
grads = {}
|
| 26 |
+
|
| 27 |
+
def fwd_hook(module, input, output):
|
| 28 |
+
feats['value'] = output.detach()
|
| 29 |
+
|
| 30 |
+
def bwd_hook(module, grad_in, grad_out):
|
| 31 |
+
grads['value'] = grad_out[0].detach()
|
| 32 |
+
|
| 33 |
+
# 获取目标层模块对象
|
| 34 |
+
target_module = dict(model.named_modules())[target_layer_name]
|
| 35 |
+
handle_fwd = target_module.register_forward_hook(fwd_hook)
|
| 36 |
+
handle_bwd = target_module.register_full_backward_hook(bwd_hook)
|
| 37 |
+
|
| 38 |
+
# 4) 前向+反向,针对“预测到的类”或指定类求梯度
|
| 39 |
+
img_pil, x = load_image('/nfs/ywang29/GmNet/ILSVRC2012_val_00023267.JPEG')
|
| 40 |
+
logits = model(x) # [1,1000]
|
| 41 |
+
pred_class = logits.argmax(dim=1).item()
|
| 42 |
+
model.zero_grad()
|
| 43 |
+
logits[0, pred_class].backward() # 对该类做反传
|
| 44 |
+
|
| 45 |
+
# 5) Grad-CAM 核心:对通道做全局平均池化得到权重,然后加权求和
|
| 46 |
+
A = feats['value'][0] # [C,H,W]
|
| 47 |
+
dY = grads['value'][0] # [C,H,W]
|
| 48 |
+
alpha = dY.mean(dim=(1,2)) # [C]
|
| 49 |
+
cam = F.relu((alpha[:, None, None] * A).sum(dim=0)) # [H,W]
|
| 50 |
+
cam = cam / (cam.max() + 1e-6)
|
| 51 |
+
|
| 52 |
+
# 6) 上采样并与原图叠加
|
| 53 |
+
cam = cv2.resize(cam.cpu().numpy(), (img_pil.width, img_pil.height))
|
| 54 |
+
heatmap = (255 * cam).astype(np.uint8)
|
| 55 |
+
heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET)[:, :, ::-1] # BGR->RGB
|
| 56 |
+
overlay = (0.35 * np.array(img_pil) + 0.65 * heatmap).astype(np.uint8)
|
| 57 |
+
|
| 58 |
+
Image.fromarray(overlay).save('gradcam_overlay.jpg')
|
| 59 |
+
|
| 60 |
+
# 7) 清理hook
|
| 61 |
+
handle_fwd.remove(); handle_bwd.remove()
|
| 62 |
+
print('Saved to gradcam_overlay.jpg')
|
gmnet/legacy_assets/plot.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|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okenaxes
|
| 4 |
+
import random
|
| 5 |
+
random.seed(999)
|
| 6 |
+
|
| 7 |
+
import matplotlib.font_manager as fm
|
| 8 |
+
|
| 9 |
+
# Path to a downloaded Times New Roman font file (.ttf)
|
| 10 |
+
font_path = '/nfs/ywang29/GmNet/times.ttf'
|
| 11 |
+
|
| 12 |
+
# Add the font to Matplotlib's font manager
|
| 13 |
+
font_manager = fm.FontManager(fm.findSystemFonts())
|
| 14 |
+
font_manager.addfont(font_path)
|
| 15 |
+
prop = fm.FontProperties(fname=font_path)
|
| 16 |
+
plt.rcParams['font.family'] = prop.get_name()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Randomly generating some fake data for the plot
|
| 20 |
+
my_color = (0.98,0.1,0.1)
|
| 21 |
+
models = [
|
| 22 |
+
#{"name": "EfficientFormerV2-S0", "top1_accuracy": random.uniform(75, 76), "latency": 2.0, "param": random.uniform(100, 200), "color": np.random.rand(3,)},
|
| 23 |
+
#{"name": "MobileNetV2", "top1_accuracy": random.uniform(71, 73), "latency": random.uniform(0.6, 0.9), "param": random.uniform(50, 100), "color": np.random.rand(3,)},
|
| 24 |
+
#{"name": "EfficientFormer-L1", "top1_accuracy": random.uniform(78, 80), "latency": 12.1, "param": random.uniform(200, 300), "color": np.random.rand(3,)},
|
| 25 |
+
#{"name": "ResNet50", "top1_accuracy": random.uniform(76, 78), "latency": random.uniform(2, 2.5), "param": random.uniform(150, 250), "color": np.random.rand(3,)},
|
| 26 |
+
#{"name": "MobileViT-XS", "top1_accuracy": random.uniform(73, 74), "latency": random.uniform(5, 6), "param": random.uniform(80, 150), "color": np.random.rand(3,)},
|
| 27 |
+
#
|
| 28 |
+
# {"name": "", "top1_accuracy":72.5, "latency":0.67, "param":2.4, "color":my_color},
|
| 29 |
+
# {"name": "", "top1_accuracy": 71.6, "latency": 0.63, "param": 2.2, "color": my_color, "shift": [0, 0]},
|
| 30 |
+
#{"name": "", "top1_accuracy":73.5, "latency":0.716, "param":2.9, "color":my_color, "shift":[0,0]},
|
| 31 |
+
{"name": "StarNet-S2", "top1_accuracy":74.8, "latency":1.9, "param":3.7, "color":np.random.rand(3,), "shift":[0,0.2]},
|
| 32 |
+
{"name": "StarNet-S3", "top1_accuracy":77.3, "latency":2.4, "param":5.8, "color":np.random.rand(3,), "shift":[0,-0.2]},
|
| 33 |
+
{"name": "StarNet-S4", "top1_accuracy":78.4, "latency":3.3, "param":7.5, "color":np.random.rand(3,), "shift":[-0.1,-0.3]},
|
| 34 |
+
# others
|
| 35 |
+
# {"name": "MobileOne-S0", "top1_accuracy":71.4, "latency":0.67, "param":2.1, "color":np.random.rand(3,),"shift":[0.13,-0.2]},
|
| 36 |
+
#{"name": "MobileOne-S1", "top1_accuracy":75.9, "latency":0.854, "param":4.8, "color":np.random.rand(3,), "shift":[0.13,-0.2]},
|
| 37 |
+
{"name": "MobileOne-S2", "top1_accuracy":77.2, "latency":1.8, "param":7.8, "color":np.random.rand(3,), "shift":[0.2,0.2]},
|
| 38 |
+
{"name": "MobileOne-S4", "top1_accuracy":79.6, "latency":2.9, "param":7.8, "color":np.random.rand(3,), "shift":[0.15,0]},
|
| 39 |
+
|
| 40 |
+
#{"name": "EfficientNet-B0", "top1_accuracy":77.1, "latency":, "param":5.3, "color":np.random.rand(3,), "shift":[0,0]},
|
| 41 |
+
# {"name": "EdgeViT-xxs", "top1_accuracy":74.4, "latency":2.839, "param":4.1, "color":np.random.rand(3,), "shift":[0,0]},
|
| 42 |
+
{"name": "EdgeViT-xs", "top1_accuracy":77.5, "latency":3.0, "param":4.1, "color":np.random.rand(3,), "shift":[0,0]},
|
| 43 |
+
|
| 44 |
+
{"name": "Mobilev2-x1.4", "top1_accuracy":74.7, "latency":1.7, "param":6.9, "color":np.random.rand(3,), "shift":[0,-0.2]},
|
| 45 |
+
#{"name": "MobileNetv2-x1.0", "top1_accuracy":72, "latency":1.7, "param":3.4, "color":np.random.rand(3,), "shift":[0,0]},
|
| 46 |
+
#{"name": "Mobile v2-x2.0", "top1_accuracy":74.7, "latency":2.0, "param":7.4, "color":np.random.rand(3,), "shift":[0.2,0]},
|
| 47 |
+
#{"name": "MobileNetv2-x1.4", "param":6.9, "top1_accuracy":74, "latency":1.7, "color":np.random.rand(3,), "shift":[0,0]},
|
| 48 |
+
#{"name": "MobileNetv2-x1.0", "param":3.4, "top1_accuracy":72, "latency":1.7, "color":np.random.rand(3,), "shift":[0,0]},
|
| 49 |
+
#{"name": "MobileNetv2-x2.0", "param":7.4, "top1_accuracy":74, "latency":2.0, "color":np.random.rand(3,), "shift":[0,0]},
|
| 50 |
+
{"name": "RepViT-M0.9", "param":6.9, "top1_accuracy":77.4, "latency":3.2, "color":np.random.rand(3,), "shift":[0,-0.2]},
|
| 51 |
+
# {"name": "RepViT-M1.0", "param":3.4, "top1_accuracy":78.6, "latency":3.6, "color":np.random.rand(3,), "shift":[-0.1,0]},
|
| 52 |
+
# {"name": "RepViT-M1.1", "param":7.4, "top1_accuracy":79.4, "latency":5.1, "color":np.random.rand(3,), "shift":[-0.3,0]},
|
| 53 |
+
# {"name": "RepViT-M1.5", "param":7.4, "top1_accuracy":81.2, "latency":6.4, "color":np.random.rand(3,), "shift":[-0.3,0]},
|
| 54 |
+
|
| 55 |
+
#{"name": "GhostNet0.5", "param":6.9, "top1_accuracy":77.4, "latency":3.2, "color":np.random.rand(3,), "shift":[0,0]},
|
| 56 |
+
{"name": "GhostNet1.0", "param":3.4, "top1_accuracy":73.9, "latency":2.9, "color":np.random.rand(3,), "shift":[0,0]},
|
| 57 |
+
{"name": "GhostNet1.3", "param":7.4, "top1_accuracy":75.7, "latency":3.0, "color":np.random.rand(3,), "shift":[-0,0]},
|
| 58 |
+
|
| 59 |
+
# {"name": "FastViT-S12", "param":3.4, "top1_accuracy":79.8, "latency":5.3, "color":np.random.rand(3,), "shift":[-0.3,-0.3]},
|
| 60 |
+
# {"name": "RepViT-M1.1", "param":7.4, "top1_accuracy":81.2, "latency":5.1, "color":np.random.rand(3,), "shift":[0,0]},
|
| 61 |
+
# {"name": "LSNet-B", "param":3.4, "top1_accuracy":80.3, "latency":6.2, "color":np.random.rand(3,), "shift":[-0.3,-0.3]},
|
| 62 |
+
{"name": "LSNet-T", "param":3.4, "top1_accuracy":74.9, "latency":2.9, "color":np.random.rand(3,), "shift":[-0,-0]},
|
| 63 |
+
|
| 64 |
+
{"name": "UniRepLKNet-F", "param":3.4, "top1_accuracy":78.6, "latency":3.1, "color":np.random.rand(3,), "shift":[-0,-0]},
|
| 65 |
+
|
| 66 |
+
{"name": "EfficientFormerV2-S0", "param":6.9, "top1_accuracy":73.7, "latency":2.0, "color":np.random.rand(3,), "shift":[0,0.3]},
|
| 67 |
+
#{"name": "EfficientFormerV2-S1", "param":3.4, "top1_accuracy":74.7, "latency":2.8, "color":np.random.rand(3,), "shift":[0,0.3]},
|
| 68 |
+
# {"name": "EfficientFormerV2-S2", "param":7.4, "top1_accuracy":80.4, "latency":5.4, "color":np.random.rand(3,), "shift":[-0.35,0.15]},
|
| 69 |
+
|
| 70 |
+
{"name": "EfficientMod-xxs", "param":6.9, "top1_accuracy":73.7, "latency":2.3, "color":np.random.rand(3,), "shift":[0,-0]},
|
| 71 |
+
{"name": "EfficientMod-xs", "param":3.4, "top1_accuracy":74.7, "latency":2.9, "color":np.random.rand(3,), "shift":[-0,-0.1]},
|
| 72 |
+
# {"name": "EfficientMod-s", "param":7.4, "top1_accuracy":80.4, "latency":4.5, "color":np.random.rand(3,), "shift":[0,-0.3]},
|
| 73 |
+
# {"name": "FasterNet-T0", "top1_accuracy":71.9, "latency":0.708, "param":3.9, "color":np.random.rand(3,), "shift":[0,0]},
|
| 74 |
+
#{"name": "Fasternet-T0", "param":6.9, "top1_accuracy":71.9, "latency":2.3, "color":np.random.rand(3,), "shift":[0,0]},
|
| 75 |
+
{"name": "Fasternet-T1", "param":3.4, "top1_accuracy":76.2, "latency":2.6, "color":np.random.rand(3,), "shift":[0,0]},
|
| 76 |
+
# {"name": "Fasternet-T2", "param":7.4, "top1_accuracy":78.9, "latency":4.5, "color":np.random.rand(3,), "shift":[0,0]},
|
| 77 |
+
|
| 78 |
+
{"name": "", "top1_accuracy":75.5, "latency":1.6, "param":7.6, "color":'r', "shift":[0.15,0]},
|
| 79 |
+
{"name": "", "top1_accuracy":78.3, "latency":1.8, "param":7.6, "color":'r', "shift":[0.15,0]},
|
| 80 |
+
{"name": "", "top1_accuracy":79.3, "latency":2.1, "param":7.8, "color":'r', "shift":[0.15,0]},
|
| 81 |
+
{"name": "GmNet", "top1_accuracy":81.5, "latency":2.9, "param":13.0, "color":'r', "shift":[0.1,0]},
|
| 82 |
+
|
| 83 |
+
# Add more models as needed
|
| 84 |
+
]
|
| 85 |
+
|
| 86 |
+
#GmNet
|
| 87 |
+
plot_data_x = [ 1.6, 1.8, 2.1, 2.9]
|
| 88 |
+
plot_data_y = [75.5,78.3, 79.3, 81.5]
|
| 89 |
+
|
| 90 |
+
#StarNet
|
| 91 |
+
#plot_data_x1 = [ 2.0,2.3, 3.3]
|
| 92 |
+
#plot_data_y1 = [74.8,77.3,78.4]
|
| 93 |
+
plot_data_x1 = [ 2.0, 3.3]
|
| 94 |
+
plot_data_y1 = [74.8,78.4]
|
| 95 |
+
#RepViT
|
| 96 |
+
plot_data_x2 = [ 3.2, 3.6, 5.1]
|
| 97 |
+
plot_data_y2 = [77.4, 78.6, 81.2]
|
| 98 |
+
|
| 99 |
+
#EfficientFormerV2
|
| 100 |
+
plot_data_x3 = [ 2.0, 2.8, 5.4]
|
| 101 |
+
plot_data_y3 = [73.7, 74.7, 80.4]
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
#EfficientMod
|
| 105 |
+
plot_data_x4 = [ 2.3, 2.9, 4.5]
|
| 106 |
+
plot_data_y4 = [76, 78.3, 81.0]
|
| 107 |
+
|
| 108 |
+
#Fasternet
|
| 109 |
+
plot_data_x5 = [ 2.3, 2.6, 4.5]
|
| 110 |
+
plot_data_y5 = [71.9, 76.2, 78.9]
|
| 111 |
+
|
| 112 |
+
#Fasternet
|
| 113 |
+
plot_data_x5 = [ 2.3, 2.6, 4.5]
|
| 114 |
+
plot_data_y5 = [71.9, 76.2, 78.9]
|
| 115 |
+
|
| 116 |
+
# 71.9,
|
| 117 |
+
# 76.2,
|
| 118 |
+
# 78.9,
|
| 119 |
+
#MobileOne
|
| 120 |
+
plot_data_x5 = [ 1.8, 2.9]
|
| 121 |
+
plot_data_y5 = [77.4, 79.4]
|
| 122 |
+
|
| 123 |
+
#GmNet
|
| 124 |
+
#plot_data_x = [ 1.6, 2.2, 2.9]
|
| 125 |
+
#plot_data_y = [74.6, 79.3, 81.2]
|
| 126 |
+
|
| 127 |
+
# Set up the figure and axis
|
| 128 |
+
fig, ax = plt.subplots(figsize=(6, 6))
|
| 129 |
+
ax.grid(True, linestyle='dashed', color=(0.95,0.95,0.95))
|
| 130 |
+
# fig = plt.figure(figsize=(4, 3))
|
| 131 |
+
# ax = brokenaxes(xlims=((0, 2), ()),
|
| 132 |
+
# ylims=((-4.3, -4), (-0.5, 0.2), (0.65, 1.5))) # !! These lims need to be manually adjusted for the best view
|
| 133 |
+
|
| 134 |
+
# Scatter plot, each model is a point whose size is proportional to the model 'size' and color is unique
|
| 135 |
+
ax.plot(plot_data_x, plot_data_y, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 136 |
+
#ax.plot(plot_data_x1, plot_data_y1, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 137 |
+
#ax.plot(plot_data_x2, plot_data_y2, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 138 |
+
#ax.plot(plot_data_x3, plot_data_y3, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 139 |
+
#ax.plot(plot_data_x4, plot_data_y4, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 140 |
+
#ax.plot(plot_data_x5, plot_data_y5, linewidth=3, color=my_color, linestyle="-.", alpha=0.4)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
for spine in ax.spines.values():
|
| 144 |
+
spine.set_edgecolor((0.5, 0.5, 0.5))
|
| 145 |
+
for model in models:
|
| 146 |
+
ax.scatter(model['latency'], model['top1_accuracy'], s =40, alpha=0.8, color=model['color'], marker='o')
|
| 147 |
+
ax.text(model['latency']+model['shift'][0], model['top1_accuracy']+model['shift'][1], model['name'], fontsize=11, ha='center')
|
| 148 |
+
# s=int(model['param']*100),
|
| 149 |
+
# Setting the axis labels
|
| 150 |
+
ax.set_xlabel('Latency (ms)', fontsize=12)
|
| 151 |
+
ax.set_ylabel('Top-1 Accuracy (%)', fontsize=12)
|
| 152 |
+
#ax.annotate('(Bubble size indicates model parameter number)', (1.45, 72.5),fontsize=11, horizontalalignment='center', verticalalignment='center', color=(0.4,0.4,0.4))
|
| 153 |
+
|
| 154 |
+
# Title of the plot
|
| 155 |
+
# ax.set_title('Model Performance Comparison')
|
| 156 |
+
|
| 157 |
+
# Show the plot
|
| 158 |
+
plt.show()
|
| 159 |
+
out = 'acc_latency3.pdf'
|
| 160 |
+
fig.savefig(out, bbox_inches='tight')
|
| 161 |
+
out = 'acc_latency3.png'
|
| 162 |
+
fig.savefig(out, bbox_inches='tight')
|
gmnet/project/gmnet_tpami/E4_MECHANISM_UNIFIED_CONCLUSIONS.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet Journal 机制实验统一结论
|
| 2 |
+
|
| 3 |
+
更新时间:2026-07-19 UTC
|
| 4 |
+
|
| 5 |
+
## 1. 结论范围
|
| 6 |
+
|
| 7 |
+
本文档统一整理以下证据:
|
| 8 |
+
|
| 9 |
+
1. E1/E2 隔离算子的频谱生成、跨频耦合与 alias/clipping 控制;
|
| 10 |
+
2. ImageNet gate shape、activation-only、no-gate 和 clipping 对照;
|
| 11 |
+
3. ImageNet matched retraining 的 stop-gradient、channel derangement、
|
| 12 |
+
batch derangement 及 stop-gradient + channel derangement;
|
| 13 |
+
4. 50,000 张验证图上的 official accuracy、NLL、ECE、gate operating region、
|
| 14 |
+
coherence proxy 和固定置换审计。
|
| 15 |
+
|
| 16 |
+
所有 ImageNet 数值都来自 fixed-last checkpoint。E4 机制面板是 seed 0 的
|
| 17 |
+
描述性 effect-size 证据,不做显著性、等价性或总体交互声明。
|
| 18 |
+
|
| 19 |
+
可复核的英文报告和机器可读表位于:
|
| 20 |
+
|
| 21 |
+
```text
|
| 22 |
+
/nfs/ywang29/GmNet/local_results/e4_mechanism_followup_20260718/
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## 2. Artifact 验收
|
| 26 |
+
|
| 27 |
+
统一汇总器重新调用 official validator,要求:
|
| 28 |
+
|
| 29 |
+
- `official_eval/COMPLETE` 存在;
|
| 30 |
+
- `checks.json` 为 `passed`;
|
| 31 |
+
- fixed-last epoch 299、300 epochs、8 GPUs;
|
| 32 |
+
- 625 steps/epoch、187,500 total steps;
|
| 33 |
+
- `training_complete=true`;
|
| 34 |
+
- 50,000 张验证图且 `partial_evaluation=false`;
|
| 35 |
+
- checkpoint、配置、数据和 state schema 与 official certificate 一致。
|
| 36 |
+
|
| 37 |
+
E4 的五个机制 arm 均为 7,791,544 参数、365 个 state tensors。Channel 与
|
| 38 |
+
combined 使用完全相同的 17-block zero-fixed-point permutation manifest:
|
| 39 |
+
|
| 40 |
+
```text
|
| 41 |
+
0219d0a289ae2e3c2bde90568af4b05d23ca629522f1b19b6a1d09473d87fb8b
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Batch arm 在 official evaluation 中使用固定 canonical order、batch size 256,
|
| 45 |
+
尾 batch 为 80;17 个 block 的两种 batch mapping 均为 bijection、零 fixed point,
|
| 46 |
+
覆盖全部 50,000 receiver samples。
|
| 47 |
+
|
| 48 |
+
## 3. ImageNet 机制面板
|
| 49 |
+
|
| 50 |
+
记:
|
| 51 |
+
|
| 52 |
+
- `B`:current-code ReLU6 baseline;
|
| 53 |
+
- `H`:historical paper-recipe baseline;
|
| 54 |
+
- `S`:stop-gradient;
|
| 55 |
+
- `C`:channel derangement;
|
| 56 |
+
- `D`:batch derangement;
|
| 57 |
+
- `SC`:stop-gradient + channel derangement。
|
| 58 |
+
|
| 59 |
+
| Arm | Top-1 | 相对 B | Top-5 | 相对 B | NLL | ECE |
|
| 60 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 61 |
+
| B | 78.798 | 0.000 | 94.400 | 0.000 | 1.064004 | 19.735691 |
|
| 62 |
+
| H | 78.746 | -0.052 | 94.380 | -0.020 | 1.081215 | 20.657784 |
|
| 63 |
+
| S | 76.774 | **-2.024** | 93.358 | -1.042 | 1.138777 | 18.896074 |
|
| 64 |
+
| C | 77.794 | **-1.004** | 93.906 | -0.494 | 1.120781 | 20.019571 |
|
| 65 |
+
| D | 54.362 | **-24.436** | 77.340 | -17.060 | 2.326874 | 20.164200 |
|
| 66 |
+
| SC | 69.508 | **-9.290** | 88.894 | -5.506 | 1.501795 | 18.994035 |
|
| 67 |
+
|
| 68 |
+
新旧 baseline 仅差 `+0.052 pp`,说明本批 current-code baseline 数值上复现了
|
| 69 |
+
历史配方。旧 S/C 的 launch-time code provenance 仍不是本批 exact code,因而
|
| 70 |
+
交互只能描述,不可包装成严格 factorial inference。
|
| 71 |
+
|
| 72 |
+
Batch arm 的训练末次 DDP validation 为 53.446,但该干预依赖 batch/order;论文
|
| 73 |
+
必须使用注册的 canonical single-device official 数值 54.362。
|
| 74 |
+
|
| 75 |
+
## 4. Combined 交互
|
| 76 |
+
|
| 77 |
+
在每个指标原始尺度定义:
|
| 78 |
+
|
| 79 |
+
\[
|
| 80 |
+
\widehat{SC}_{add}=S+C-B,\qquad
|
| 81 |
+
I=SC-\widehat{SC}_{add}.
|
| 82 |
+
\]
|
| 83 |
+
|
| 84 |
+
| 指标 | 加和预测 | 实际 SC | 描述性交互 I |
|
| 85 |
+
|---|---:|---:|---:|
|
| 86 |
+
| Top-1 | 75.770 | 69.508 | **-6.262 pp** |
|
| 87 |
+
| Top-5 | 92.864 | 88.894 | **-3.970 pp** |
|
| 88 |
+
| NLL | 1.195555 | 1.501795 | **+0.306240** |
|
| 89 |
+
| ECE | 19.179954 | 18.994035 | -0.185919 pp |
|
| 90 |
+
|
| 91 |
+
Top-1、Top-5 与 NLL 一致表明,切断 gate gradient 后再施加同一 channel
|
| 92 |
+
mismatch,损伤远大于 accuracy-scale 的简单加和预测。ECE 与 accuracy 不单调,
|
| 93 |
+
不用于支撑机制交互。
|
| 94 |
+
|
| 95 |
+
## 5. Gate Operating Regime
|
| 96 |
+
|
| 97 |
+
Coherence 是每个 block 对 canonical validation sample 0 最多 65,536 个元素计算的
|
| 98 |
+
Pearson proxy,再对 17 个 block 求算术均值。它不是全数据语义对齐度,也不是
|
| 99 |
+
因果中介。Negative/active/crossing 比例则在全部 50,000 张图上按元素精确加权。
|
| 100 |
+
|
| 101 |
+
| Arm | Coherence proxy | Negative | Active [0,6) | Clip crossing |
|
| 102 |
+
|---|---:|---:|---:|---:|
|
| 103 |
+
| B | 1.0000 | 58.630% | 40.698% | 0.6725% |
|
| 104 |
+
| S | 1.0000 | 62.649% | 37.340% | 0.0105% |
|
| 105 |
+
| C | 0.1304 | 52.064% | 47.761% | 0.1754% |
|
| 106 |
+
| D | 0.7627 | 81.001% | 16.378% | 2.6213% |
|
| 107 |
+
| SC | -0.0007 | 50.847% | 48.465% | 0.6883% |
|
| 108 |
+
|
| 109 |
+
逐 stage coherence:
|
| 110 |
+
|
| 111 |
+
| Arm | Stage 1 | Stage 2 | Stage 3 | Stage 4 |
|
| 112 |
+
|---|---:|---:|---:|---:|
|
| 113 |
+
| B | 1.000 | 1.000 | 1.000 | 1.000 |
|
| 114 |
+
| S | 1.000 | 1.000 | 1.000 | 1.000 |
|
| 115 |
+
| C | 0.020 | 0.045 | 0.154 | 0.265 |
|
| 116 |
+
| D | 0.838 | 0.898 | 0.685 | 0.758 |
|
| 117 |
+
| SC | 0.001 | 0.020 | -0.011 | 0.003 |
|
| 118 |
+
|
| 119 |
+
解释如下:
|
| 120 |
+
|
| 121 |
+
1. `D` 虽然使用异样本 donor,却学出了较高的跨样本 coherence proxy。这更像
|
| 122 |
+
sample-shared/高度相关的边际 gate 统计,而不是保留了同样本调制。其 active
|
| 123 |
+
区间从 40.70% 降至 16.38%,Top-1 仍下降 24.436 pp,说明这种补偿不足以恢复
|
| 124 |
+
task-relevant same-sample conditioning。
|
| 125 |
+
2. `C` 的 coherence 从 Stage 1 的 0.020 增至 Stage 4 的 0.265,且只下降
|
| 126 |
+
1.004 pp。网络在 gate gradient 存在时可以显著适应固定 channel mismatch,
|
| 127 |
+
��而不能声称 exact channel correspondence 绝对必要。
|
| 128 |
+
3. `SC` 使用与 `C` 完全相同的 permutation,但全深度 coherence 约为零,Top-1
|
| 129 |
+
降至 69.508。这支持 gate-gradient path 是 mismatch 下表征重组与适应的一部分。
|
| 130 |
+
4. Clip crossing 从 `S` 的 0.0105% 到 `D` 的 2.6213% 变化很大,却与 accuracy
|
| 131 |
+
不单调。Clipping 应被定位为 operating-range/spectral-spill 控制,而不是
|
| 132 |
+
clean accuracy 的单调来源。
|
| 133 |
+
|
| 134 |
+
## 6. Gate Shape 与 Clipping 上下文
|
| 135 |
+
|
| 136 |
+
以下统一相对 historical ReLU6 `H=78.746`:
|
| 137 |
+
|
| 138 |
+
| 对照 | Top-1 | Delta |
|
| 139 |
+
|---|---:|---:|
|
| 140 |
+
| ReLU self-gate | 78.568 | -0.178 |
|
| 141 |
+
| GELU self-gate | 78.664 | -0.082 |
|
| 142 |
+
| Learned smooth cap | 78.670 | -0.076 |
|
| 143 |
+
| Fixed smooth cap c=6 | 78.798 | +0.052 |
|
| 144 |
+
| ReLU6-only,无 self-multiplication | 78.122 | -0.624 |
|
| 145 |
+
| 移除完整 gated operator | 14.376 | -64.370 |
|
| 146 |
+
|
| 147 |
+
这些单 seed 数值支持:
|
| 148 |
+
|
| 149 |
+
- 完整 gated operator 对当前架构的可训练性/性能非常重要;
|
| 150 |
+
- activation-only 与 baseline 只差 0.624 pp,因此不能声称 multiplication 本身是
|
| 151 |
+
ImageNet clean accuracy 的唯一必要来源;
|
| 152 |
+
- ReLU、GELU、hard ReLU6、learned smooth 和 fixed smooth 的 clean accuracy 很接近,
|
| 153 |
+
不支持“ReLU6 或 learned clipping 独有准确率优势”;
|
| 154 |
+
- clipping 的合理作用是限制幅值、spill 和 alias,并提供可控制的工作区间。
|
| 155 |
+
|
| 156 |
+
## 7. 与 E1/E2 频谱证据的衔接
|
| 157 |
+
|
| 158 |
+
已有隔离算子证据提供了频谱主线的第一段:
|
| 159 |
+
|
| 160 |
+
- FFT/DCT/Haar 重构最大误差 `8.53e-14`;三种基底对 paired frequency shift 的
|
| 161 |
+
最低 Spearman `rho=0.933`;
|
| 162 |
+
- linear no-gate 不生成新谐波,identity self-gate 产生最大频谱迁移;
|
| 163 |
+
- std=4 条件下 ReLU6 相比 ReLU 将 frequency-AUC 增量从 `0.06220` 降至
|
| 164 |
+
`0.05248`,减少 `15.6%`;
|
| 165 |
+
- E2 单频、双频和随机带限输入均验证了 harmonic/intermodulation/band transfer;
|
| 166 |
+
- alias power 为 ReLU6 `0.0624`、ReLU `0.0654`,支持 clipping 对 alias 的控制;
|
| 167 |
+
- CIFAR-100 trained-feature audit 中 no-gate 的 feature PSD centroid 更高但 accuracy
|
| 168 |
+
最低,直接否定“raw high-frequency energy 越高,分类越好”。
|
| 169 |
+
|
| 170 |
+
这些结果证明 gate 可以产生和控制频谱迁移,但还没有证明新 ImageNet 五个机制
|
| 171 |
+
checkpoint 的总 mixing strength 完全匹配。因此准确表述是:E1/E2 建立算子能力,
|
| 172 |
+
E4 建立 conditioning/gradient 与任务性能的关系;两者形成机制链,而不是把
|
| 173 |
+
accuracy drop 直接等同为 spectral-energy drop。
|
| 174 |
+
|
| 175 |
+
## 8. 最终 Claim
|
| 176 |
+
|
| 177 |
+
建议摘要级核心表述:
|
| 178 |
+
|
| 179 |
+
> GmNet does not benefit from indiscriminate high-frequency amplification.
|
| 180 |
+
> Its self-gate performs input-conditioned multiplicative spectral mixing,
|
| 181 |
+
> whose task value depends on sample-conditioned carrier-gate coupling and an
|
| 182 |
+
> optimizable gate-gradient path. Exact channel correspondence is helpful but
|
| 183 |
+
> adaptable. Clipping bounds the operating range and spectral spill rather
|
| 184 |
+
> than uniquely determining clean accuracy.
|
| 185 |
+
|
| 186 |
+
中文含义:GmNet 的收益并非来自无差别增加高频能量,而来自与当前输入条件耦合的
|
| 187 |
+
乘法频谱混合;这种混合的任务价值依赖 carrier-gate 的同样本条件关系和可优化的
|
| 188 |
+
gate-gradient path。精确 channel correspondence 有帮助但可以被训练部分适应;
|
| 189 |
+
clipping 控制工作区间和频谱外溢,而不是单独决定 clean accuracy。
|
| 190 |
+
|
| 191 |
+
## 9. 可以与不能声称的内容
|
| 192 |
+
|
| 193 |
+
可以声称:
|
| 194 |
+
|
| 195 |
+
1. 破坏 sample identity 引起 `-24.436 pp`,并伴随 gate operating regime 重构;
|
| 196 |
+
2. stop-gradient 引起 `-2.024 pp`,说明 gate branch 的训练梯度具有任务贡献;
|
| 197 |
+
3. 固定 channel mismatch 可被网络大幅适应,但与 stop-gradient 联合时损伤显著放大;
|
| 198 |
+
4. 总高频能量不是任务有效频率的充分条件;
|
| 199 |
+
5. clipping 可控制频谱生成/alias 的工作区间,但 clip crossing 与 accuracy 不单调。
|
| 200 |
+
|
| 201 |
+
不能声称:
|
| 202 |
+
|
| 203 |
+
1. sample/channel alignment 在所有模型和 seeds 上“必要”;
|
| 204 |
+
2. `SC` 的交互达到统计显著或总体 super-additivity;
|
| 205 |
+
3. batch arm 是纯 forward alignment 因果干预,因为它同时改变 donor、跨样本梯度
|
| 206 |
+
和 batch/order dependence;
|
| 207 |
+
4. coherence proxy 是语义对齐或因果中介;
|
| 208 |
+
5. adaptive/learned clipping 已经提升 ImageNet accuracy 或 robustness;
|
| 209 |
+
6. 新五个 ImageNet checkpoints 已经具有 matched total spectral mixing。
|
| 210 |
+
|
| 211 |
+
## 10. 闭环状态
|
| 212 |
+
|
| 213 |
+
当前已经闭合一个单 seed、描述性的 ImageNet 机制面板:
|
| 214 |
+
|
| 215 |
+
```text
|
| 216 |
+
operator spectral generation/control
|
| 217 |
+
-> trained task relevance is not raw PSD energy
|
| 218 |
+
-> sample conditioning and gate gradient matter
|
| 219 |
+
-> exact channel mismatch is adaptable
|
| 220 |
+
-> clipping controls the regime rather than uniquely setting accuracy
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
尚未达到强 TPAMI 统计闭环:
|
| 224 |
+
|
| 225 |
+
1. 摘要级中心机制仍建议补 seeds 1/2;
|
| 226 |
+
2. 需要在与 official 相同的 PyTorch 2.9/CUDA 13 image 中,对 B/D/S/C/SC 运行统一
|
| 227 |
+
ImageNet post-hoc spectral audit;当前本地环境已漂移至 PyTorch 2.10,不能把
|
| 228 |
+
其输出冻结为 formal evidence;
|
| 229 |
+
3. 若要隔离纯 forward same-sample alignment,需要 detached-batch arm;
|
| 230 |
+
4. 若要提出 adaptive clipping 方法贡献,需要 corrected learned-clipping 的
|
| 231 |
+
ImageNet、robustness 与 latency 结果。
|
| 232 |
+
|
| 233 |
+
上述第 2 项的正式审计协议、冻结 4,096 图像子集、source-equivalence 测试、
|
| 234 |
+
runner、独立汇总器和 8 卡部署包已经准备在:
|
| 235 |
+
|
| 236 |
+
```text
|
| 237 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/
|
| 238 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
部署状态为 `ready_not_submitted`。冻结 runner/聚合器 SHA256 分别为
|
| 242 |
+
`2b56465319e651716170fbaa58d43f14924d70f694b0a273ab63255c2697edfe` 和
|
| 243 |
+
`9027155739ccbeba1150d5bdaa6d94930d8169ed4d4edb5c5fe2af2bd655b5e5`;生成 YAML
|
| 244 |
+
SHA256 为 `696d3c198cb9bde125fb726b75daac9703136f50ad7dab76a891767de85d87c3`,deploy
|
| 245 |
+
manifest SHA256 为
|
| 246 |
+
`4ff8001c29a89bdc68c9c3578e354e9808223d6143c9663df8b64130f1e26578`。
|
| 247 |
+
本地非正式 smoke 只验证实现与 artifact contract,不构成新的 ImageNet 机制结果;
|
| 248 |
+
在正式 PyTorch 2.9 作业写出并通过根目录 `COMPLETE` 之前,本节“尚未达到”的判断
|
| 249 |
+
不变。
|
| 250 |
+
|
| 251 |
+
## 11. 结果索引
|
| 252 |
+
|
| 253 |
+
- 统一英文报告:`/nfs/ywang29/GmNet/local_results/e4_mechanism_followup_20260718/REPORT.md`
|
| 254 |
+
- 全部 official 指标:`official_metrics.csv`
|
| 255 |
+
- 逐 block 诊断:`gate_diagnostics_by_block.csv`
|
| 256 |
+
- 逐 stage 诊断:`gate_diagnostics_by_stage.csv`
|
| 257 |
+
- 机器可读汇总:`results.json`
|
| 258 |
+
- 源 artifact SHA256:`source_artifacts.sha256`
|
| 259 |
+
- 可重复汇总器:`/root/gmnet_tpami/scripts/summarize_e4_mechanism.py`
|
gmnet/project/gmnet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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# E4 Formal Spectral Audit: Source Equivalence Audit
|
| 2 |
+
|
| 3 |
+
日期:2026-07-18
|
| 4 |
+
|
| 5 |
+
## 结论
|
| 6 |
+
|
| 7 |
+
可以恢复并验证 E4 alignment 训练时的模型源码,不需要修改当前
|
| 8 |
+
`journal_exp`:
|
| 9 |
+
|
| 10 |
+
- alignment 代码清单:`code_sha256 = 4a62bc483702...641f`,清单文件
|
| 11 |
+
SHA256 为 `fa1a6ba00c82...ddbc`。
|
| 12 |
+
- mechanism-followup/current 代码清单:`code_sha256 = f6bd434a2ac8...bf9`,
|
| 13 |
+
清单文件 SHA256 为 `e354339142ff...f0b239`。
|
| 14 |
+
- alignment 版本的 `gmnet/models/gmnet.py` 已按 Codex 会话中的精确正向
|
| 15 |
+
patch 逆向恢复,大小 `28103` bytes,SHA256
|
| 16 |
+
`5291156084aaf72936d1f8896057e7e606f74ef05aed856df4940e4838dbe3ac`,
|
| 17 |
+
与 alignment manifest 逐字节一致。
|
| 18 |
+
- alignment 版本的 `gmnet/models/__init__.py` 同样恢复为 `722` bytes,
|
| 19 |
+
SHA256
|
| 20 |
+
`9227138f9cd0e0110f57bad21b9302d8b5daa51cd63246e37c8ff2878eb2715e`,
|
| 21 |
+
与 alignment manifest 逐字节一致。
|
| 22 |
+
- 对 B/S/C 三种已有 intervention,旧版与当前版完整 GmNet-S3 的 forward、
|
| 23 |
+
input gradient 和全部 245 个 parameter gradients 在本地测试中均 bitwise
|
| 24 |
+
equal,所有 `max_abs = 0`。C 的 17 个 permutation 及公共 metadata 也完全
|
| 25 |
+
相同。
|
| 26 |
+
|
| 27 |
+
因此,formal spectral audit 可以统一使用当前 `f6bd` 模型实现来获得一致的
|
| 28 |
+
hook/instrumentation,但必须先在正式 PyTorch 2.9 容器中重复等价测试,并用当前
|
| 29 |
+
实现对 S/C 做 50K ImageNet exact replay。训练来源仍应如实标注为两套不同的
|
| 30 |
+
code hash,不能把“行为等价”写成“训练源码相同”。
|
| 31 |
+
|
| 32 |
+
## 快照查找
|
| 33 |
+
|
| 34 |
+
常规位置没有发现可直接使用的 alignment 源文件副本:
|
| 35 |
+
|
| 36 |
+
- `/root`、`/nfs/ywang29/GmNet` 和 `/tmp` 中只有当前
|
| 37 |
+
`journal_exp/gmnet/models/gmnet.py`。
|
| 38 |
+
- 唯一 `gmnet.cpython-312.pyc` 的时间为 2026-07-17 21:12 UTC,晚于
|
| 39 |
+
mechanism patch,属于当前版本。
|
| 40 |
+
- `journal_exp/.git` 是空的初始化仓库,全部文件均未跟踪,没有 commit、reflog
|
| 41 |
+
或 historical blob。
|
| 42 |
+
- alignment run 目录没有 wheel、source tar、patch 或 W&B `code/` 快照;`/tmp`
|
| 43 |
+
pip ephemeral cache 也没有保留旧 wheel。
|
| 44 |
+
|
| 45 |
+
可恢复证据存在于本地 Codex session:
|
| 46 |
+
|
| 47 |
+
```text
|
| 48 |
+
/root/.codex/sessions/2026/07/12/
|
| 49 |
+
rollout-2026-07-12T19-12-35-019f57be-e49b-77b3-9198-0721b55f06ff.jsonl
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
该会话记录了 current 版本相对 alignment 版本的三次精确 `apply_patch`:
|
| 53 |
+
|
| 54 |
+
| UTC 时间 | JSONL 行 | 内容 |
|
| 55 |
+
|---|---:|---|
|
| 56 |
+
| 2026-07-17 21:00:58.920 | 6665 | 新增 batch/combined modes,并重构 `gate_input` |
|
| 57 |
+
| 2026-07-17 21:01:05.385 | 6670 | 新增 intervention component metadata |
|
| 58 |
+
| 2026-07-17 21:03:01.840 | 6723 | 新增两个常量的 exports |
|
| 59 |
+
|
| 60 |
+
将这三次 patch 从当前 SHA256 已知的 postimage 严格逆向应用后,两个恢复文件的
|
| 61 |
+
长度和 SHA256 同时命中 alignment manifest。这个双重命中排除了基于上下文
|
| 62 |
+
“近似重写”旧实现的可能。
|
| 63 |
+
|
| 64 |
+
## 冻结产物
|
| 65 |
+
|
| 66 |
+
旧模型源码已冻结在:
|
| 67 |
+
|
| 68 |
+
```text
|
| 69 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/source_snapshots/alignment_4a62/
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
关键文件:
|
| 73 |
+
|
| 74 |
+
| 文件 | SHA256 |
|
| 75 |
+
|---|---|
|
| 76 |
+
| `gmnet/models/gmnet.py` | `5291156084aaf72936d1f8896057e7e606f74ef05aed856df4940e4838dbe3ac` |
|
| 77 |
+
| `gmnet/models/__init__.py` | `9227138f9cd0e0110f57bad21b9302d8b5daa51cd63246e37c8ff2878eb2715e` |
|
| 78 |
+
| `source_manifest.json` | `f590f522f8e9181eaa26b1688ed5d59a0598b9d4188fcd10f14516d24b070b19` |
|
| 79 |
+
|
| 80 |
+
恢复和验证代码:
|
| 81 |
+
|
| 82 |
+
| 文件 | SHA256 |
|
| 83 |
+
|---|---|
|
| 84 |
+
| `scripts/reconstruct_alignment_snapshot.py` | `c8b93a0f96689f09167f6897a77d7ad0331894d87272fb3cf5d0150350e2a6aa` |
|
| 85 |
+
| `scripts/test_alignment_source_equivalence.py` | `3b695ed53e11ae4a1de0e9c60e8991c1e260d8de7394b4a8a8bd3141a3cdb45d` |
|
| 86 |
+
| local 2.10 evidence | `e341afcb8cde200b280b590826bc18f9de89af0d6b62ffd602feee9d9ac90afc` |
|
| 87 |
+
|
| 88 |
+
`reconstruct_alignment_snapshot.py --check` 不依赖 `/root/.codex/sessions`,因此
|
| 89 |
+
launch 容器只需读取 NFS 上已冻结的 snapshot、内嵌的逆向 patch 和 manifest
|
| 90 |
+
hash 即可失败关闭。原始 session 仅在首次生成 snapshot 时要求存在。
|
| 91 |
+
|
| 92 |
+
## 语义差异
|
| 93 |
+
|
| 94 |
+
两个 code manifest 的共同文件中只有三个文件发生变化:
|
| 95 |
+
|
| 96 |
+
1. `gmnet/models/gmnet.py`
|
| 97 |
+
2. `gmnet/models/__init__.py`
|
| 98 |
+
3. `scripts/evaluate_imagenet_long.py`
|
| 99 |
+
|
| 100 |
+
其余差异都是 mechanism follow-up 新增的 config、protocol、smoke、deploy 和
|
| 101 |
+
audit 文件。formal spectral runner 是独立 runner,不应依赖旧版
|
| 102 |
+
`evaluate_imagenet_long.py`;该 evaluator 的变化主要为新 intervention 的
|
| 103 |
+
身份记录和 batch-derangement diagnostics。
|
| 104 |
+
|
| 105 |
+
模型源码中与 B/S/C 相关的精确语义如下:
|
| 106 |
+
|
| 107 |
+
| Arm | alignment 4a62 | current f6bd | 结论 |
|
| 108 |
+
|---|---|---|---|
|
| 109 |
+
| B / `baseline` | gate branch receives `x` | `value=x`, returns `value` | 相同 tensor 和 autograd path |
|
| 110 |
+
| S / `stop_gradient` | returns `x.detach()` | `value=x`, then `value.detach()` | 相同 detach boundary |
|
| 111 |
+
| C / `channel_derangement` | fixed seeded `index_select` | 同一 membership branch 和 `index_select` | permutation 与梯度相同 |
|
| 112 |
+
|
| 113 |
+
current 版本���增加:
|
| 114 |
+
|
| 115 |
+
- `batch_derangement` 分支;
|
| 116 |
+
- `stop_gradient_channel_derangement` 组合分支;
|
| 117 |
+
- 两个 intervention 集合常量;
|
| 118 |
+
- 新的只读 metadata 字段和 exports。
|
| 119 |
+
|
| 120 |
+
这些增量不改变 B/S/C 的参数、persistent state、forward 或 backward。两版 S3
|
| 121 |
+
均为 `7,791,544` parameters、`365` state tensors;checkpoint strict load schema
|
| 122 |
+
一致。
|
| 123 |
+
|
| 124 |
+
## 行为验证
|
| 125 |
+
|
| 126 |
+
本地证据文件:
|
| 127 |
+
|
| 128 |
+
```text
|
| 129 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/source_snapshots/alignment_4a62/
|
| 130 |
+
equivalence_evidence.local_torch2_10.json
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
验证条件为 Python 3.12.10、PyTorch 2.10.0+cu130、CPU 单线程、deterministic
|
| 134 |
+
algorithms。每个 arm 使用完整 GmNet-S3、同一 state dict、同一固定输入和同一
|
| 135 |
+
随机 loss projection,然后比较:
|
| 136 |
+
|
| 137 |
+
- logits:B/S/C 全部 bitwise equal;
|
| 138 |
+
- fixed random loss:全部 bitwise equal;
|
| 139 |
+
- input gradients:全部 bitwise equal;
|
| 140 |
+
- 245 个有梯度的 parameters:全部 bitwise equal;
|
| 141 |
+
- C 的 17 个非持久化 gate permutation buffers:全部 bitwise equal;
|
| 142 |
+
- 两版公共 intervention metadata projection:全部相同;
|
| 143 |
+
- stop-gradient 的解析梯度等于 `ReLU6(x.detach())` 对 carrier multiplier 的梯度,
|
| 144 |
+
且明确不同于 baseline 的完整 gate derivative。
|
| 145 |
+
|
| 146 |
+
本地 2.10 结果是源码语义证据,不替代正式 2.9 replay。
|
| 147 |
+
|
| 148 |
+
## Formal Deploy 方案
|
| 149 |
+
|
| 150 |
+
建议所有 5 个 arm 的 primary spectral instrumentation 统一运行当前 `f6bd`
|
| 151 |
+
源码,以避免两套 class/hook 实现带来新的测量差异;alignment snapshot 作为 S/C
|
| 152 |
+
的 executable oracle,而不是第二套 primary runner。
|
| 153 |
+
|
| 154 |
+
Arm 与训练源码的绑定必须保留:
|
| 155 |
+
|
| 156 |
+
| Arm | intervention | training code SHA256 |
|
| 157 |
+
|---|---|---|
|
| 158 |
+
| B | current baseline | `f6bd434a2ac8...bf9` |
|
| 159 |
+
| D | batch derangement | `f6bd434a2ac8...bf9` |
|
| 160 |
+
| S | stop gradient | `4a62bc483702...641f` |
|
| 161 |
+
| C | channel derangement | `4a62bc483702...641f` |
|
| 162 |
+
| SC | stop-gradient + channel derangement | `f6bd434a2ac8...bf9` |
|
| 163 |
+
|
| 164 |
+
正式 job 的 fail-closed 顺序应为:
|
| 165 |
+
|
| 166 |
+
1. 在 PyTorch 2.9.0+cu130 / torchvision 0.24.0+cu130 容器中验证当前
|
| 167 |
+
mechanism manifest 仍计算为 `f6bd...`。
|
| 168 |
+
2. 运行 `reconstruct_alignment_snapshot.py --check`,验证旧 snapshot 与内嵌
|
| 169 |
+
reverse patch 的字节一致性。
|
| 170 |
+
3. 运行 `test_alignment_source_equivalence.py`,保存
|
| 171 |
+
`equivalence_evidence.formal_torch2_9.json`;要求 B/S/C forward、input gradient
|
| 172 |
+
和所有 parameter gradients 的 `max_abs = 0`。
|
| 173 |
+
4. 对五个 checkpoints 做 strict state load,要求 parameter/state schema 与输入
|
| 174 |
+
manifest 完全匹配。
|
| 175 |
+
5. 用当前 `f6bd` runtime 对 S/C 完整重放 canonical 50K validation,batch size
|
| 176 |
+
256、固定 contiguous order、tail 80、FP32。
|
| 177 |
+
6. 将 replay 输出与各自旧版 `official_eval/per_sample.npz` 比较:
|
| 178 |
+
`sample_index`、`target`、`prediction`、`correct`、`top5_correct` 必须逐元素相同;
|
| 179 |
+
`confidence` 和 `nll` 应优先要求 bitwise 相同,若底层确定性限制导致差异,则
|
| 180 |
+
只能接受预注册的严格数值容差并记录 `max_abs`。
|
| 181 |
+
7. S replay 必须复现 Top-1 `38,387/50,000 = 76.774%`、Top-5
|
| 182 |
+
`46,679/50,000 = 93.358%`;C 必须复现 Top-1
|
| 183 |
+
`38,897/50,000 = 77.794%`、Top-5 `46,953/50,000 = 93.906%`。
|
| 184 |
+
8. 五个 arm 的真实 `unfiltered` transform bypass 都必须复现各自
|
| 185 |
+
frozen official count;Butterworth cutoff 1 不是 identity,不用作 replay
|
| 186 |
+
验收。通过 bypass 后才允许解释跨 arm spectral differences。
|
| 187 |
+
9. 最终结果记录两个训练 code manifests、snapshot manifest、audit runner、formal
|
| 188 |
+
equivalence evidence、checkpoint、data manifest 和输出文件的 SHA256。
|
| 189 |
+
|
| 190 |
+
建议 formal preflight 至少包含:
|
| 191 |
+
|
| 192 |
+
```bash
|
| 193 |
+
/tmp/gmnet_venv/bin/python \
|
| 194 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/scripts/reconstruct_alignment_snapshot.py \
|
| 195 |
+
--check
|
| 196 |
+
|
| 197 |
+
/tmp/gmnet_venv/bin/python \
|
| 198 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/scripts/test_alignment_source_equivalence.py \
|
| 199 |
+
--output /tmp/gmnet_alignment_equivalence_torch29.json
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
正式 wrapper 会先在 `/tmp` 生成该证据,输入验证通过后再将其复制为结果根目录的
|
| 203 |
+
`alignment_source_equivalence.json`。失败的等价测试不会进入数据 staging 或五臂
|
| 204 |
+
推理阶段。
|
| 205 |
+
|
| 206 |
+
## 判定规则
|
| 207 |
+
|
| 208 |
+
- formal 2.9 等价测试与 S/C 50K replay 均通过:可将 `f6bd` 作为统一 audit
|
| 209 |
+
runtime,并进行五臂 matched spectral interpretation。
|
| 210 |
+
- synthetic 等价测试通过,但 S/C 50K replay 任一 categorical array 不一致:停止
|
| 211 |
+
跨 arm 解释,先定位 data order、preprocessing、BN/eval mode 或 source import。
|
| 212 |
+
- formal 2.9 forward/backward 任一不相等:不能统一 source;S/C 必须单独使用
|
| 213 |
+
alignment snapshot 运行,并重新验证两套 instrumentation 的同义性。
|
| 214 |
+
- 只复现聚合 Top-1、未复现 per-sample prediction:不足以关闭 source-equivalence
|
| 215 |
+
风险。
|
| 216 |
+
|
| 217 |
+
## 已知边界
|
| 218 |
+
|
| 219 |
+
- 没有发现完整 alignment repository tarball;目前精确恢复并冻结的是 formal
|
| 220 |
+
runner 实际需要的两个 model files���
|
| 221 |
+
- `generate_e4_alignment_deploy.py --check` 在当前工作树失败是预期行为:它要求
|
| 222 |
+
全工作树仍为 `4a62`,而当前树已经合法前进到 `f6bd`。该失败不表示旧 checkpoint
|
| 223 |
+
或 snapshot 损坏。
|
| 224 |
+
- checkpoint 本身没有内嵌 code manifest hash;其训练来源由冻结的 approval、batch
|
| 225 |
+
manifest、config、checkpoint hash 和当时通过的 deploy guard 共同绑定。
|
| 226 |
+
- source equivalence 只关闭 B/S/C 已存在模型路径的实现差异,不消除单 seed、D 的
|
| 227 |
+
batch/order coupling 或 spectral metric 本身的统计限制。
|
gmnet/project/gmnet_tpami/GMNET_TPAMI_JOURNAL_EXTENSION_PLAN.md
ADDED
|
@@ -0,0 +1,1202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet Journal/TPAMI 扩展方案与实验执行手册
|
| 2 |
+
|
| 3 |
+
> 基于 **GmNet: Revisiting Gating Mechanisms From A Frequency View** 的 arXiv v3
|
| 4 |
+
>(2026-02-26,ICLR 2026 发表版)及公开代码仓库审读。
|
| 5 |
+
> 调研与方案冻结日期:2026-07-12。
|
| 6 |
+
|
| 7 |
+
## 0. 一页结论
|
| 8 |
+
|
| 9 |
+
### 0.1 推荐的 journal 核心叙事
|
| 10 |
+
|
| 11 |
+
会议版的主张是:
|
| 12 |
+
|
| 13 |
+
> GLU 中的逐元素乘法扩展频谱,非光滑激活有利于保留高频;基于此构造
|
| 14 |
+
> ReLU6 自门控的轻量网络 GmNet。
|
| 15 |
+
|
| 16 |
+
journal 版不应继续停留在“高频越多越好”,而应推进为:
|
| 17 |
+
|
| 18 |
+
> **Beyond High-Frequency Amplification: when and how gating creates, transfers,
|
| 19 |
+
> aliases, and selectively preserves task-relevant frequencies.**
|
| 20 |
+
|
| 21 |
+
建议形成三个相互闭环的新贡献:
|
| 22 |
+
|
| 23 |
+
1. **统一且严格的门控频谱理论**:区分输入图像空间频率、隐藏特征空间频率和模型函数频率;对离散自门控/双分支门控推导频谱传输、相关项、阈值穿越与 aliasing 条件。
|
| 24 |
+
2. **频谱可控的自适应门控**:从固定的 \(x\operatorname{ReLU6}(x)\) 升级为可控平滑度、可控截断幅值、按 stage/样本自适应的门控,在不执行 FFT 的前提下平衡有用细节与高频噪声。
|
| 25 |
+
3. **因果式频谱诊断和完整泛化验证**:不再只依赖高通/低通图像分类准确率;增加频带移除、频带扰动、输入到层输出的 spectral transfer matrix、函数频率、OOD/腐蚀/攻击、细粒度和边界/小目标任务。
|
| 26 |
+
|
| 27 |
+
这三项中,**理论 + 因果诊断为必选**;新门控应至少在 clean accuracy、
|
| 28 |
+
robustness 和 latency 三维 Pareto 上优于原始 GmNet。仅增加数据集、backbone、
|
| 29 |
+
激活函数或下游任务不足以构成强 journal 增量。
|
| 30 |
+
|
| 31 |
+
### 0.2 推荐题目(工作名)
|
| 32 |
+
|
| 33 |
+
- **Beyond High-Frequency Amplification: Spectrally Controllable Gating for Efficient and Robust Vision**
|
| 34 |
+
- **GmNet++: A Causal and Aliasing-Aware Frequency View of Gating Mechanisms**
|
| 35 |
+
- **When Does Gating Help? Spectral Transfer, Aliasing, and Adaptive Control in Efficient Vision Networks**
|
| 36 |
+
|
| 37 |
+
建议优先使用第一项,最终方法名暂称 **FreqCal-Gate**,投稿前再做名称检索。
|
| 38 |
+
不要使用 “Spectral Gating Network”,该名称和 Fourier/RFF gate 已被近期工作使用。
|
| 39 |
+
|
| 40 |
+
### 0.3 journal 成功的最低证据门槛
|
| 41 |
+
|
| 42 |
+
必须同时满足:
|
| 43 |
+
|
| 44 |
+
- 理论结论能在合成信号上被定量验证,而不只是重新陈述卷积定理;
|
| 45 |
+
- 新门控在严格同训练配方下,相比原始 GmNet-S3 至少满足以下之一:
|
| 46 |
+
- ImageNet-1K Top-1 提升 \(\ge 0.5\) 个百分点,mCE 不退化;
|
| 47 |
+
- Top-1 基本持平(差值 \(\ge -0.1\)),ImageNet-C mCE 相对改善 \(\ge 5\%\);
|
| 48 |
+
- clean/robust/latency Pareto 明显支配原始门控;
|
| 49 |
+
- 至少核心结论使用 3 个随机种子并报告置信区间;
|
| 50 |
+
- 新结论不依赖某一种硬圆形 Fourier mask;
|
| 51 |
+
- 在真实移动/边缘设备上,新增模块延迟开销不超过 5%,或用明确性能收益解释开销;
|
| 52 |
+
- 复现包能够重现 S1-S4、频谱分析、鲁棒性和下游实验。
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## 1. 对当前论文的基线理解
|
| 57 |
+
|
| 58 |
+
### 1.1 当前方法
|
| 59 |
+
|
| 60 |
+
GmNet block 可写为:
|
| 61 |
+
|
| 62 |
+
\[
|
| 63 |
+
Z=P_1(D_1(X)),\qquad
|
| 64 |
+
G(Z)=Z\odot \operatorname{ReLU6}(Z),
|
| 65 |
+
\]
|
| 66 |
+
|
| 67 |
+
\[
|
| 68 |
+
Y=X+\operatorname{DropPath}\left[
|
| 69 |
+
\gamma\odot D_2(P_2(G(Z)))
|
| 70 |
+
\right],
|
| 71 |
+
\]
|
| 72 |
+
|
| 73 |
+
其中 \(D_1,D_2\) 为 \(7\times7\) depthwise convolution,\(P_1,P_2\)
|
| 74 |
+
为 \(1\times1\) pointwise convolution。网络采用四阶段结构,每阶段开始以
|
| 75 |
+
\(3\times3\)、stride 2 卷积降采样。
|
| 76 |
+
|
| 77 |
+
| Variant | Width | Depth | Expansion | Params | FLOPs | ImageNet Top-1 |
|
| 78 |
+
|---|---:|---|---|---:|---:|---:|
|
| 79 |
+
| GmNet-S1 | 40 | [2,2,10,2] | [3,3,3,2] | 3.7M | 0.6G | 75.5 |
|
| 80 |
+
| GmNet-S2 | 48 | [2,2,8,3] | [3,3,3,2] | 6.2M | 0.9G | 78.3 |
|
| 81 |
+
| GmNet-S3 | 48 | [3,3,8,3] | [4,4,4,4] | 7.8M | 1.2G | 79.3 |
|
| 82 |
+
| GmNet-S4 | 68 | [3,3,11,3] | [4,4,4,4] | 17.0M | 2.7G | 81.5 |
|
| 83 |
+
|
| 84 |
+
### 1.2 v3 已经覆盖的内容
|
| 85 |
+
|
| 86 |
+
以下内容不能再单独作为 journal 新贡献:
|
| 87 |
+
|
| 88 |
+
- ImageNet-1K 分类和 S1-S4 速度/精度;
|
| 89 |
+
- ReLU、ReLU6、GELU、SiLU、SwiGLU;
|
| 90 |
+
- 多种 GLU 分支设计;
|
| 91 |
+
- ResNet-18、MobileNetV2、EfficientFormerV2、ConvNeXt;
|
| 92 |
+
- 高频/低频图像准确率和中间特征 H/L energy ratio;
|
| 93 |
+
- CIFAR-10 上一次 PGD 对比;
|
| 94 |
+
- CUB-100(协议不清楚);
|
| 95 |
+
- COCO Mask R-CNN 检测/实例分割;
|
| 96 |
+
- ADE20K Semantic FPN 语义分割;
|
| 97 |
+
- A100 与 iPhone 14 延迟。
|
| 98 |
+
|
| 99 |
+
### 1.3 当前最有价值的观察
|
| 100 |
+
|
| 101 |
+
- 原始门控 \(Z\operatorname{ReLU6}(Z)\) 在 ImageNet 上兼顾了较好的原图和高频图像准确率;
|
| 102 |
+
- GELU 更偏低频,ReLU 更偏高频,ReLU6 在当前设置中较平衡;
|
| 103 |
+
- 更强高频偏好并不自动带来鲁棒性:CIFAR-10 PGD 中 ReLU gate 比 GELU gate 低约 1 个点;
|
| 104 |
+
- ConvNeXt 上 GLU 仅带来约 0.5 点,说明门控效果具有架构/容量依赖;
|
| 105 |
+
- matched ablation 中 \(7\times7\) DWConv 带来的增益明显大于 gate 的独立增益,必须进一步解耦。
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## 2. 投稿前必须完成的基线与复现审计
|
| 110 |
+
|
| 111 |
+
这些问题会直接削弱 journal 可信度,应作为 Phase 0 处理,不应等写论文时再修。
|
| 112 |
+
|
| 113 |
+
### 2.1 论文内部不一致
|
| 114 |
+
|
| 115 |
+
| 项目 | 当前不一致 | 处理要求 |
|
| 116 |
+
|---|---|---|
|
| 117 |
+
| S3 准确率 | 引言 81.3%,主表/消融 79.3% | 回查 checkpoint 与日志,统一全文 |
|
| 118 |
+
| S3 对 EfficientFormer-L1 | 引言称 +4.0,按主表为 +2.1 | 全文自动检查算术 |
|
| 119 |
+
| S3 对 RepViT-M1.0 | 正文称 +1.9,按主表为 +0.7 | 修正 |
|
| 120 |
+
| S1 参数 | 主表 3.7M,CUB 表 3.1M | 重新导出模型统计 |
|
| 121 |
+
| CUB 数据 | 写作 “CUB-100”,非标准公开协议 | 明确是否为 CUB-200-2011 子集,发布 split |
|
| 122 |
+
| “五次 testing” | 确定性模型重复测试没有随机性定义 | 改为 seeds、crops 或 bootstrap,并写清楚 |
|
| 123 |
+
| kernel bandwidth | 没有严格定义 | 给算法、阈值、单位与敏感性 |
|
| 124 |
+
| PGD | 缺 \(\epsilon\)、步数、步长、随机起点 | 采用标准协议并补全 |
|
| 125 |
+
| 频率掩码 | 缺 DFT shift、通道、逆变换、归一化细节 | 发布统一评测实现 |
|
| 126 |
+
|
| 127 |
+
### 2.2 论文、README 与代码不一致
|
| 128 |
+
|
| 129 |
+
公开仓库当前只完整注册了 S3,且存在缺失 import/文件和部署脚本依赖:
|
| 130 |
+
|
| 131 |
+
- 论文 supplementary:weight decay 0.03、CutMix 0.4、S3/S4 DropPath 0.02;
|
| 132 |
+
- README:weight decay 0.05、CutMix 0.2、DropPath 0;
|
| 133 |
+
- README 的 benchmark 命令含 **.py.py** 拼写;
|
| 134 |
+
- 训练和部署脚本引用仓库中不存在或未提交的模块;
|
| 135 |
+
- 频谱分析、CIFAR、COCO、ADE20K、鲁棒性代码未公开;
|
| 136 |
+
- S1、S2、S4 配置/权重未在当前模型文件中完整提供。
|
| 137 |
+
|
| 138 |
+
### 2.3 Phase 0 交付物
|
| 139 |
+
|
| 140 |
+
1. 冻结 conference baseline tag,例如 **iclr2026-v3-repro**;
|
| 141 |
+
2. 单一 YAML 配方作为 truth source,论文表格由日志自动生成;
|
| 142 |
+
3. S1-S4 的 model registry、FLOPs/params 单元测试和 checkpoint;
|
| 143 |
+
4. 固定容器、依赖锁文件、数据校验 hash;
|
| 144 |
+
5. 训练、评测、频率干预、鲁棒性和部署脚本;
|
| 145 |
+
6. 每次实验保存 seed、git commit、数据版本、硬件、精度模式;
|
| 146 |
+
7. 先用 3 seeds 复现 S3,目标为论文值 \(\pm0.2\);
|
| 147 |
+
8. 建立结果 schema,禁止手工拷贝表格数字。
|
| 148 |
+
|
| 149 |
+
若 Phase 0 无法复现 79.3%,暂停新方法实验,先定位配方差异。
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
+
|
| 153 |
+
## 3. 当前科学论证的关键缺口
|
| 154 |
+
|
| 155 |
+
### 3.1 三种“频率”被混用
|
| 156 |
+
|
| 157 |
+
需要明确区分:
|
| 158 |
+
|
| 159 |
+
1. **图像空间频率**:二维像素坐标上的 DFT/DCT/wavelet 频率;
|
| 160 |
+
2. **隐藏特征空间频率**:每层 \(H\times W\) 特征图上的空间频率;
|
| 161 |
+
3. **模型函数频率**:分类函数沿输入空间方向变化的频率,经典 spectral bias
|
| 162 |
+
通常讨论这一项。
|
| 163 |
+
|
| 164 |
+
图像中高频多不等于分类函数学习了高函数频率,中间特征高频能量多也不等于
|
| 165 |
+
这些频率对标签有因果贡献。journal 必须统一定义,并分别设计指标。
|
| 166 |
+
|
| 167 |
+
### 3.2 卷积定理只给“可能扩频”,不给“有效扩频”
|
| 168 |
+
|
| 169 |
+
\[
|
| 170 |
+
\mathcal F(u\odot v)=\widehat u * \widehat v
|
| 171 |
+
\]
|
| 172 |
+
|
| 173 |
+
只能说明频谱支持可能变宽。它没有保证:
|
| 174 |
+
|
| 175 |
+
- 高频能量一定增加;
|
| 176 |
+
- 不同相位不会相消;
|
| 177 |
+
- 新频率位于 Nyquist 范围内;
|
| 178 |
+
- 新频率与类别标签有关;
|
| 179 |
+
- 新频率不会是噪声或 alias;
|
| 180 |
+
- 梯度下降会优先利用这些频率。
|
| 181 |
+
|
| 182 |
+
### 3.3 分析对象应是复合 gate,而非激活函数本身
|
| 183 |
+
|
| 184 |
+
实际算子是:
|
| 185 |
+
|
| 186 |
+
\[
|
| 187 |
+
q(x)=x\,\sigma(x).
|
| 188 |
+
\]
|
| 189 |
+
|
| 190 |
+
例如:
|
| 191 |
+
|
| 192 |
+
\[
|
| 193 |
+
x\operatorname{ReLU}(x)=\max(x,0)^2,
|
| 194 |
+
\]
|
| 195 |
+
|
| 196 |
+
它在零点处比 ReLU 本身更光滑;ReLU6 自门控还在 \(x=6\) 引入另一个拐点。
|
| 197 |
+
因此仅用 “ReLU 非光滑、GELU 光滑” 解释空间特征频率不充分。还需控制输出
|
| 198 |
+
均值/方差、梯度增益、阈值穿越率和 clipping。
|
| 199 |
+
|
| 200 |
+
### 3.4 连续 Fourier 推导与离散网络不匹配
|
| 201 |
+
|
| 202 |
+
网络处理有限离散网格。逐点乘法对应二维 **循环卷积**:
|
| 203 |
+
|
| 204 |
+
\[
|
| 205 |
+
\widehat{Y}[k]
|
| 206 |
+
=\frac{1}{HW}\sum_m
|
| 207 |
+
\widehat{U}[m]\,
|
| 208 |
+
\widehat{\sigma(V)}[(k-m)\bmod(H,W)].
|
| 209 |
+
\]
|
| 210 |
+
|
| 211 |
+
超出 Nyquist 的频率会折叠回来。会议版的 support doubling 例子忽略了
|
| 212 |
+
aliasing;也没有说明边界条件、window 和频谱泄漏。
|
| 213 |
+
|
| 214 |
+
### 3.5 当前频率评测主要是相关性
|
| 215 |
+
|
| 216 |
+
硬圆形频率掩码可能产生 ringing,band-only 图像也严重偏离训练分布。
|
| 217 |
+
“高频图像准确率更高”不能证明原图决策因高频而正确。必须增加保持语义且可
|
| 218 |
+
配对比较的频带干预和函数敏感性分析。
|
| 219 |
+
|
| 220 |
+
### 3.6 二阶映射、优化与频率效应尚未解耦
|
| 221 |
+
|
| 222 |
+
门控收益也可能来自:
|
| 223 |
+
|
| 224 |
+
- 二阶多项式特征扩张;
|
| 225 |
+
- 输出尺度/方差变化;
|
| 226 |
+
- 梯度流改变;
|
| 227 |
+
- \(7\times7\) DWConv;
|
| 228 |
+
- LayerScale/BN;
|
| 229 |
+
- 参数布局对硬件更友好。
|
| 230 |
+
|
| 231 |
+
因此需要 matched controls:\(x^2\)、ReLU\(^2\)、\(|x|\)、普通 ReLU6、
|
| 232 |
+
方差匹配激活、Jacobian 匹配、共享/独立投影门控。
|
| 233 |
+
|
| 234 |
+
---
|
| 235 |
+
|
| 236 |
+
## 4. 建议的新理论主线
|
| 237 |
+
|
| 238 |
+
### 4.1 统一门控形式
|
| 239 |
+
|
| 240 |
+
将常见门控写成:
|
| 241 |
+
|
| 242 |
+
\[
|
| 243 |
+
Y=U(X)\odot \phi(V(X)).
|
| 244 |
+
\]
|
| 245 |
+
|
| 246 |
+
覆盖:
|
| 247 |
+
|
| 248 |
+
- self gate:\(U=V=X\);
|
| 249 |
+
- independent GLU:\(U=W_uX,\ V=W_vX\);
|
| 250 |
+
- correlated/cross gate:两分支共享部分投影;
|
| 251 |
+
- StarNet 类纯乘法;
|
| 252 |
+
- GmNet 的 clipped self gate。
|
| 253 |
+
|
| 254 |
+
### 4.2 必做定理/命题
|
| 255 |
+
|
| 256 |
+
**T1:有限离散网格上的精确谱传输恒等式**
|
| 257 |
+
|
| 258 |
+
- 给出二维 DFT 的归一化、循环卷积和多通道形式;
|
| 259 |
+
- 给出 support expansion 与 alias-folding 的充分条件;
|
| 260 |
+
- 明确共享分支与独立分支的区别。
|
| 261 |
+
|
| 262 |
+
**T2:平稳随机场下的期望功率谱**
|
| 263 |
+
|
| 264 |
+
对归一化特征 \(V\) 做 Hermite/Volterra 展开:
|
| 265 |
+
|
| 266 |
+
\[
|
| 267 |
+
\phi(V)=\sum_{n\ge 0} c_n H_n(V).
|
| 268 |
+
\]
|
| 269 |
+
|
| 270 |
+
在零均值平稳高斯近似下,将输出 PSD 写成输入 PSD 的多重卷积加权和。
|
| 271 |
+
对 self gate 可利用
|
| 272 |
+
|
| 273 |
+
\[
|
| 274 |
+
xH_n(x)=H_{n+1}(x)+nH_{n-1}(x)
|
| 275 |
+
\]
|
| 276 |
+
|
| 277 |
+
得到复合 \(x\phi(x)\) 的系数。这样才能把激活形状、输入统计和空间频率联系起来。
|
| 278 |
+
|
| 279 |
+
**T3:高频信号与噪声增益界**
|
| 280 |
+
|
| 281 |
+
将 \(X=S+N\),给出门控后有用频段能量和噪声能量的上界/近似,显示:
|
| 282 |
+
|
| 283 |
+
- 非线性高阶系数增大时可能同时提高细节和噪声;
|
| 284 |
+
- clipping \(c\) 控制幅值增益;
|
| 285 |
+
- smoothness \(\tau\) 控制高阶系数衰减;
|
| 286 |
+
- 输入相关性/相干性决定交叉项是否有益。
|
| 287 |
+
|
| 288 |
+
**T4(可选):训练动态**
|
| 289 |
+
|
| 290 |
+
对简化网络或无限宽近似分析 NTK/eNTK eigenvalue decay 与 target alignment,
|
| 291 |
+
说明 Hadamard product 为什么可能更快拟合高函数频率。若无法给出严格证明,
|
| 292 |
+
只将其作为实证分析,不要写成定理。
|
| 293 |
+
|
| 294 |
+
### 4.3 理论必须给出的可证伪预测
|
| 295 |
+
|
| 296 |
+
1. 单频输入经 self gate 会出现哪些谐波;
|
| 297 |
+
2. 双频输入会出现哪些 sum/difference intermodulation;
|
| 298 |
+
3. 何时生成频率发生 Nyquist folding;
|
| 299 |
+
4. 阈值穿越率接近 0 时,ReLU/ReLU6/GELU 的差异应显著减小;
|
| 300 |
+
5. 输出方差匹配后,某些“高频优势”是否仍存在;
|
| 301 |
+
6. 分支相关性从 0 扫到 1 时,高频能量与可分类性如何变化;
|
| 302 |
+
7. 相同高频能量、不同 phase/coherence 时,准确率应不同。
|
| 303 |
+
|
| 304 |
+
### 4.4 理论边界
|
| 305 |
+
|
| 306 |
+
- 不要再声称“逐元素乘法必然增强高频”;
|
| 307 |
+
- 不要把激活标量函数的 Fourier transform 直接当成特征图频谱;
|
| 308 |
+
- 不要把“频谱支持更宽”直接等同于“表达能力/泛化更强”;
|
| 309 |
+
- 对 ReLU/GELU 在整条实轴上的 Fourier 变换需使用有限窗口、广义函数或
|
| 310 |
+
Hermite 展开,明确数学条件;
|
| 311 |
+
- “first” 表述必须收窄,因为已有 Hadamard-product spectral bias、激活依赖
|
| 312 |
+
spectral bias 和 spectral gating 相关理论。
|
| 313 |
+
|
| 314 |
+
---
|
| 315 |
+
|
| 316 |
+
## 5. 建议的新方法:FreqCal-Gate
|
| 317 |
+
|
| 318 |
+
### 5.1 设计目标
|
| 319 |
+
|
| 320 |
+
1. 把原始 ReLU6 看成“固定 smoothness + 固定 clipping”的一个点;
|
| 321 |
+
2. 按 stage 和样本调节细节/噪声平衡;
|
| 322 |
+
3. 推理时不使用 FFT/DCT;
|
| 323 |
+
4. 额外参数和 FLOPs 尽量低于 0.1%,实际延迟增幅低于 5%;
|
| 324 |
+
5. 能退化为原始 GmNet,便于公平 warm start 和消融。
|
| 325 |
+
|
| 326 |
+
### 5.2 可控平滑度的 clipped activation
|
| 327 |
+
|
| 328 |
+
定义温度化 Softplus:
|
| 329 |
+
|
| 330 |
+
\[
|
| 331 |
+
\operatorname{sp}_{\tau}(z)
|
| 332 |
+
=\tau\log(1+\exp(z/\tau)),
|
| 333 |
+
\]
|
| 334 |
+
|
| 335 |
+
再定义平滑 clipped linear unit:
|
| 336 |
+
|
| 337 |
+
\[
|
| 338 |
+
a_{\tau,c}(z)
|
| 339 |
+
=\operatorname{sp}_{\tau}(z)
|
| 340 |
+
-\operatorname{sp}_{\tau}(z-c).
|
| 341 |
+
\]
|
| 342 |
+
|
| 343 |
+
性质:
|
| 344 |
+
|
| 345 |
+
- \(\tau\to 0\) 时趋近 \(\operatorname{ReLU}_{c}(z)\);
|
| 346 |
+
- \(c=6,\tau\to0\) 时接近原始 ReLU6;
|
| 347 |
+
- \(\tau\) 控制拐点平滑度和高阶谱系数;
|
| 348 |
+
- \(c\) 控制饱和幅值和噪声放大上限。
|
| 349 |
+
|
| 350 |
+
新 self gate:
|
| 351 |
+
|
| 352 |
+
\[
|
| 353 |
+
G_{\tau,c}(Z)=Z\odot a_{\tau,c}(Z).
|
| 354 |
+
\]
|
| 355 |
+
|
| 356 |
+
实现应采用数值稳定的 softplus,\(\tau\) 和 \(c\) 通过有界参数化产生。
|
| 357 |
+
|
| 358 |
+
### 5.3 无 FFT 的频率/可靠性 proxy
|
| 359 |
+
|
| 360 |
+
对 stage 特征 \(Z_s\),使用固定 \(3\times3\) blur \(B\):
|
| 361 |
+
|
| 362 |
+
\[
|
| 363 |
+
L_s=B(Z_s),\qquad H_s=Z_s-L_s.
|
| 364 |
+
\]
|
| 365 |
+
|
| 366 |
+
构造低成本描述量:
|
| 367 |
+
|
| 368 |
+
\[
|
| 369 |
+
r_E=\log\frac{\mathbb E[H_s^2]+\epsilon}
|
| 370 |
+
{\mathbb E[L_s^2]+\epsilon},
|
| 371 |
+
\]
|
| 372 |
+
|
| 373 |
+
\[
|
| 374 |
+
r_C=\frac{\mathbb E[B(H_s)^2]+\epsilon}
|
| 375 |
+
{\mathbb E[H_s^2]+\epsilon},
|
| 376 |
+
\]
|
| 377 |
+
|
| 378 |
+
其中 \(r_E\) 表示相对高频能量,\(r_C\) 是粗略空间相干性;随机噪声和稳定边缘
|
| 379 |
+
即使能量相近,也可能具有不同相干性。可再选配阈值穿越率:
|
| 380 |
+
|
| 381 |
+
\[
|
| 382 |
+
r_T(c)=\Pr(Z_s<0)+\Pr(Z_s>c).
|
| 383 |
+
\]
|
| 384 |
+
|
| 385 |
+
控制器只用全局标量或 channel groups:
|
| 386 |
+
|
| 387 |
+
\[
|
| 388 |
+
(\tau_s,c_s)=h_s(r_E,r_C,r_T),
|
| 389 |
+
\]
|
| 390 |
+
|
| 391 |
+
\[
|
| 392 |
+
\tau_s\in[\tau_{\min},\tau_{\max}],\quad
|
| 393 |
+
c_s\in[c_{\min},c_{\max}].
|
| 394 |
+
\]
|
| 395 |
+
|
| 396 |
+
首版优先使用每个样本、每个 stage 两个标量;不要直接上逐像素动态频带图,
|
| 397 |
+
否则会与 FADC、FDConv 等方法重叠并增加部署成本。
|
| 398 |
+
|
| 399 |
+
### 5.4 训练目标
|
| 400 |
+
|
| 401 |
+
基础目标:
|
| 402 |
+
|
| 403 |
+
\[
|
| 404 |
+
\mathcal L_{\rm cls}
|
| 405 |
+
=\operatorname{CE}(f(x),y).
|
| 406 |
+
\]
|
| 407 |
+
|
| 408 |
+
构造语义保持的频谱扰动视图 \(x'\),包括 Fourier-basis noise、轻度 JPEG、
|
| 409 |
+
受控高频噪声、轻度 blur,但每批只采一种:
|
| 410 |
+
|
| 411 |
+
\[
|
| 412 |
+
\mathcal L_{\rm cons}
|
| 413 |
+
=\operatorname{JS}(p(x),p(x')).
|
| 414 |
+
\]
|
| 415 |
+
|
| 416 |
+
对明确注入高频噪声的配对样本,可加入弱排序约束,让控制器选择更平滑/更强
|
| 417 |
+
clipping,而不是硬编码所有频率:
|
| 418 |
+
|
| 419 |
+
\[
|
| 420 |
+
\mathcal L_{\rm cal}
|
| 421 |
+
=\max\{0,m-[\bar\tau(x')-\bar\tau(x)]\}.
|
| 422 |
+
\]
|
| 423 |
+
|
| 424 |
+
总损失:
|
| 425 |
+
|
| 426 |
+
\[
|
| 427 |
+
\mathcal L
|
| 428 |
+
=\mathcal L_{\rm cls}
|
| 429 |
+
+\lambda_{\rm cons}\mathcal L_{\rm cons}
|
| 430 |
+
+\lambda_{\rm cal}\mathcal L_{\rm cal}.
|
| 431 |
+
\]
|
| 432 |
+
|
| 433 |
+
所有方法对比必须使用相同频谱 augmentation;否则收益可能来自数据增强而非门控。
|
| 434 |
+
|
| 435 |
+
### 5.5 由简到繁的候选
|
| 436 |
+
|
| 437 |
+
| ID | Gate | 用途 |
|
| 438 |
+
|---|---|---|
|
| 439 |
+
| G0 | 原始 \(Z\operatorname{ReLU6}(Z)\) | conference baseline |
|
| 440 |
+
| G1 | 静态、每 stage 可学习 \((\tau,c)\) | 最低风险版本 |
|
| 441 |
+
| G2 | sample-stage adaptive \((\tau,c)\) | 推荐主模型 |
|
| 442 |
+
| G3 | group-wise adaptive \((\tau,c)\) | 容量上界 |
|
| 443 |
+
| G4 | GELU/ReLU6 混合 \(Z[(1-\alpha)\phi_s+\alpha\phi_{ns}]\) | 备选 |
|
| 444 |
+
| G5 | 显式 DCT/FFT band gate | 分析上界,不作为默认部署模型 |
|
| 445 |
+
|
| 446 |
+
筛选顺序为 G1 -> G2 -> G3/G4。只有 G2 无法形成 Pareto 改善时才测试 G4;
|
| 447 |
+
G5 只用于判断低成本 proxy 与显式频谱控制的差距。
|
| 448 |
+
|
| 449 |
+
### 5.6 新颖性定位
|
| 450 |
+
|
| 451 |
+
FreqCal-Gate 必须明确区别于:
|
| 452 |
+
|
| 453 |
+
- FADC/FDConv:它们动态调节卷积核或显式频带;本方法调节 GLU 复合非线性的
|
| 454 |
+
smoothness/clipping,并由门控谱传输理论推导;
|
| 455 |
+
- Spectral Gating Networks:后者增加 RFF/Fourier branch;本方法不增加
|
| 456 |
+
spectral basis,不做跨模态 FFN 替换;
|
| 457 |
+
- SpectFormer/Fourier gate:本方法推理时无 FFT;
|
| 458 |
+
- StarNet:后者强调高维乘法映射;本方法研究相关 self-gate 的可控谱传输和鲁棒性;
|
| 459 |
+
- 普通 dynamic activation:本方法的控制量、理论预测和评价均与频谱传输及 aliasing
|
| 460 |
+
对齐。
|
| 461 |
+
|
| 462 |
+
---
|
| 463 |
+
|
| 464 |
+
## 6. 研究问题与假设
|
| 465 |
+
|
| 466 |
+
| 编号 | 研究问题 | 可检验假设 |
|
| 467 |
+
|---|---|---|
|
| 468 |
+
| RQ1 | 乘法何时真正增加有效高频? | 由分支谱重叠、相关性、相位和阈值穿越共同决定,而非只由 support 决定 |
|
| 469 |
+
| RQ2 | 激活 smoothness 是否决定空间频谱? | 只在控制输入统计与复合 gate 后呈稳定关系 |
|
| 470 |
+
| RQ3 | ReLU6 为什么优于 ReLU/GELU? | clipping 限制噪声增益,非零拐点保留中高频;优势随分辨率与 stage 变化 |
|
| 471 |
+
| RQ4 | 高频准确率能否预测原图性能? | 单一 band-only accuracy 不够,因果频带移除和 transfer matrix 更有预测力 |
|
| 472 |
+
| RQ5 | 自适应门控能否打破 clean/robust trade-off? | reliability-aware smoothness/clipping 可保持细节并降低噪声敏感性 |
|
| 473 |
+
| RQ6 | 效果是否只来自二阶映射或 DWConv? | 在方差、梯度、参数、FLOPs 匹配后仍有独立 gate 增益 |
|
| 474 |
+
| RQ7 | 结论能否迁移? | 在轻量 CNN/Hybrid/SSM 和密集任务中趋势一致,但增益随容量衰减 |
|
| 475 |
+
|
| 476 |
+
---
|
| 477 |
+
|
| 478 |
+
## 7. 总体实验路线
|
| 479 |
+
|
| 480 |
+
### Phase 0:基线复现与协议冻结
|
| 481 |
+
|
| 482 |
+
**目标**:建立可信的 conference baseline。
|
| 483 |
+
|
| 484 |
+
步骤:
|
| 485 |
+
|
| 486 |
+
1. 修复公开代码 import、补齐 S1-S4;
|
| 487 |
+
2. 冻结唯一训练配置;
|
| 488 |
+
3. 在 ImageNet-1K 重训 S3,3 seeds;
|
| 489 |
+
4. 验证 params/FLOPs/throughput/latency;
|
| 490 |
+
5. 重现 Table 1、activation ablation 和 H/L 结果;
|
| 491 |
+
6. 检查频率变换的数值可逆性:
|
| 492 |
+
\(\|x-\mathcal F^{-1}\mathcal F(x)\|_\infty<10^{-5}\);
|
| 493 |
+
7. 发布频率评测单元测试和最小示例。
|
| 494 |
+
|
| 495 |
+
**通过条件**:Top-1 与 79.3 的差值不超过 0.2,3-seed std 合理,所有表格数值
|
| 496 |
+
可由日志自动生成。
|
| 497 |
+
|
| 498 |
+
### Phase 1:合成机制验证
|
| 499 |
+
|
| 500 |
+
**数据 A:单/双正弦**
|
| 501 |
+
|
| 502 |
+
\[
|
| 503 |
+
x(i,j)=A_1\sin(2\pi f_1^\top p+\varphi_1)
|
| 504 |
+
+A_2\sin(2\pi f_2^\top p+\varphi_2).
|
| 505 |
+
\]
|
| 506 |
+
|
| 507 |
+
扫描:
|
| 508 |
+
|
| 509 |
+
- 频率半径:0.05 到 0.95 Nyquist;
|
| 510 |
+
- 方向:0、30、45、60、90 度;
|
| 511 |
+
- 振幅:0.25、0.5、1、2;
|
| 512 |
+
- 相位差:0 到 \(2\pi\);
|
| 513 |
+
- 分支相关系数:0、0.25、0.5、0.75、1;
|
| 514 |
+
- feature mean/std 和 BN 前后状态;
|
| 515 |
+
- \(\tau,c\) 与 ReLU/GELU/ReLU6。
|
| 516 |
+
|
| 517 |
+
测量:
|
| 518 |
+
|
| 519 |
+
- 生成谐波的位置、幅值和相位;
|
| 520 |
+
- intermodulation \(f_1\pm f_2\);
|
| 521 |
+
- 理论 PSD 与实测 PSD 的相对误差;
|
| 522 |
+
- alias energy ratio;
|
| 523 |
+
- 阈值穿越率。
|
| 524 |
+
|
| 525 |
+
**数据 B:可控 PSD 随机场**
|
| 526 |
+
|
| 527 |
+
生成 \(S(f)\propto 1/f^\beta\),
|
| 528 |
+
\(\beta\in\{0,1,2,3\}\),再叠加结构化边缘或白噪声。验证相同 H/L energy、
|
| 529 |
+
不同 coherence 下 gate 的行为。
|
| 530 |
+
|
| 531 |
+
**数据 C:可控标签任务**
|
| 532 |
+
|
| 533 |
+
- 标签只由低频决定;
|
| 534 |
+
- 标签只由高频决定;
|
| 535 |
+
- 标签由低高频 conjunction 决定;
|
| 536 |
+
- 高频为伪相关 shortcut,测试分布翻转;
|
| 537 |
+
- 相同 amplitude、不同 phase 决定标签。
|
| 538 |
+
|
| 539 |
+
对比 baseline MLP/CNN、plain product、self gate、independent GLU 和新门控。
|
| 540 |
+
|
| 541 |
+
**通过条件**:
|
| 542 |
+
|
| 543 |
+
- T1/T2 预测与实测趋势一致;
|
| 544 |
+
- 能构造“高频能量增加但准确率下降”的反例;
|
| 545 |
+
- 新门控在 shortcut 翻转时比固定 ReLU6 更稳。
|
| 546 |
+
|
| 547 |
+
### Phase 2:低成本候选筛选
|
| 548 |
+
|
| 549 |
+
先用 CIFAR-100 或 ImageNet-100,不直接烧 ImageNet-1K。
|
| 550 |
+
|
| 551 |
+
筛选维度:
|
| 552 |
+
|
| 553 |
+
- G0-G5;
|
| 554 |
+
- static/stage/sample/group 控制粒度;
|
| 555 |
+
- \(r_E\)、\(r_C\)、\(r_T\) 的组合;
|
| 556 |
+
- \(\tau,c\) 范围;
|
| 557 |
+
- \(\lambda_{\rm cons},\lambda_{\rm cal}\);
|
| 558 |
+
- 仅 clean 训练 vs 同配方频谱增强。
|
| 559 |
+
|
| 560 |
+
每个候选 3 seeds,画 clean accuracy、corruption accuracy、latency 三维 Pareto。
|
| 561 |
+
不在 Pareto 前沿的设计立即��汰。
|
| 562 |
+
|
| 563 |
+
**升级到 Phase 3 的条件**:
|
| 564 |
+
|
| 565 |
+
- clean 不低于 G0 0.2 点;
|
| 566 |
+
- corruption error 相对改善至少 3%;
|
| 567 |
+
- 延迟开销小于 5%;
|
| 568 |
+
- controller 没有塌缩到固定边界值。
|
| 569 |
+
|
| 570 |
+
### Phase 3:ImageNet-1K 主实验
|
| 571 |
+
|
| 572 |
+
1. GmNet S1-S4 全尺度;
|
| 573 |
+
2. S2/S3 为主要 3-seed 尺度;
|
| 574 |
+
3. S1/S4 在结构冻结后至少 1 次完整训练,关键结果再补 seeds;
|
| 575 |
+
4. 统一 300 epochs、augment、optimizer、EMA/无 EMA;
|
| 576 |
+
5. 同时报告无频谱增强和统一频谱增强两套;
|
| 577 |
+
6. 报告 Top-1/Top-5、NLL、ECE、params、FLOPs、训练吞吐和推理延迟;
|
| 578 |
+
7. 用 paired bootstrap 比较逐图预测差异。
|
| 579 |
+
|
| 580 |
+
### Phase 4:因果频谱诊断
|
| 581 |
+
|
| 582 |
+
每个主模型至少完成:
|
| 583 |
+
|
| 584 |
+
1. soft band removal;
|
| 585 |
+
2. band-limited additive perturbation;
|
| 586 |
+
3. Fourier basis sensitivity heat map;
|
| 587 |
+
4. amplitude/phase recombination;
|
| 588 |
+
5. DFT、DCT、wavelet、Laplacian pyramid 一致性;
|
| 589 |
+
6. layer-wise radial PSD;
|
| 590 |
+
7. spectral entropy、centroid、roll-off;
|
| 591 |
+
8. spectral transfer matrix;
|
| 592 |
+
9. band-wise input Jacobian gain;
|
| 593 |
+
10. activation threshold crossing;
|
| 594 |
+
11. alias energy;
|
| 595 |
+
12. 局部函数频率或 eNTK target alignment(选一个可扩展实现)。
|
| 596 |
+
|
| 597 |
+
### Phase 5:鲁棒性、OOD 与线索偏好
|
| 598 |
+
|
| 599 |
+
详见第 9 节。核心不是追求 adversarial SOTA,而是验证“可控门控是否缓解
|
| 600 |
+
高频准确率与鲁棒性冲突”。
|
| 601 |
+
|
| 602 |
+
### Phase 6:高频敏感任务和下游任务
|
| 603 |
+
|
| 604 |
+
详见第 10 节。原有 COCO/ADE20K 总指标继续保留,但新增 AP_S、边界指标和
|
| 605 |
+
细粒度任务,直接对应论文机制。
|
| 606 |
+
|
| 607 |
+
### Phase 7:部署、量化和完整统计
|
| 608 |
+
|
| 609 |
+
详见第 11-12 节。冻结硬件、runtime、精度、batch、warmup 和测量次数。
|
| 610 |
+
|
| 611 |
+
### 7.1 可直接建表的实验 registry
|
| 612 |
+
|
| 613 |
+
| ID | 实验 | 数据/设置 | Primary endpoint | 重复 | 优先级 |
|
| 614 |
+
|---|---|---|---|---:|---|
|
| 615 |
+
| E0 | conference baseline 复现 | GmNet-S2/S3, ImageNet-1K | Top-1、params、latency | 3 seeds | 必做 |
|
| 616 |
+
| E1 | 频率测量审计 | 硬/软 FFT、DCT、wavelet | Frequency-Accuracy AUC、重构误差 | 3 seeds | 必做 |
|
| 617 |
+
| E2 | 合成谱机制 | 正弦、随机场、线索冲突 | 谱传输误差、alias ratio、cue reliance | 5 seeds | 必做 |
|
| 618 |
+
| E3 | composite gate 光滑度 | RePU/Softplus/capped-ReLU | PSD slope、Frequency-AUC、clean/mCE | 3-5 seeds | 核心 |
|
| 619 |
+
| E4 | gate 因果干预 | self/independent/shuffle/stop-grad | gate-input coherence、Top-1、transfer | 3-5 seeds | 核心 |
|
| 620 |
+
| E5 | stage/capacity law | S1-S4、逐 stage 插入 | gain vs log(params) slope | 3 seeds | 必做 |
|
| 621 |
+
| E6 | corruption/stability | ImageNet-C/P、shift、JPEG | mCE、mFR、ECE | frozen models | 必做 |
|
| 622 |
+
| E7 | natural shift | IN-V2/A/R/Sketch/ObjectNet | mean OOD、relative retention | frozen models | 必做 |
|
| 623 |
+
| E8 | adversarial | AutoAttack、low/mid/high attacks | robust acc、worst-band acc | 3 seeds/5k 起 | 必做 |
|
| 624 |
+
| E9 | semantic OOD | NINCO,Energy/MSP | AUROC、FPR95 | 3 seed models | 可选核心 |
|
| 625 |
+
| E10 | fine-grained | CUB-200、Aircraft、Cars/DTD | Top-1 与频率需求指数相关性 | 3 seeds | 次核心 |
|
| 626 |
+
| E11 | boundary/small object | COCO、ADE/Cityscapes | AP_S、AP75、Boundary IoU/F | 3 seeds | 次核心 |
|
| 627 |
+
| E12 | deployment | GPU/CPU/iPhone/Jetson, FP16/INT8 | p50/p95、memory、energy | 5 processes | 必做 |
|
| 628 |
+
|
| 629 |
+
每个 ID 在配置、日志、表格和论文图中保持一致,例如 **E3-G2-S3-seed1**。
|
| 630 |
+
建议 primary endpoints 预先冻结为:ImageNet Top-1、Frequency-Accuracy AUC、
|
| 631 |
+
ImageNet-C mCE、自然偏移平均准确率、目标设备 p50 latency。
|
| 632 |
+
|
| 633 |
+
---
|
| 634 |
+
|
| 635 |
+
## 8. 主实验与 baseline 矩阵
|
| 636 |
+
|
| 637 |
+
### 8.1 模型 baseline
|
| 638 |
+
|
| 639 |
+
所有延迟必须在同一硬件、同一导出链上重测;不能直接拼接各论文设备数字。
|
| 640 |
+
|
| 641 |
+
| 类别 | 建议模型 |
|
| 642 |
+
|---|---|
|
| 643 |
+
| 经典轻量 CNN | MobileNetV2/V4、MobileOne、FasterNet |
|
| 644 |
+
| 现代轻量 CNN | StarNet、RapidNet、RepViT、LSNet |
|
| 645 |
+
| Hybrid/attention | EfficientFormerV2、SHViT、CARE |
|
| 646 |
+
| SSM | MobileMamba、EfficientViM |
|
| 647 |
+
| 频率相关 | FcaNet、FADC adapter、GFNet 或同预算 spectral baseline |
|
| 648 |
+
| 门控相关 | GEGLU、ReGLU、SwiGLU、StarNet-style product |
|
| 649 |
+
| 本文 | GmNet G0、G1、G2,必要时 G3/G4/G5 |
|
| 650 |
+
|
| 651 |
+
核心主表不宜超过 20 个模型;其余放 supplement。优先选择公开 checkpoint 且能统一
|
| 652 |
+
导出的模型。
|
| 653 |
+
|
| 654 |
+
### 8.2 严格 matched controls
|
| 655 |
+
|
| 656 |
+
对 GmNet-S3 block 在 params/FLOPs/实际 latency 匹配下比较:
|
| 657 |
+
|
| 658 |
+
- \(x\);
|
| 659 |
+
- ReLU、ReLU6、GELU;
|
| 660 |
+
- \(x^2\);
|
| 661 |
+
- \(|x|\);
|
| 662 |
+
- ReLU\(^2\);
|
| 663 |
+
- \(x\operatorname{ReLU}(x)\);
|
| 664 |
+
- \(x\operatorname{ReLU6}(x)\);
|
| 665 |
+
- 输出 mean/variance 匹配版本;
|
| 666 |
+
- Jacobian RMS 匹配版本;
|
| 667 |
+
- self/independent/correlated gate;
|
| 668 |
+
- 去掉第一/第二个 \(7\times7\) DWConv;
|
| 669 |
+
- kernel size 3/5/7/9;
|
| 670 |
+
- 加/不加 BN、LayerScale。
|
| 671 |
+
|
| 672 |
+
#### 连续光滑度与截断扫描
|
| 673 |
+
|
| 674 |
+
不要只再枚举两个 activation,应构造可排序的函数族:
|
| 675 |
+
|
| 676 |
+
- RePU:\(p\in\{1,2,3,4\}\),控制复合算子的有限可微阶数;
|
| 677 |
+
- Softplus:\(\beta\in\{1,2,5,10,20\}\),连续逼近 ReLU;
|
| 678 |
+
- capped-ReLU:\(c\in\{1,3,6,\infty\}\),定位 clipping 的作用;
|
| 679 |
+
- FreqCal-Gate:扫描 \(\tau,c\) 并与上述固定族对齐。
|
| 680 |
+
|
| 681 |
+
所有 gate 在标准正态输入下校准输出 mean/variance,并记录每层
|
| 682 |
+
\(Z<0\)、\(0<Z<c\)、\(Z\ge c\) 的比例。检验 composite gate 的谱衰减斜率、
|
| 683 |
+
Frequency-AUC、clean accuracy 与 mCE 是否存在稳定的相关或倒 U 关系。
|
| 684 |
+
|
| 685 |
+
#### gate 因果干预
|
| 686 |
+
|
| 687 |
+
在不改变训练参数量的情况下加入:
|
| 688 |
+
|
| 689 |
+
- 在 batch 维 shuffle gate;
|
| 690 |
+
- 在空间维 shuffle gate;
|
| 691 |
+
- 在 channel 维 shuffle gate;
|
| 692 |
+
- 用样本平均 gate 替换;
|
| 693 |
+
- 对 feature branch 或 gate branch stop-gradient;
|
| 694 |
+
- 对齐分支与独立投影分支;
|
| 695 |
+
- 保留幅值但随机化 gate phase;
|
| 696 |
+
- gate 输出方差恢复到 baseline。
|
| 697 |
+
|
| 698 |
+
如果 shuffle 后频谱能量仍高但任务收益消失,可直接说明“能量”并不足够,
|
| 699 |
+
feature-gate alignment/coherence 才是有效调制的必要条件。
|
| 700 |
+
|
| 701 |
+
### 8.3 训练公平性
|
| 702 |
+
|
| 703 |
+
- architecture comparison 使用各方法官方 recipe 和统一 recipe 两张表;
|
| 704 |
+
- mechanism ablation 必须全部统一 recipe;
|
| 705 |
+
- distillation、EMA、reparameterization、resolution 分栏;
|
| 706 |
+
- 不得将使用蒸馏的 baseline 与无蒸馏方法混在同一结论中;
|
| 707 |
+
- 每个结果记录训练总算力,避免用更强增强掩盖结构贡献。
|
| 708 |
+
|
| 709 |
+
---
|
| 710 |
+
|
| 711 |
+
## 9. 频谱诊断、鲁棒性与 OOD 实验
|
| 712 |
+
|
| 713 |
+
### 9.1 改进频率干预协议
|
| 714 |
+
|
| 715 |
+
硬径向 mask 仅保留为历史对照。主协议使用:
|
| 716 |
+
|
| 717 |
+
- Gaussian/Butterworth soft low/high/band-pass;
|
| 718 |
+
- 等能量 annular bands;
|
| 719 |
+
- DCT block frequency;
|
| 720 |
+
- Haar/Daubechies wavelet;
|
| 721 |
+
- Laplacian pyramid;
|
| 722 |
+
- Fourier amplitude 与 phase 分离。
|
| 723 |
+
|
| 724 |
+
cutoff 使用 Nyquist 归一化比例而非固定像素 radius,使不同分辨率/层可比较。
|
| 725 |
+
所有 filtered image 报告 PSNR/SSIM/LPIPS 或能量保留率,避免比较不同扰动强度。
|
| 726 |
+
|
| 727 |
+
### 9.2 因果指标
|
| 728 |
+
|
| 729 |
+
**Band removal importance**
|
| 730 |
+
|
| 731 |
+
\[
|
| 732 |
+
I_b=\operatorname{Acc}(x)-\operatorname{Acc}(x\setminus b).
|
| 733 |
+
\]
|
| 734 |
+
|
| 735 |
+
**Band perturbation sensitivity**
|
| 736 |
+
|
| 737 |
+
\[
|
| 738 |
+
S_b=\mathbb E\left[
|
| 739 |
+
\|f(x+\delta_b)-f(x)\|_2/\|\delta_b\|_2
|
| 740 |
+
\right].
|
| 741 |
+
\]
|
| 742 |
+
|
| 743 |
+
**Spectral transfer matrix**
|
| 744 |
+
|
| 745 |
+
对输入频带 \(b_{\rm in}\) 施加小扰动,在层 \(l\) 测输出频带
|
| 746 |
+
\(b_{\rm out}\) 响应:
|
| 747 |
+
|
| 748 |
+
\[
|
| 749 |
+
T_l(b_{\rm out},b_{\rm in})
|
| 750 |
+
=\frac{\|\Pi_{b_{\rm out}}
|
| 751 |
+
[h_l(x+\delta_{b_{\rm in}})-h_l(x)]\|_2}
|
| 752 |
+
{\|\delta_{b_{\rm in}}\|_2}.
|
| 753 |
+
\]
|
| 754 |
+
|
| 755 |
+
该矩阵可区分“原有频率传递”“新谐波生成”和“alias 回折”。
|
| 756 |
+
|
| 757 |
+
### 9.3 Common corruption
|
| 758 |
+
|
| 759 |
+
使用 ImageNet-C severity 1-5,报告:
|
| 760 |
+
|
| 761 |
+
- accuracy per corruption/severity;
|
| 762 |
+
- mCE;
|
| 763 |
+
- noise / blur / weather / digital 四组;
|
| 764 |
+
- worst-group accuracy;
|
| 765 |
+
- 与 clean accuracy 的 Pareto。
|
| 766 |
+
|
| 767 |
+
补充 ImageNet-P 或受控连续平移/缩放,报告 mean Flip Rate (mFR),检验高频门控
|
| 768 |
+
对轻微输入变化的稳定性。
|
| 769 |
+
|
| 770 |
+
重点验证:
|
| 771 |
+
|
| 772 |
+
- noise 类高频扰动是否改善;
|
| 773 |
+
- blur/contrast 等低频扰动是否因抑制高频而退化;
|
| 774 |
+
- 新门控是否减少上述 trade-off。
|
| 775 |
+
|
| 776 |
+
### 9.4 自然分布偏移
|
| 777 |
+
|
| 778 |
+
- ImageNet-V2;
|
| 779 |
+
- ImageNet-A;
|
| 780 |
+
- ImageNet-R;
|
| 781 |
+
- ImageNet-Sketch;
|
| 782 |
+
- ObjectNet(若 license/映射可用)。
|
| 783 |
+
|
| 784 |
+
报告原始 accuracy、相对 retention
|
| 785 |
+
\(\operatorname{Acc}_{OOD}/\operatorname{Acc}_{clean}\) 和 ECE。
|
| 786 |
+
|
| 787 |
+
语义 OOD 若纳入,优先使用 NINCO;以 ImageNet-O 仅作历史对照。使用 MSP 与
|
| 788 |
+
Energy 两种无额外训练分数,阈值和温度只能在 ID validation/独立 validation
|
| 789 |
+
上确定,报告 AUROC、AUPR-Out、FPR95。不要把语义 OOD 与 ImageNet-C
|
| 790 |
+
covariate shift 混为同一结论。
|
| 791 |
+
|
| 792 |
+
### 9.5 对抗鲁棒性
|
| 793 |
+
|
| 794 |
+
分两类:
|
| 795 |
+
|
| 796 |
+
1. 标准 AutoAttack:\(L_\infty\) 与 \(L_2\) 至少各一个标准预算;
|
| 797 |
+
2. frequency-constrained attack:低/中/高频分别约束相同 \(L_2\) 能量。
|
| 798 |
+
|
| 799 |
+
报告 clean、PGD、AutoAttack、band-wise attack、attack success spectrum。
|
| 800 |
+
必须排查梯度遮蔽:增加多步数、随机重启、black-box transfer 和 loss landscape。
|
| 801 |
+
|
| 802 |
+
### 9.6 shape/texture 与可控线索
|
| 803 |
+
|
| 804 |
+
可使用 Stylized-ImageNet/cue-conflict 作为历史指标,但不能只凭 forced-choice
|
| 805 |
+
shape-bias 得出结论。补充:
|
| 806 |
+
|
| 807 |
+
- shape/texture/color 分别受控抑制;
|
| 808 |
+
- 正交线索合成数据;
|
| 809 |
+
- 纹理是 label signal 和纹理是 shortcut 两种设置;
|
| 810 |
+
- 同 amplitude、换 phase 的配对图像。
|
| 811 |
+
|
| 812 |
+
报告 shape、texture、color 各自 causal importance,而不是单一 shape bias。
|
| 813 |
+
|
| 814 |
+
---
|
| 815 |
+
|
| 816 |
+
## 10. 下游与高频敏感任务
|
| 817 |
+
|
| 818 |
+
### 10.1 细粒度分类
|
| 819 |
+
|
| 820 |
+
至少选择两个:
|
| 821 |
+
|
| 822 |
+
- CUB-200-2011(不要再使用未解释的 CUB-100);
|
| 823 |
+
- FGVC-Aircraft;
|
| 824 |
+
- Stanford Cars;
|
| 825 |
+
- iNaturalist 子集或完整集。
|
| 826 |
+
|
| 827 |
+
指标:Top-1、macro-F1、per-class recall。额外按对象尺寸、纹理丰富度或边缘密度分组。
|
| 828 |
+
|
| 829 |
+
### 10.2 目标检测/实例分割
|
| 830 |
+
|
| 831 |
+
COCO 使用至少两个框架以排除 head 偶然性:
|
| 832 |
+
|
| 833 |
+
- Mask R-CNN;
|
| 834 |
+
- RetinaNet、Cascade Mask R-CNN 或现代轻量 detector 选一。
|
| 835 |
+
|
| 836 |
+
报告:
|
| 837 |
+
|
| 838 |
+
- AP、AP50、AP75;
|
| 839 |
+
- AP_S、AP_M、AP_L;
|
| 840 |
+
- mask AP;
|
| 841 |
+
- boundary AP/Boundary IoU;
|
| 842 |
+
- backbone latency 与 end-to-end latency。
|
| 843 |
+
|
| 844 |
+
最关键预测:若高频细节真正更好,收益应更集中于 AP_S、AP75 和 boundary 指标。
|
| 845 |
+
|
| 846 |
+
### 10.3 语义分割
|
| 847 |
+
|
| 848 |
+
- ADE20K:保留;
|
| 849 |
+
- Cityscapes:新增,边界和细结构更适合验证;
|
| 850 |
+
- decoder 至少用 Semantic FPN + UPerNet/DeepLabV3 之一。
|
| 851 |
+
|
| 852 |
+
指标:mIoU、boundary IoU、trimap F-score、FPS/latency。
|
| 853 |
+
|
| 854 |
+
### 10.4 可选任务
|
| 855 |
+
|
| 856 |
+
资源允许时选择一个:
|
| 857 |
+
|
| 858 |
+
- keypoint estimation:细粒度定位;
|
| 859 |
+
- edge/contour detection;
|
| 860 |
+
- low-light/night detection;
|
| 861 |
+
- tiny object detection。
|
| 862 |
+
|
| 863 |
+
不要同时铺开视频、音频、PDE 和 VLM。跨模态已被近期 spectral gating 工作覆盖,
|
| 864 |
+
且会稀释 TPAMI 的视觉主线。
|
| 865 |
+
|
| 866 |
+
---
|
| 867 |
+
|
| 868 |
+
## 11. 效率、部署与量化
|
| 869 |
+
|
| 870 |
+
### 11.1 测量平台
|
| 871 |
+
|
| 872 |
+
最低配置:
|
| 873 |
+
|
| 874 |
+
- NVIDIA A100 或 H100:TensorRT/ONNX Runtime;
|
| 875 |
+
- x86 CPU:单线程与固定多线程;
|
| 876 |
+
- Apple iPhone 14/更新机型:CoreML,明确 CPU/GPU/ANE;
|
| 877 |
+
- Jetson Orin Nano/NX 或 Android Snapdragon 设备二选一。
|
| 878 |
+
|
| 879 |
+
### 11.2 统一协议
|
| 880 |
+
|
| 881 |
+
- batch size 1 为主,补 batch 16/32 吞吐;
|
| 882 |
+
- 固定 input 224,另测 160/256/384 scaling;
|
| 883 |
+
- warmup 100-200 次,正式 1000 次;
|
| 884 |
+
- 报 median、p90/p95、mean ± std;
|
| 885 |
+
- 锁频或记录功耗/温度;
|
| 886 |
+
- FP32、FP16;移动端增加 INT8;
|
| 887 |
+
- 记录编译时间,但不计入 inference;
|
| 888 |
+
- 报 peak memory、model size、activation memory、energy/image。
|
| 889 |
+
|
| 890 |
+
### 11.3 量化
|
| 891 |
+
|
| 892 |
+
ReLU6 的实际优势可能来自有限动态范围,因此量化是很有价值的 supporting evidence:
|
| 893 |
+
|
| 894 |
+
- FP32/FP16/PTQ-INT8/QAT-INT8;
|
| 895 |
+
- per-tensor vs per-channel;
|
| 896 |
+
- accuracy drop、calibration samples、latency、模型大小;
|
| 897 |
+
- 比较 ReLU6、GELU、G1/G2;
|
| 898 |
+
- 检查动态 \(\tau,c\) 是否阻碍算子融合或 INT8 kernel。
|
| 899 |
+
|
| 900 |
+
若 G2 无法高效量化,保留静态 G1 作为 deployment variant。
|
| 901 |
+
|
| 902 |
+
---
|
| 903 |
+
|
| 904 |
+
## 12. 统计设计与报告规范
|
| 905 |
+
|
| 906 |
+
### 12.1 seeds
|
| 907 |
+
|
| 908 |
+
- 合成/CIFAR/ImageNet-100:至少 5 seeds;
|
| 909 |
+
- ImageNet-S2/S3 核心结论:至少 3 seeds;
|
| 910 |
+
- S1/S4 扩展尺度:初筛 1 seed,最终关键表补到 3;
|
| 911 |
+
- 下游核心模型:至少 3 seeds 或 3 独立 fine-tuning;
|
| 912 |
+
- 设备延迟:同一导出模型多次重复,不把推理重复当训练 seed。
|
| 913 |
+
|
| 914 |
+
### 12.2 置信区间与检验
|
| 915 |
+
|
| 916 |
+
- 报 mean ± std;
|
| 917 |
+
- validation images 上 paired bootstrap 95% CI;
|
| 918 |
+
- 同 seed 配对比较优先用 paired test;
|
| 919 |
+
- 多模型/多数据集同时检验时做 Holm 校正;
|
| 920 |
+
- 同时报告效应量,不只报 p-value;
|
| 921 |
+
- corruption 以 corruption type 为统计单元,避免把 50k 图像伪装成独立机制重复。
|
| 922 |
+
|
| 923 |
+
### 12.3 Pareto 分析
|
| 924 |
+
|
| 925 |
+
至少绘制:
|
| 926 |
+
|
| 927 |
+
- Top-1 vs latency;
|
| 928 |
+
- Top-1 vs params/FLOPs;
|
| 929 |
+
- clean vs mCE;
|
| 930 |
+
- clean vs AutoAttack;
|
| 931 |
+
- robust accuracy vs latency;
|
| 932 |
+
- boundary/AP_S vs end-to-end latency。
|
| 933 |
+
|
| 934 |
+
可以报告 Pareto frontier 和 hypervolume,但不要用自定义综合分数掩盖单项退化。
|
| 935 |
+
|
| 936 |
+
### 12.4 失败案例
|
| 937 |
+
|
| 938 |
+
必须展示:
|
| 939 |
+
|
| 940 |
+
- 高频能量提高但分类变差;
|
| 941 |
+
- JPEG、白噪声、细线、重复纹理;
|
| 942 |
+
- 小目标、边界和低对比大结构;
|
| 943 |
+
- controller 误判有用纹理为噪声;
|
| 944 |
+
- 高分辨率与低分辨率相反趋势;
|
| 945 |
+
- ReLU6 在 CIFAR 和 ImageNet 趋势不一致的解释。
|
| 946 |
+
|
| 947 |
+
---
|
| 948 |
+
|
| 949 |
+
## 13. 消融清单
|
| 950 |
+
|
| 951 |
+
### 13.1 理论对应消融
|
| 952 |
+
|
| 953 |
+
- activation 与 composite gate 分开;
|
| 954 |
+
- threshold crossing rate;
|
| 955 |
+
- \(\tau\) 单独变化;
|
| 956 |
+
- \(c\) 单独变化;
|
| 957 |
+
- 输出 mean/std matched;
|
| 958 |
+
- Jacobian RMS matched;
|
| 959 |
+
- 分支 correlation scan;
|
| 960 |
+
- phase scan;
|
| 961 |
+
- Nyquist distance scan;
|
| 962 |
+
- DFT boundary/window 选择。
|
| 963 |
+
|
| 964 |
+
### 13.2 控制器消融
|
| 965 |
+
|
| 966 |
+
- 无 controller;
|
| 967 |
+
- 仅 stage 参数;
|
| 968 |
+
- sample-stage;
|
| 969 |
+
- channel group;
|
| 970 |
+
- \(r_E\) only;
|
| 971 |
+
- \(r_C\) only;
|
| 972 |
+
- \(r_E+r_C\);
|
| 973 |
+
- 加/不加 \(r_T\);
|
| 974 |
+
- controller depth/hidden width;
|
| 975 |
+
- 使用显式 DCT descriptor 的上界。
|
| 976 |
+
|
| 977 |
+
### 13.3 loss 消融
|
| 978 |
+
|
| 979 |
+
- CE;
|
| 980 |
+
- CE + 同配方 frequency augmentation;
|
| 981 |
+
- + consistency;
|
| 982 |
+
- + calibration rank;
|
| 983 |
+
- 不同 \(\lambda\)、margin;
|
| 984 |
+
- corruption type leave-one-out,验证不是记忆训练噪声。
|
| 985 |
+
|
| 986 |
+
### 13.4 插入位置
|
| 987 |
+
|
| 988 |
+
- 仅 stage 1;
|
| 989 |
+
- stage 1-2;
|
| 990 |
+
- stage 1-3;
|
| 991 |
+
- 全 stage;
|
| 992 |
+
- 仅 downsampling 前;
|
| 993 |
+
- 仅高分辨率 block;
|
| 994 |
+
- 每 block vs 每 stage 共享 controller。
|
| 995 |
+
|
| 996 |
+
### 13.5 架构与容量
|
| 997 |
+
|
| 998 |
+
- S1-S4;
|
| 999 |
+
- ResNet-18/50;
|
| 1000 |
+
- MobileNetV2/V4;
|
| 1001 |
+
- ConvNeXt-T;
|
| 1002 |
+
- EfficientFormer/CARE;
|
| 1003 |
+
- 选择一个轻量 SSM;
|
| 1004 |
+
- 参数/FLOPs/latency 严格匹配。
|
| 1005 |
+
|
| 1006 |
+
---
|
| 1007 |
+
|
| 1008 |
+
## 14. Go/No-Go 决策树
|
| 1009 |
+
|
| 1010 |
+
### Gate A:理论是否站得住
|
| 1011 |
+
|
| 1012 |
+
- 若精确 DFT/aliasing 可验证,但 Hermite PSD 与真实 feature 偏差大:
|
| 1013 |
+
保留 T1,T2 明确为近似并增加 empirical calibration;
|
| 1014 |
+
- 若 smoothness 与输出谱无稳定关系:
|
| 1015 |
+
不再以 smoothness 为主方法,转向 threshold crossing + clipping/noise bound;
|
| 1016 |
+
- 若 function frequency 与 image/feature frequency 无相关:
|
| 1017 |
+
将三者差异本身作为重要发现,不强行统一为一个指标。
|
| 1018 |
+
|
| 1019 |
+
### Gate B:方法是否有效
|
| 1020 |
+
|
| 1021 |
+
- G1 有效、G2 无效:采用静态 stage-wise controllable gate;
|
| 1022 |
+
- G2 clean 提升但 robustness 退化:增加 calibration/consistency,仍失败则不宣称
|
| 1023 |
+
打破 trade-off;
|
| 1024 |
+
- G2 robust 提升但 latency >5%:简化为 affine scalar controller 或 deployment G1;
|
| 1025 |
+
- 新方法不优于 G0:journal 改为“理论 + 因果 benchmark + 原始 GmNet 的边界条件”,
|
| 1026 |
+
但投稿竞争力会下降。
|
| 1027 |
+
|
| 1028 |
+
### Gate C:主张能否泛化
|
| 1029 |
+
|
| 1030 |
+
- 只在 GmNet 有效:把论文定位为 GmNet++,不要宣称通用 GLU 原理;
|
| 1031 |
+
- 在 CNN 有效、Transformer/SSM 无效:解释 inductive bias/capacity 条件;
|
| 1032 |
+
- 只在 classification 有效:不能把 COCO/ADE20K 旧结果当充分泛化证据;
|
| 1033 |
+
- AP_S/boundary 无收益:重新审视“高频细节促进密集预测”的主张。
|
| 1034 |
+
|
| 1035 |
+
---
|
| 1036 |
+
|
| 1037 |
+
## 15. 资源预算与排期
|
| 1038 |
+
|
| 1039 |
+
以下为相对保守估计,实际以 Phase 0 的吞吐实测更新。
|
| 1040 |
+
|
| 1041 |
+
### 15.1 计算预算
|
| 1042 |
+
|
| 1043 |
+
| 阶段 | 建议预算 |
|
| 1044 |
+
|---|---:|
|
| 1045 |
+
| Phase 0 复现与代码审计 | 400-800 A100 GPU-hours |
|
| 1046 |
+
| 合成/CIFAR/ImageNet-100 | 300-700 GPU-hours |
|
| 1047 |
+
| ImageNet-1K 候选与 3 seeds | 2,000-3,500 GPU-hours |
|
| 1048 |
+
| robustness/OOD 评测 | 200-500 GPU-hours |
|
| 1049 |
+
| COCO/ADE/Cityscapes/细粒度 | 1,200-2,500 GPU-hours |
|
| 1050 |
+
| 部署、量化和补实验 | 300-800 GPU-hours |
|
| 1051 |
+
| **推荐总量** | **4,400-8,800 A100 GPU-hours** |
|
| 1052 |
+
|
| 1053 |
+
最低可行版本可压缩为约 2,500-4,000 GPU-hours:只保留 S2/S3、一个 detector、
|
| 1054 |
+
一个 segmentation decoder、两个细粒度数据集和三类硬件。
|
| 1055 |
+
|
| 1056 |
+
### 15.2 12-16 周排期
|
| 1057 |
+
|
| 1058 |
+
| 周 | 工作 |
|
| 1059 |
+
|---|---|
|
| 1060 |
+
| 1-2 | Phase 0、统一代码/配置、复现 S3 |
|
| 1061 |
+
| 2-4 | 理论推导、合成信号工具、频谱评测协议 |
|
| 1062 |
+
| 4-6 | G1/G2 候选、ImageNet-100 筛选 |
|
| 1063 |
+
| 6 | Gate A/B 评审,冻结主方法 |
|
| 1064 |
+
| 7-10 | ImageNet-1K S2/S3 3 seeds,S1/S4 scaling |
|
| 1065 |
+
| 9-11 | robustness/OOD/causal spectral analysis |
|
| 1066 |
+
| 10-13 | COCO、ADE20K/Cityscapes、细粒度 |
|
| 1067 |
+
| 12-14 | 部署、INT8、统计补齐 |
|
| 1068 |
+
| 14 | Gate C 评审,冻结全部数字 |
|
| 1069 |
+
| 15-16 | 写作、内部审稿、复现包清理 |
|
| 1070 |
+
|
| 1071 |
+
建议理论、模型与下游三条线并行,但共享唯一结果 registry。
|
| 1072 |
+
|
| 1073 |
+
---
|
| 1074 |
+
|
| 1075 |
+
## 16. 建议的论文结构
|
| 1076 |
+
|
| 1077 |
+
1. **Introduction**
|
| 1078 |
+
- 会议版结论;
|
| 1079 |
+
- 高频增强与噪声/aliasing 的未解矛盾;
|
| 1080 |
+
- journal 新增内容列表。
|
| 1081 |
+
2. **Related Work**
|
| 1082 |
+
- spectral bias 的三种频率;
|
| 1083 |
+
- Hadamard/product networks;
|
| 1084 |
+
- activation-dependent spectral bias;
|
| 1085 |
+
- frequency-adaptive vision;
|
| 1086 |
+
- efficient backbones。
|
| 1087 |
+
3. **Preliminaries and Problem Definition**
|
| 1088 |
+
- DFT、PSD、aliasing、三频谱定义;
|
| 1089 |
+
- 统一 gate taxonomy。
|
| 1090 |
+
4. **Spectral Transfer Theory of Gating**
|
| 1091 |
+
- T1-T3;
|
| 1092 |
+
- predictions 与适用条件。
|
| 1093 |
+
5. **FreqCal-Gate and GmNet++**
|
| 1094 |
+
- controllable activation;
|
| 1095 |
+
- proxy/controller;
|
| 1096 |
+
- loss 与复杂度。
|
| 1097 |
+
6. **Causal Spectral Evaluation Protocol**
|
| 1098 |
+
- filtering、perturbation、transfer matrix。
|
| 1099 |
+
7. **Experiments**
|
| 1100 |
+
- synthetic;
|
| 1101 |
+
- ImageNet;
|
| 1102 |
+
- robustness/OOD;
|
| 1103 |
+
- downstream;
|
| 1104 |
+
- deployment。
|
| 1105 |
+
8. **Ablations and Failure Analysis**
|
| 1106 |
+
9. **Limitations**
|
| 1107 |
+
10. **Conclusion**
|
| 1108 |
+
|
| 1109 |
+
### 16.1 journal 与 conference 差异声明模板
|
| 1110 |
+
|
| 1111 |
+
投稿时应在 cover letter 和正文明确写:
|
| 1112 |
+
|
| 1113 |
+
> This article substantially extends our ICLR 2026 conference paper. The new
|
| 1114 |
+
> material includes: (1) a discrete and aliasing-aware spectral theory for
|
| 1115 |
+
> correlated self-gating and general GLUs; (2) a new spectrally controllable,
|
| 1116 |
+
> input-adaptive gate; (3) a causal spectral evaluation protocol; and
|
| 1117 |
+
> (4) substantially expanded robustness, OOD, downstream, deployment, and
|
| 1118 |
+
> statistical studies. All reused material is explicitly cited and identified.
|
| 1119 |
+
|
| 1120 |
+
IEEE 要求 journal 包含显著更多技术信息、引用 conference 版本并明确差异。
|
| 1121 |
+
不要把 arXiv v1 当作对比基准;应以最终 ICLR 2026 版本为 prior work。
|
| 1122 |
+
|
| 1123 |
+
---
|
| 1124 |
+
|
| 1125 |
+
## 17. 方向优先级
|
| 1126 |
+
|
| 1127 |
+
| 方向 | Novelty | 风险 | 工作量 | 建议 |
|
| 1128 |
+
|---|---:|---:|---:|---|
|
| 1129 |
+
| 三频谱统一 + 离散/aliasing 理论 | 很高 | 高 | 很高 | 必选核心 |
|
| 1130 |
+
| composite gate 可控 smoothness/clipping | 高 | 中 | 中高 | 推荐方法核心 |
|
| 1131 |
+
| 因果频带干预 + transfer matrix | 高 | 中 | 中高 | 必选核心 |
|
| 1132 |
+
| clean/robust/latency 自适应 Pareto | 高 | 中高 | 高 | 推荐方法核心 |
|
| 1133 |
+
| OOD、AutoAttack、AP_S、boundary | 中 | 中低 | 高 | 必要证据 |
|
| 1134 |
+
| 最新 baseline 与统一硬件 | 中 | 低 | 中高 | 必做 |
|
| 1135 |
+
| INT8/能耗 | 中低 | 低 | 中 | supporting |
|
| 1136 |
+
| 跨音频/视频/PDE | 低到中 | 高 | 很高 | 不建议作为主线 |
|
| 1137 |
+
| 只增加数据集/激活/backbone | 低 | 低 | 中 | 单独不成立 |
|
| 1138 |
+
|
| 1139 |
+
---
|
| 1140 |
+
|
| 1141 |
+
## 18. 关键相关工作与新颖性边界
|
| 1142 |
+
|
| 1143 |
+
### 原论文与政策
|
| 1144 |
+
|
| 1145 |
+
1. [GmNet arXiv v3](https://arxiv.org/abs/2503.22841)
|
| 1146 |
+
2. [GmNet ICLR 2026 页面](https://iclr.cc/virtual/2026/poster/10008385)
|
| 1147 |
+
3. [GmNet 公开代码](https://github.com/YFWang1999/GmNet)
|
| 1148 |
+
4. [IEEE journal 扩展与出版伦理](https://journals.ieeeauthorcenter.ieee.org/become-an-ieee-journal-author/publishing-ethics/ethical-requirements/)
|
| 1149 |
+
5. [IEEE prior publication policy](https://journals.ieeeauthorcenter.ieee.org/become-an-ieee-journal-author/publishing-ethics/guidelines-and-policies/submission-and-peer-review-policies/)
|
| 1150 |
+
|
| 1151 |
+
### 理论与频率诊断
|
| 1152 |
+
|
| 1153 |
+
6. [On the Spectral Bias of Neural Networks, ICML 2019](https://proceedings.mlr.press/v97/rahaman19a.html)
|
| 1154 |
+
7. [A Fourier Perspective on Model Robustness, NeurIPS 2019](https://proceedings.neurips.cc/paper/2019/hash/b05b57f6add810d3b7490866d74c0053-Abstract.html)
|
| 1155 |
+
8. [High-Frequency Component Helps Explain CNN Generalization, CVPR 2020](https://openaccess.thecvf.com/content_CVPR_2020/html/Wang_High-Frequency_Component_Helps_Explain_the_Generalization_of_Convolutional_Neural_Networks_CVPR_2020_paper.html)
|
| 1156 |
+
9. [Spectral Bias in Practice, NeurIPS 2022](https://proceedings.neurips.cc/paper_files/paper/2022/hash/306264db5698839230be3642aafc849c-Abstract-Conference.html)
|
| 1157 |
+
10. [Extrapolation and Spectral Bias of Neural Nets with Hadamard Product, NeurIPS 2022](https://proceedings.neurips.cc/paper_files/paper/2022/hash/acb3565a58dea4c39c84af35d4225d97-Abstract-Conference.html)
|
| 1158 |
+
11. [Activation Function Dependence of Spectral Bias](https://arxiv.org/abs/2208.04924)
|
| 1159 |
+
12. [The Spectral Bias Is Shaped by the Non-linearity, 2025](https://arxiv.org/abs/2503.10587)
|
| 1160 |
+
13. [IGA-INR/eNTK, ICML 2025](https://proceedings.mlr.press/v267/shi25a.html)
|
| 1161 |
+
14. [Making Convolutional Networks Shift-Invariant Again, ICML 2019](https://proceedings.mlr.press/v97/zhang19a.html)
|
| 1162 |
+
|
| 1163 |
+
### 频率自适应、门控与鲁棒性
|
| 1164 |
+
|
| 1165 |
+
15. [FcaNet, ICCV 2021](https://openaccess.thecvf.com/content/ICCV2021/html/Qin_FcaNet_Frequency_Channel_Attention_Networks_ICCV_2021_paper.html)
|
| 1166 |
+
16. [Amplitude-Phase Recombination, ICCV 2021](https://openaccess.thecvf.com/content/ICCV2021/html/Chen_Amplitude-Phase_Recombination_Rethinking_Robustness_of_Convolutional_Neural_Networks_in_Frequency_ICCV_2021_paper.html)
|
| 1167 |
+
17. [HybridAugment++, ICCV 2023](https://openaccess.thecvf.com/content/ICCV2023/html/Yucel_HybridAugment_Unified_Frequency_Spectra_Perturbations_for_Model_Robustness_ICCV_2023_paper.html)
|
| 1168 |
+
18. [AFA frequency augmentation, CVPR 2024](https://openaccess.thecvf.com/content/CVPR2024/html/Vaish_Fourier-basis_Functions_to_Bridge_Augmentation_Gap_Rethinking_Frequency_Augmentation_in_CVPR_2024_paper.html)
|
| 1169 |
+
19. [FADC, CVPR 2024](https://openaccess.thecvf.com/content/CVPR2024/html/Chen_Frequency-Adaptive_Dilated_Convolution_for_Semantic_Segmentation_CVPR_2024_paper.html)
|
| 1170 |
+
20. [FDConv, CVPR 2025](https://openaccess.thecvf.com/content/CVPR2025/html/Chen_Frequency_Dynamic_Convolution_for_Dense_Image_Prediction_CVPR_2025_paper.html)
|
| 1171 |
+
21. [Spectral Gating Networks, 2026](https://arxiv.org/abs/2602.07679)
|
| 1172 |
+
22. [StarNet, CVPR 2024](https://openaccess.thecvf.com/content/CVPR2024/html/Ma_Rewrite_the_Stars_CVPR_2024_paper.html)
|
| 1173 |
+
23. [Global Filter Networks, NeurIPS 2021](https://proceedings.neurips.cc/paper_files/paper/2021/hash/07e87c2f4fc7f7c96116d8e2a92790f5-Abstract.html)
|
| 1174 |
+
|
| 1175 |
+
### 近期高效视觉 baseline
|
| 1176 |
+
|
| 1177 |
+
24. [MobileMamba, CVPR 2025](https://openaccess.thecvf.com/content/CVPR2025/html/He_MobileMamba_Lightweight_Multi-Receptive_Visual_Mamba_Network_CVPR_2025_paper.html)
|
| 1178 |
+
25. [EfficientViM, CVPR 2025](https://openaccess.thecvf.com/content/CVPR2025/html/Lee_EfficientViM_Efficient_Vision_Mamba_with_Hidden_State_Mixer_based_State_CVPR_2025_paper.html)
|
| 1179 |
+
26. [CARE Transformer, CVPR 2025](https://openaccess.thecvf.com/content/CVPR2025/html/Zhou_CARE_Transformer_Mobile-Friendly_Linear_Visual_Transformer_via_Decoupled_Dual_Interaction_CVPR_2025_paper.html)
|
| 1180 |
+
27. [RapidNet, WACV 2025](https://openaccess.thecvf.com/content/WACV2025/html/Munir_RapidNet_Multi-Level_Dilated_Convolution_Based_Mobile_Backbone_WACV_2025_paper.html)
|
| 1181 |
+
28. [TinyNeXt, ICCV 2025](https://openaccess.thecvf.com/content/ICCV2025/html/Zeng_An_Efficient_Hybrid_Vision_Transformer_for_TinyML_Applications_ICCV_2025_paper.html)
|
| 1182 |
+
|
| 1183 |
+
---
|
| 1184 |
+
|
| 1185 |
+
## 19. 最终建议
|
| 1186 |
+
|
| 1187 |
+
优先按以下顺序投入:
|
| 1188 |
+
|
| 1189 |
+
1. **先修复复现与文本数字**,否则所有新增结果都缺可信基线;
|
| 1190 |
+
2. **先做 T1 + 合成信号 + causal protocol**,确认会议版解释中哪些成立;
|
| 1191 |
+
3. **用 G1/G2 小规模筛选验证 clean/robust/latency Pareto**;
|
| 1192 |
+
4. 只有小规模通过,才投入 ImageNet-1K 和下游大实验;
|
| 1193 |
+
5. 把 AP_S、boundary、frequency-constrained attack 和 OOD 作为机制证据,而不是
|
| 1194 |
+
单纯扩表;
|
| 1195 |
+
6. 主动报告反例和边界条件,将论文从架构宣传提升为可验证的门控频谱研究。
|
| 1196 |
+
|
| 1197 |
+
最稳妥的 TPAMI story 是:
|
| 1198 |
+
|
| 1199 |
+
> **门控并非简单“增加高频”;它进行依赖输入统计、分支相关性、非线性形状和
|
| 1200 |
+
> 离散采样的频谱传输。通过可控 smoothness/clipping 和低成本可靠性估计,
|
| 1201 |
+
> GmNet++ 选择性保留任务相关细节,同时抑制噪声与 aliasing,并在准确率、
|
| 1202 |
+
> 鲁棒性和真实部署效率之间取得更好的 Pareto。**
|
gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_AUDIT_PROTOCOL.md
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# B/D/S/C/SC Matched ImageNet Spectral Audit Protocol
|
| 2 |
+
|
| 3 |
+
Protocol ID: `gmnet-e4-imagenet-matched-spectral-v1`
|
| 4 |
+
Status: frozen before formal execution
|
| 5 |
+
Date: 2026-07-18 UTC
|
| 6 |
+
|
| 7 |
+
## 1. Objective and claim boundary
|
| 8 |
+
|
| 9 |
+
This audit measures the realized gate operator in five fixed-last ImageNet
|
| 10 |
+
checkpoints under one identical validation pipeline:
|
| 11 |
+
|
| 12 |
+
- `B`: current-code baseline;
|
| 13 |
+
- `D`: batch derangement;
|
| 14 |
+
- `S`: stop-gradient;
|
| 15 |
+
- `C`: channel derangement;
|
| 16 |
+
- `SC`: stop-gradient plus channel derangement.
|
| 17 |
+
|
| 18 |
+
The audit must distinguish three quantities that are not interchangeable:
|
| 19 |
+
|
| 20 |
+
1. **amplitude/energy scale**: whether a representation is simply larger or
|
| 21 |
+
smaller;
|
| 22 |
+
2. **normalized spectral shape**: where its centered energy lies after scale is
|
| 23 |
+
removed;
|
| 24 |
+
3. **conditional spectral transfer**: whether the spatially varying gate moves
|
| 25 |
+
carrier content between frequency bands.
|
| 26 |
+
|
| 27 |
+
The output may support a descriptive, single-training-seed mechanism claim. It
|
| 28 |
+
does not provide uncertainty over training seeds, and image-bootstrap intervals
|
| 29 |
+
must never be described as training-run significance.
|
| 30 |
+
|
| 31 |
+
## 2. Frozen artifacts
|
| 32 |
+
|
| 33 |
+
| Arm | Run root | Expected checkpoint SHA256 |
|
| 34 |
+
|---|---|---|
|
| 35 |
+
| B | `/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0` | `090116608a567152d232255e5d96d6f1611154d508e5727bbdf84781d1b532c8` |
|
| 36 |
+
| D | `/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0` | `d07bc844c1b2a678fc1e8baacf1fe7518a7b7d1ab9858cbdd6512fe00e4361a0` |
|
| 37 |
+
| S | `/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0` | `786526f3f4d55cac7656b2cce770c4192177f28a06e9362c8473248f32a81326` |
|
| 38 |
+
| C | `/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0` | `e21cddc22c53f880a8357b009652beadfacec8723ef0aad2a93bb5a8caf346b7` |
|
| 39 |
+
| SC | `/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0` | `918925152daae6a1039f91690ee9d634296b18a08be7800e8db4c2315ac175be` |
|
| 40 |
+
|
| 41 |
+
Before inference, the runner must rerun the existing official validator and
|
| 42 |
+
verify fixed-last epoch 299, 300 epochs, 187,500 steps, 50,000-image official
|
| 43 |
+
evaluation, topology/state schema, config hash, checkpoint hash, and
|
| 44 |
+
intervention identity. The formal run must use the registered PyTorch
|
| 45 |
+
`2.9.0+cu130` environment. Results produced by the drifted PyTorch 2.10 local
|
| 46 |
+
environment are smoke evidence only.
|
| 47 |
+
|
| 48 |
+
`S` and `C` were trained with alignment code manifest
|
| 49 |
+
`4a62bc48370247d882196cd9afc1a0f1629a5bbfd522c3f599ffaf0c1187641f`;
|
| 50 |
+
`B`, `D`, and `SC`, and the unified audit runtime, use mechanism code manifest
|
| 51 |
+
`f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9`.
|
| 52 |
+
The exact historical model source is frozen under
|
| 53 |
+
`e4_spectral_audit/source_snapshots/alignment_4a62`. Before inference, the
|
| 54 |
+
formal PyTorch 2.9 preflight must verify that snapshot and demonstrate bitwise
|
| 55 |
+
equality of old/new B, S, and C forward values, input gradients, and parameter
|
| 56 |
+
gradients. The unified runtime is accepted only if that test passes and the
|
| 57 |
+
50,000-image unfiltered replay matches the stored per-image categorical
|
| 58 |
+
outputs; provenance must still report the two distinct training-code hashes.
|
| 59 |
+
|
| 60 |
+
`C` and `SC` must retain the same 17-block channel permutation manifest:
|
| 61 |
+
|
| 62 |
+
```text
|
| 63 |
+
0219d0a289ae2e3c2bde90568af4b05d23ca629522f1b19b6a1d09473d87fb8b
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## 3. Data, order, and sample units
|
| 67 |
+
|
| 68 |
+
### 3.1 Official replay and low-pass evaluation
|
| 69 |
+
|
| 70 |
+
Every accuracy point uses all 50,000 ImageNet validation images, the official
|
| 71 |
+
deterministic resize/center-crop pipeline, and no augmentation. The
|
| 72 |
+
`unfiltered` condition is a true filter bypass and must exactly reproduce the
|
| 73 |
+
stored official integer correct counts, Top-1, and Top-5. A Butterworth cutoff
|
| 74 |
+
of 1 is not an identity transform and must not be used as the replay check.
|
| 75 |
+
|
| 76 |
+
The independent statistical unit for accuracy is an image. Report exact counts
|
| 77 |
+
and class-stratified paired bootstrap 95% intervals for within-image contrasts.
|
| 78 |
+
These intervals describe validation-set sampling only.
|
| 79 |
+
|
| 80 |
+
### 3.2 Frozen 4,096-image spectral subset
|
| 81 |
+
|
| 82 |
+
Activation spectra use exactly 4,096 receiver images. Construct the subset
|
| 83 |
+
before looking at activations or labels predicted by any model:
|
| 84 |
+
|
| 85 |
+
1. within each of the 1,000 ground-truth classes, sort images by the bytes
|
| 86 |
+
`SHA256(UTF8("gmnet-e4-spectral-v1") || 0x00 ||
|
| 87 |
+
UTF8(canonical_relative_path))` and take four;
|
| 88 |
+
2. sort classes by the bytes
|
| 89 |
+
`SHA256(UTF8("gmnet-e4-spectral-extra-v1") || 0x00 ||
|
| 90 |
+
ASCII(f"{class_id:04d}"))`, where `class_id` is the zero-based ImageFolder
|
| 91 |
+
class index in `[0,999]`, and give the
|
| 92 |
+
first 96 classes their fifth-ranked image;
|
| 93 |
+
3. write canonical index, relative path, class ID, selection hash, and rank to a
|
| 94 |
+
manifest and freeze the manifest SHA256.
|
| 95 |
+
|
| 96 |
+
Thus 904 classes contribute four images and 96 classes contribute five. The
|
| 97 |
+
same receiver IDs are used for every arm, block, transform, and input condition.
|
| 98 |
+
No model-dependent rejection or replacement is permitted.
|
| 99 |
+
|
| 100 |
+
The independent statistical unit for spectral contrasts is a receiver image.
|
| 101 |
+
Channels and spatial bins are repeated measurements, not independent samples.
|
| 102 |
+
Bootstrap images within ground-truth class and carry all blocks/channels from a
|
| 103 |
+
selected image together.
|
| 104 |
+
|
| 105 |
+
## 4. Canonical execution, especially D
|
| 106 |
+
|
| 107 |
+
All five arms use a single process and one GPU for the formal audit, local batch
|
| 108 |
+
size 256, `drop_last=false`, and the canonical ImageFolder order. The last batch
|
| 109 |
+
contains 80 images. This common execution removes device-sharding and local
|
| 110 |
+
batch composition as hidden differences.
|
| 111 |
+
|
| 112 |
+
For `D`, the full canonical batch must enter every gate before selected receiver
|
| 113 |
+
rows are extracted. It is invalid to make a 4,096-image loader and derange that
|
| 114 |
+
subset: doing so changes every donor. For every block and each observed batch
|
| 115 |
+
size, record shift, complete receiver-to-donor index mapping hash, bijection,
|
| 116 |
+
fixed points, batch count, and receiver count. There must be zero fixed points
|
| 117 |
+
and exactly 50,000 covered receivers per block.
|
| 118 |
+
|
| 119 |
+
Order sensitivity is a property of `D`, not measurement noise. In addition to
|
| 120 |
+
the registered canonical result, run `D` with two fixed full-dataset orders
|
| 121 |
+
obtained by sorting canonical indices with salts
|
| 122 |
+
`gmnet-e4-order-sensitivity-1` and `gmnet-e4-order-sensitivity-2`. Preserve batch
|
| 123 |
+
size 256 and tail size 80. For salt `s` and zero-based canonical index `i`, sort
|
| 124 |
+
by the tuple
|
| 125 |
+
`(SHA256(UTF8(s) || 0x00 || UINT64_LE(i)), i)`; `UINT64_LE` is exactly eight
|
| 126 |
+
bytes and the index is the deterministic tie-breaker. Report accuracy and all
|
| 127 |
+
block-level primary spectral
|
| 128 |
+
metrics for the same 4,096 receiver IDs. Do not average these orders into the
|
| 129 |
+
primary result. Report canonical value plus the two-order range. As an order
|
| 130 |
+
invariance control, replay `B` under the first alternative order; all aggregated
|
| 131 |
+
metrics and integer correct counts must agree within the numerical tolerances in
|
| 132 |
+
Section 10.
|
| 133 |
+
|
| 134 |
+
## 5. Low-pass accuracy protocol
|
| 135 |
+
|
| 136 |
+
Evaluate `unfiltered` and Butterworth cutoffs
|
| 137 |
+
|
| 138 |
+
```text
|
| 139 |
+
0.125, 0.25, 0.50, 0.75
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
on all 50,000 images for every arm. Filtering is performed after the official
|
| 143 |
+
RGB resize and 224x224 center crop, but before ImageNet normalization:
|
| 144 |
+
|
| 145 |
+
```text
|
| 146 |
+
decoded RGB -> official bicubic Resize(256) -> CenterCrop(224)
|
| 147 |
+
-> float RGB in [0,1] -> per-channel low-pass -> ImageNet mean/std normalize
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
For spatial size `(H,W)`, use an orthonormal two-dimensional FFT, shifted radial
|
| 151 |
+
frequency
|
| 152 |
+
|
| 153 |
+
\[
|
| 154 |
+
r=\sqrt{f_x^2+f_y^2}/\sqrt{0.5},
|
| 155 |
+
\]
|
| 156 |
+
|
| 157 |
+
and order-4 Butterworth amplitude response
|
| 158 |
+
|
| 159 |
+
\[
|
| 160 |
+
H_c(r)=\left(1+(r/c)^8\right)^{-1/2}.
|
| 161 |
+
\]
|
| 162 |
+
|
| 163 |
+
Apply the real inverse transform without clipping, min-max rescaling, or
|
| 164 |
+
quantization. Save a transform self-test showing imaginary residual below
|
| 165 |
+
`1e-10` relative L2 and deterministic output hashes for registered fixture
|
| 166 |
+
images.
|
| 167 |
+
|
| 168 |
+
For each cutoff report Top-1, Top-5, NLL, exact correct counts, and the clean
|
| 169 |
+
relative drops
|
| 170 |
+
|
| 171 |
+
\[
|
| 172 |
+
\Delta A_m(c)=A_m(\mathrm{unfiltered})-A_m(c).
|
| 173 |
+
\]
|
| 174 |
+
|
| 175 |
+
The curve and trapezoidal AUC over `log2(c)` are task-frequency sensitivity
|
| 176 |
+
descriptors. They are not direct measurements of internal spectral mixing.
|
| 177 |
+
|
| 178 |
+
## 6. Hooked tensors and numerical convention
|
| 179 |
+
|
| 180 |
+
At every one of the 17 GmNet blocks, hook the exact input of the multiplicative
|
| 181 |
+
gate. Define, for receiver image `n` and expanded channel `c`,
|
| 182 |
+
|
| 183 |
+
\[
|
| 184 |
+
x=\text{carrier before gate},\quad
|
| 185 |
+
z=\text{actual intervention gate input},\quad
|
| 186 |
+
q=\operatorname{ReLU6}(z),\quad
|
| 187 |
+
y=x\odot q.
|
| 188 |
+
\]
|
| 189 |
+
|
| 190 |
+
`z` must be obtained through the model's registered `gate_input` method. Never
|
| 191 |
+
reconstruct channel or batch permutations independently in analysis code.
|
| 192 |
+
Assert `y` equals the gate module output within `rtol=1e-6, atol=1e-7` on every
|
| 193 |
+
audited batch. For `S`, forward values satisfy `z=x`; detachment is a training
|
| 194 |
+
derivative property and cannot be inferred from inference tensors.
|
| 195 |
+
|
| 196 |
+
All reductions accumulate in float64. FFT and DCT transforms are orthonormal.
|
| 197 |
+
Let spatial centering be
|
| 198 |
+
|
| 199 |
+
\[
|
| 200 |
+
\mathcal C(v)=v-\frac{1}{HW}\sum_u v(u).
|
| 201 |
+
\]
|
| 202 |
+
|
| 203 |
+
For scale-free spectra, for each image-channel separately,
|
| 204 |
+
|
| 205 |
+
\[
|
| 206 |
+
p_v(k)=\frac{|\mathcal F\{\mathcal C(v)\}(k)|^2}
|
| 207 |
+
{\sum_j|\mathcal F\{\mathcal C(v)\}(j)|^2}.
|
| 208 |
+
\]
|
| 209 |
+
|
| 210 |
+
Carrier pairs with centered energy no larger than
|
| 211 |
+
`eps = 32 * finfo(float64).eps * HW * mean(v^2)` are invalid for a normalized
|
| 212 |
+
metric. Exclude them and count them. A spatially constant or all-zero gate/output
|
| 213 |
+
is a legitimate learned operating state rather than a runner failure: record it
|
| 214 |
+
as `constant_gate` or `suppressed_output` and exclude only metrics whose
|
| 215 |
+
denominator is mathematically undefined. Never add a large epsilon that
|
| 216 |
+
silently turns a near-zero channel into a low-energy spectrum.
|
| 217 |
+
|
| 218 |
+
## 7. Required metrics
|
| 219 |
+
|
| 220 |
+
### 7.1 Raw amplitude diagnostics
|
| 221 |
+
|
| 222 |
+
For `x`, `q`, and `y`, report per-image medians over channels and then the
|
| 223 |
+
dataset median, IQR, and class-stratified bootstrap interval of:
|
| 224 |
+
|
| 225 |
+
- centered RMS and `log10(centered_energy)`;
|
| 226 |
+
- non-centered RMS;
|
| 227 |
+
- for `q`, mean, coefficient of spatial variation, zero fraction, active
|
| 228 |
+
fraction, and clip-crossing fraction.
|
| 229 |
+
|
| 230 |
+
Raw energy is a confound audit. It must not be the sole basis of a mechanism
|
| 231 |
+
claim.
|
| 232 |
+
|
| 233 |
+
### 7.2 Normalized spectral shape
|
| 234 |
+
|
| 235 |
+
FFT is primary; orthonormal DCT-II is a required boundary-condition robustness
|
| 236 |
+
check. No Hann window or post-transform rescaling is used. For `x`, centered
|
| 237 |
+
`q`, and `y`, report:
|
| 238 |
+
|
| 239 |
+
- high-frequency fraction `sum p(k)` for normalized radius `r >= 0.5`;
|
| 240 |
+
- spectral centroid `sum r(k)p(k)`;
|
| 241 |
+
- normalized spectral entropy;
|
| 242 |
+
- Jensen-Shannon divergence `JSD(p_x,p_y)` in bits;
|
| 243 |
+
- `output - carrier` change in high-frequency fraction and centroid.
|
| 244 |
+
|
| 245 |
+
All normalized quantities are calculated per image-channel first. The primary
|
| 246 |
+
block statistic is the per-image mean over valid channels, followed by the mean
|
| 247 |
+
over images. Pooling coefficients across images before normalization is
|
| 248 |
+
forbidden because high-amplitude channels would dominate.
|
| 249 |
+
|
| 250 |
+
### 7.3 Dataset-level carrier-gate coherence
|
| 251 |
+
|
| 252 |
+
For every valid image-channel pair, center `x` and the actually used `z` across
|
| 253 |
+
`H x W` and compute
|
| 254 |
+
|
| 255 |
+
\[
|
| 256 |
+
\rho_{n,c}=
|
| 257 |
+
\frac{\langle\mathcal C(x_{n,c}),\mathcal C(z_{n,c})\rangle}
|
| 258 |
+
{\|\mathcal C(x_{n,c})\|_2\|\mathcal C(z_{n,c})\|_2}.
|
| 259 |
+
\]
|
| 260 |
+
|
| 261 |
+
Average channels within image and images within class, then average the 1,000
|
| 262 |
+
class means. Also report SD, 5/50/95 percentiles, valid pair count, and invalid
|
| 263 |
+
count. This is a scale-free spatial alignment proxy, not semantic coherence or
|
| 264 |
+
a causal mediator. Flattening all images/channels/elements into one Pearson
|
| 265 |
+
coefficient is forbidden. `B` and `S` must produce 1 within `1e-7`.
|
| 266 |
+
|
| 267 |
+
### 7.4 Scale-free gate-induced residual
|
| 268 |
+
|
| 269 |
+
Fit the best scalar carrier-only explanation separately for each image-channel:
|
| 270 |
+
|
| 271 |
+
\[
|
| 272 |
+
\alpha=\frac{\langle\mathcal C(y),\mathcal C(x)\rangle}
|
| 273 |
+
{\|\mathcal C(x)\|_2^2},\qquad
|
| 274 |
+
M_{res}=\frac{\|\mathcal C(y)-\alpha\mathcal C(x)\|_2^2}
|
| 275 |
+
{\|\mathcal C(y)\|_2^2}.
|
| 276 |
+
\]
|
| 277 |
+
|
| 278 |
+
`M_res` is invariant to a global output scale and, by Parseval, measures output
|
| 279 |
+
structure not explained by scalar carrier gain. It is operator-specific but is
|
| 280 |
+
not by itself a directional high-frequency metric. If `x` is valid but `y` is
|
| 281 |
+
suppressed below the registered numerical threshold, define `M_res=0` and set
|
| 282 |
+
`suppressed_output=true`: a gate that removes the carrier did not generate
|
| 283 |
+
residual structure. Report conditional-on-nonsuppressed results as a secondary
|
| 284 |
+
diagnostic only.
|
| 285 |
+
|
| 286 |
+
### 7.5 Conditional cross-band transfer
|
| 287 |
+
|
| 288 |
+
Use four disjoint radial bands with edges
|
| 289 |
+
|
| 290 |
+
```text
|
| 291 |
+
[0, 0.25), [0.25, 0.50), [0.50, 0.75), [0.75, 1.0]
|
| 292 |
+
```
|
| 293 |
+
|
| 294 |
+
in both FFT and DCT bases. Let `P_i` be the orthogonal projection into source
|
| 295 |
+
band `i`, and let `x_i=P_i C(x)`. Freeze the gate actually realized on the full
|
| 296 |
+
input and form `u_i=q * x_i`. Define row-normalized transfer
|
| 297 |
+
|
| 298 |
+
\[
|
| 299 |
+
T_{ij}=\frac{\|P_j u_i\|_2^2}{\sum_{l=1}^{4}\|P_l u_i\|_2^2}.
|
| 300 |
+
\]
|
| 301 |
+
|
| 302 |
+
Normalize each nonsuppressed image-channel-source row before any aggregation.
|
| 303 |
+
If a valid source row is suppressed to numerical zero, set its complete `T`
|
| 304 |
+
row to zero and mark it suppressed. Consequently,
|
| 305 |
+
carrier band energy, channel amplitude, and overall gate gain cannot determine
|
| 306 |
+
the row weight. Invalid near-zero source rows are counted and excluded; valid
|
| 307 |
+
source rows with suppressed output remain in the primary estimate as zero rows.
|
| 308 |
+
Aggregate channels within image, then images within class, then classes.
|
| 309 |
+
|
| 310 |
+
The required scalar summaries are
|
| 311 |
+
|
| 312 |
+
\[
|
| 313 |
+
M_{off}=\frac14\sum_i\sum_{j\ne i}T_{ij},\qquad
|
| 314 |
+
M_{disp}=\frac14\sum_{ij}T_{ij}|m_i-m_j|,
|
| 315 |
+
\]
|
| 316 |
+
|
| 317 |
+
where `m_i` is the midpoint of band `i`. The first expression equals
|
| 318 |
+
`1/4 sum_i(1-T_ii)` only for nonsuppressed rows. Use equal source-band weights;
|
| 319 |
+
weighting by natural carrier PSD would reintroduce the energy-distribution
|
| 320 |
+
confound. Report source-valid fraction, suppressed-row fraction, and the
|
| 321 |
+
conditional nonsuppressed matrix alongside the primary zero-for-suppression
|
| 322 |
+
matrix, so equal conditional transfer cannot hide widespread gate shutdown.
|
| 323 |
+
|
| 324 |
+
A constant-gate unit test must yield an identity transfer matrix and
|
| 325 |
+
`M_off <= 1e-6`; reconstruction from the four bands must have relative L2 error
|
| 326 |
+
`<=1e-10` in float64. Without this transfer metric, the output may discuss PSD
|
| 327 |
+
shape but must not claim that total spectral mixing is matched across arms.
|
| 328 |
+
|
| 329 |
+
## 8. Block and stage aggregation
|
| 330 |
+
|
| 331 |
+
The 17 blocks are the primary anatomical units and must all appear in plots and
|
| 332 |
+
machine-readable tables. Do not pool all activation elements across blocks:
|
| 333 |
+
stage 1 has larger spatial maps, stage 4 has more channels, and either choice of
|
| 334 |
+
element weighting silently changes the scientific question.
|
| 335 |
+
|
| 336 |
+
For a stage with `L_s` blocks, the primary stage summary is the block-equal mean
|
| 337 |
+
|
| 338 |
+
\[
|
| 339 |
+
\bar m_s=L_s^{-1}\sum_{b\in s}m_b,
|
| 340 |
+
\]
|
| 341 |
+
|
| 342 |
+
with block minimum, maximum, and all individual points shown. A secondary
|
| 343 |
+
`sample_channel_weighted` estimate may be emitted, but it must be explicitly
|
| 344 |
+
named and cannot replace the block-equal result. The global depth summary is the
|
| 345 |
+
equal mean over all 17 blocks. Report the four stages separately because their
|
| 346 |
+
normalized Nyquist units refer to different feature-map resolutions.
|
| 347 |
+
|
| 348 |
+
Bootstrap contrasts resample receiver images once and reuse that resample for
|
| 349 |
+
all five arms and all 17 blocks. This preserves paired checkpoint and depth
|
| 350 |
+
structure. Use 10,000 deterministic, class-stratified bootstrap replicates and
|
| 351 |
+
report percentile 95% intervals. Apply Holm correction only if individual
|
| 352 |
+
block-wise null-hypothesis tests are added; the pre-registered primary output is
|
| 353 |
+
effect sizes and intervals, not 17 uncorrected p-values.
|
| 354 |
+
|
| 355 |
+
## 9. Minimum publishable output
|
| 356 |
+
|
| 357 |
+
The formal result directory must contain:
|
| 358 |
+
|
| 359 |
+
1. `protocol.json`: every frozen constant above and the protocol file SHA256;
|
| 360 |
+
2. `environment.json`: Python, PyTorch, CUDA, GPU, container/image, package lock,
|
| 361 |
+
code-manifest hash, and deterministic flags;
|
| 362 |
+
3. `checkpoint_manifest.json`: all source paths, hashes, official certificate
|
| 363 |
+
hashes, topology, and intervention/permutation identities;
|
| 364 |
+
4. `subset_manifest.jsonl`: 4,096 frozen receiver identities and selection
|
| 365 |
+
hashes;
|
| 366 |
+
5. `accuracy_by_condition.csv`: five arms times unfiltered/four cutoffs, all
|
| 367 |
+
based on 50,000 images;
|
| 368 |
+
6. `per_image_accuracy.npz`: NumPy arrays for canonical index, ground-truth,
|
| 369 |
+
top-1/top-5 correctness, and NLL needed for paired validation-set bootstrap,
|
| 370 |
+
with field names/dtypes/shapes recorded in `results.json`; Parquet is optional
|
| 371 |
+
only when a pinned `pyarrow` version is added to and verified by the formal
|
| 372 |
+
environment;
|
| 373 |
+
7. `spectral_by_block.csv`: all required amplitude, normalized PSD, coherence,
|
| 374 |
+
residual, transfer, valid-count, and uncertainty fields for 85 arm-block
|
| 375 |
+
rows per transform;
|
| 376 |
+
8. `transfer_matrices.npz`: the 4x4 FFT and DCT matrices plus bootstrap
|
| 377 |
+
summaries for every arm/block;
|
| 378 |
+
9. `spectral_by_stage.csv`: explicitly labeled block-equal and secondary
|
| 379 |
+
weighted summaries;
|
| 380 |
+
10. `batch_pairing_manifest.json`: all canonical and sensitivity-order `D`
|
| 381 |
+
receiver/donor proofs;
|
| 382 |
+
11. `results.json`: machine-readable arm summaries, contrasts, checks, and claim
|
| 383 |
+
decision;
|
| 384 |
+
12. `REPORT.md`: plots/tables, failure disclosures, and wording permitted by
|
| 385 |
+
Section 11;
|
| 386 |
+
13. `source_artifacts.sha256` and `COMPLETE`, written only after all validation
|
| 387 |
+
checks pass.
|
| 388 |
+
|
| 389 |
+
At minimum the paper needs: the five-arm clean/low-pass accuracy table; one
|
| 390 |
+
17-block `M_off`/`M_res` profile; one four-stage carrier/gate/output normalized
|
| 391 |
+
spectral profile; the `rho_used` depth profile; representative 4x4 transfer
|
| 392 |
+
heatmaps; and a table pairing accuracy loss with scale-free mixing and raw
|
| 393 |
+
energy. Every figure must show receiver-image uncertainty or the two balanced
|
| 394 |
+
subset panels, and `D` must show its order-sensitivity range.
|
| 395 |
+
|
| 396 |
+
## 10. Mechanical acceptance conditions
|
| 397 |
+
|
| 398 |
+
The audit is complete only if all conditions hold:
|
| 399 |
+
|
| 400 |
+
- all five source official certificates pass and checkpoint hashes equal
|
| 401 |
+
Section 2;
|
| 402 |
+
- formal environment reports PyTorch `2.9.0+cu130` and CUDA 13.0;
|
| 403 |
+
- the frozen alignment-source snapshot passes its byte audit, and the formal
|
| 404 |
+
old/new B/S/C forward and gradient equivalence test is bitwise exact;
|
| 405 |
+
- all unfiltered integer correct counts exactly replay official results;
|
| 406 |
+
- every low-pass point contains exactly 50,000 unique canonical receivers;
|
| 407 |
+
- the spectral subset contains exactly 4,096 unique receivers with class counts
|
| 408 |
+
in `{4,5}` and the same manifest hash for all arms;
|
| 409 |
+
- all 17 blocks are present for every arm and both FFT/DCT transforms;
|
| 410 |
+
- no NaN/Inf occurs; invalid carrier/source rows remain below 1% per arm/block,
|
| 411 |
+
while constant-gate and suppressed-output fractions are explicitly reported
|
| 412 |
+
rather than treated as runner failures;
|
| 413 |
+
- gate-module output reconstruction passes `rtol=1e-6, atol=1e-7`;
|
| 414 |
+
- FFT/DCT band reconstruction error is at most `1e-10`, Parseval relative error
|
| 415 |
+
at most `1e-10`, and constant-gate `M_off` at most `1e-6`;
|
| 416 |
+
- `B` and `S` used-input coherence differ from 1 by at most `1e-7`;
|
| 417 |
+
- `C` and `SC` permutation manifests are exactly identical and equal the frozen
|
| 418 |
+
hash;
|
| 419 |
+
- canonical `D` is single-device batch 256/tail 80, has zero fixed points,
|
| 420 |
+
bijective mappings, and covers 50,000 receivers in every block;
|
| 421 |
+
- the permuted-order `B` control changes aggregate normalized metrics by no more
|
| 422 |
+
than `1e-6` absolute and has identical correct counts;
|
| 423 |
+
- rerunning aggregation from frozen row-level artifacts reproduces every table
|
| 424 |
+
byte-for-byte and all source hashes verify.
|
| 425 |
+
|
| 426 |
+
## 11. Pre-registered interpretation rules
|
| 427 |
+
|
| 428 |
+
The following rules prevent choosing a story after seeing the curves. They are
|
| 429 |
+
descriptive effect-size rules for these checkpoints.
|
| 430 |
+
|
| 431 |
+
### 11.1 Comparable total mixing
|
| 432 |
+
|
| 433 |
+
For a contrast arm `m` versus `B`, call scale-free mixing **comparable** only if
|
| 434 |
+
both global-depth FFT metrics meet
|
| 435 |
+
|
| 436 |
+
```text
|
| 437 |
+
abs(M_off_m - M_off_B) / M_off_B <= 10%
|
| 438 |
+
abs(M_res_m - M_res_B) / M_res_B <= 10%
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
and the paired image-bootstrap 90% interval for each relative difference lies
|
| 442 |
+
inside `[-10%, +10%]`. DCT must agree in direction and remain within 15%.
|
| 443 |
+
The suppressed-row fraction must also differ from `B` by no more than 5
|
| 444 |
+
percentage points. If either baseline denominator is below `1e-6`, relative
|
| 445 |
+
equivalence is undefined and “comparable total mixing” is forbidden.
|
| 446 |
+
These bounds are practical equivalence margins for the audit, not universal
|
| 447 |
+
constants.
|
| 448 |
+
|
| 449 |
+
If an arm loses accuracy while retaining comparable mixing, the result rules
|
| 450 |
+
out a simple “less total mixing” explanation for that checkpoint contrast. If
|
| 451 |
+
the bound fails, use “nonzero/redistributed mixing” and report the magnitude;
|
| 452 |
+
do not write “matched mixing.”
|
| 453 |
+
|
| 454 |
+
### 11.2 Main mechanism claim
|
| 455 |
+
|
| 456 |
+
The strongest planned statement is supported if all of the following hold:
|
| 457 |
+
|
| 458 |
+
1. official effects retain their registered direction: `D << B`, `S < B`,
|
| 459 |
+
`C < B`, and `SC < C`;
|
| 460 |
+
2. `D` retains substantial scale-free mixing, operationally at least 50% of
|
| 461 |
+
`B` for both `M_off` and `M_res`, while its Top-1 remains at least 10 points
|
| 462 |
+
below `B` in every registered order;
|
| 463 |
+
3. either `D` has comparable total mixing by Section 11.1, or its raw/normalized
|
| 464 |
+
high-frequency energy is not lower than `B`; this is required before using
|
| 465 |
+
the phrase “not indiscriminate high-frequency amplification” for the D/B
|
| 466 |
+
comparison;
|
| 467 |
+
4. `C` preserves at least 80% of `B` mixing and stays within 2 Top-1 points of
|
| 468 |
+
`B`, consistent with adaptation to exact channel mismatch;
|
| 469 |
+
5. `SC` remains at least 3 Top-1 points below `C` with their identical
|
| 470 |
+
permutation, consistent with the gate-gradient path contributing to that
|
| 471 |
+
adaptation;
|
| 472 |
+
6. the qualitative conclusions hold in every stage and do not arise solely
|
| 473 |
+
from an element-weighted early-stage aggregate;
|
| 474 |
+
7. FFT and DCT agree on the direction of the relevant arm contrasts.
|
| 475 |
+
|
| 476 |
+
Passing these rules permits:
|
| 477 |
+
|
| 478 |
+
> The trained gate performs input-conditioned multiplicative spectral mixing.
|
| 479 |
+
> Its task value is not determined by raw high-frequency energy or total mixing
|
| 480 |
+
> strength alone; it depends on sample-conditioned carrier-gate coupling and an
|
| 481 |
+
> optimizable gate-gradient path. Exact channel correspondence is helpful but
|
| 482 |
+
> partly adaptable.
|
| 483 |
+
|
| 484 |
+
### 11.3 Outcome-dependent narrowing
|
| 485 |
+
|
| 486 |
+
- If `D` mixing is below 50% of `B`, the audit cannot separate destroyed sample
|
| 487 |
+
conditioning from a collapse of total mixing. State that both changed.
|
| 488 |
+
- If `D` varies by more than 20% relative in `M_off` or more than 2 Top-1 points
|
| 489 |
+
across the two order probes, describe the D effect as batch/order-specific;
|
| 490 |
+
do not generalize it to arbitrary independent gates.
|
| 491 |
+
- If `C` mixing or accuracy violates rule 4, remove “adaptable” and report only
|
| 492 |
+
this fixed-permutation result.
|
| 493 |
+
- If `SC` does not satisfy rule 5, retain the standalone `S-B` result but remove
|
| 494 |
+
the strong mismatch-adaptation interaction statement.
|
| 495 |
+
- If raw energy, normalized PSD, and conditional transfer all decline together
|
| 496 |
+
with accuracy, the spectral audit is correlational and does not exclude an
|
| 497 |
+
energy/mixing-quantity explanation.
|
| 498 |
+
- Low-pass curves can show different task-frequency sensitivity, but they never
|
| 499 |
+
prove that a specific internal gate produced that dependence.
|
| 500 |
+
|
| 501 |
+
Clipping remains a separate operator-control claim. Because these five arms all
|
| 502 |
+
use ReLU6 and clip crossing is non-monotonic with accuracy, this audit must not
|
| 503 |
+
be used to claim that clipping uniquely improves ImageNet clean accuracy.
|
| 504 |
+
|
| 505 |
+
## 12. Closure criterion
|
| 506 |
+
|
| 507 |
+
Passing Sections 10 and 11 closes the **single-seed descriptive mechanism
|
| 508 |
+
loop**: isolated operator transfer, matched checkpoint spectral behavior,
|
| 509 |
+
sample-conditioned intervention, and official task outcomes are measured in one
|
| 510 |
+
audited chain. It does not close training-population inference. Abstract-level
|
| 511 |
+
claims of generality or statistical interaction still require matched seeds 1
|
| 512 |
+
and 2; a pure forward sample-alignment claim still requires the detached-batch
|
| 513 |
+
arm.
|
gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_DIAGNOSTIC_20260720.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ImageNet Matched Spectral Audit: New-Experiment Diagnostic
|
| 2 |
+
|
| 3 |
+
Date: 2026-07-20 UTC
|
| 4 |
+
|
| 5 |
+
## 1. Executive Status
|
| 6 |
+
|
| 7 |
+
The eight GPU tasks completed successfully, but the experiment did **not**
|
| 8 |
+
produce a formally accepted root result.
|
| 9 |
+
|
| 10 |
+
- Four result roots exist:
|
| 11 |
+
`matched_5arm_seed0_20260718.partial.{702,712,714,715}`.
|
| 12 |
+
- Every root contains successful task-level `COMPLETE` markers for `B`, `D`,
|
| 13 |
+
`S`, `C`, `SC`, `D_order1`, `D_order2`, and `B_order1`.
|
| 14 |
+
- All task-level numerical CSV/NPZ artifacts are byte-identical across the four
|
| 15 |
+
executions.
|
| 16 |
+
- No final root `COMPLETE`, aggregate `REPORT.md`, or aggregate `results.json`
|
| 17 |
+
exists.
|
| 18 |
+
- The four root `validation.json` files are byte-identical and record
|
| 19 |
+
`status=failed`, `formal_complete=false`.
|
| 20 |
+
|
| 21 |
+
Primary evidence root used below:
|
| 22 |
+
|
| 23 |
+
```text
|
| 24 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/results/
|
| 25 |
+
matched_5arm_seed0_20260718.partial.714
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Validation SHA256:
|
| 29 |
+
|
| 30 |
+
```text
|
| 31 |
+
3384049132a128f6548bff123f054c494d74fce9040a8d31adb6bb4724d4399c
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
All numbers below are therefore **diagnostic task-level results**, not yet
|
| 35 |
+
formally publishable aggregate results.
|
| 36 |
+
|
| 37 |
+
## 2. Why Root Aggregation Failed
|
| 38 |
+
|
| 39 |
+
### 2.1 Order-probe metadata mismatch
|
| 40 |
+
|
| 41 |
+
The frozen manifest explicitly registers all three order probes with
|
| 42 |
+
`run_lowpass=false`. The runner correctly evaluates only `unfiltered` and writes
|
| 43 |
+
`protocol.json/constants/lowpass_cutoffs=[]`.
|
| 44 |
+
|
| 45 |
+
The frozen aggregator nevertheless requires every task, including order probes,
|
| 46 |
+
to report the canonical cutoff list `[0.125, 0.25, 0.5, 0.75]`. It rejects
|
| 47 |
+
`D_order1`, `D_order2`, and `B_order1`, then rejects the eight-task contract.
|
| 48 |
+
|
| 49 |
+
This is an implementation-contract inconsistency. It is not a failed GPU run or
|
| 50 |
+
missing measurement.
|
| 51 |
+
|
| 52 |
+
### 2.2 B order-invariance check
|
| 53 |
+
|
| 54 |
+
After compensating for the metadata mismatch in a temporary read-only analysis,
|
| 55 |
+
the stricter B/B_order1 validator still fails:
|
| 56 |
+
|
| 57 |
+
| Quantity | B versus B_order1 |
|
| 58 |
+
|---|---:|
|
| 59 |
+
| Top-1 / Top-5 correct counts | exactly equal |
|
| 60 |
+
| Predictions | exactly equal |
|
| 61 |
+
| Aggregate NLL difference | `1.42e-8` |
|
| 62 |
+
| Aggregate ECE difference | `2.29e-6` |
|
| 63 |
+
| Maximum per-image NLL difference | `5.60e-4` |
|
| 64 |
+
| Maximum per-image confidence difference | `1.75e-4` |
|
| 65 |
+
| Maximum per-image spectral float difference | `1.47e-3` |
|
| 66 |
+
| Near-threshold valid/constant count changes | 1 channel |
|
| 67 |
+
| `source_suppressed` count difference | 4 |
|
| 68 |
+
|
| 69 |
+
The difference is localized to the short final batch. The canonical and salt-1
|
| 70 |
+
orders place two disjoint sets of 80 images in the tail batch. All 49,840 images
|
| 71 |
+
that are full-batch in both runs are bitwise identical. Of the 160-image tail
|
| 72 |
+
union, 157 show an NLL or confidence float difference, while predictions remain
|
| 73 |
+
identical. Exactly 17 of the 4,096 spectral receivers belong to that tail union;
|
| 74 |
+
only those 17 change, and the other 4,079 receivers are bitwise identical.
|
| 75 |
+
|
| 76 |
+
This identifies batch-shape-dependent CUDA floating-point behavior, not a
|
| 77 |
+
meaningful order effect in B. Aggregate block-level non-count scalar differences
|
| 78 |
+
remain below `3.33e-7`, and aggregate transfer-cell differences remain below
|
| 79 |
+
`8e-8`. However, the implemented validator additionally requires row-level
|
| 80 |
+
`1e-6` agreement and exact validity counts, so formal acceptance correctly
|
| 81 |
+
remains denied under that implementation.
|
| 82 |
+
|
| 83 |
+
## 3. Accuracy and Low-Pass Results
|
| 84 |
+
|
| 85 |
+
The registered paired, class-stratified 10,000-replicate bootstrap gives:
|
| 86 |
+
|
| 87 |
+
| Contrast | Top-1 difference | 95% CI |
|
| 88 |
+
|---|---:|---:|
|
| 89 |
+
| D - B | `-24.436 pp` | `[-24.852, -24.024]` |
|
| 90 |
+
| S - B | `-2.024 pp` | `[-2.296, -1.752]` |
|
| 91 |
+
| C - B | `-1.004 pp` | `[-1.274, -0.736]` |
|
| 92 |
+
| SC - C | `-8.286 pp` | `[-8.610, -7.962]` |
|
| 93 |
+
|
| 94 |
+
The measured low-pass curves are:
|
| 95 |
+
|
| 96 |
+
| Arm | Unfiltered | 0.125 | 0.25 | 0.50 | 0.75 |
|
| 97 |
+
|---|---:|---:|---:|---:|---:|
|
| 98 |
+
| B | 78.798 | 55.774 | 71.986 | 77.854 | 78.734 |
|
| 99 |
+
| D | 54.362 | 24.722 | 46.312 | 53.992 | 54.362 |
|
| 100 |
+
| S | 76.774 | 52.460 | 69.752 | 76.208 | 76.842 |
|
| 101 |
+
| C | 77.794 | 52.746 | 70.582 | 77.050 | 77.834 |
|
| 102 |
+
| SC | 69.508 | 40.622 | 61.158 | 69.002 | 69.622 |
|
| 103 |
+
|
| 104 |
+
All arms use high-frequency input information, but high-frequency sensitivity is
|
| 105 |
+
not sufficient to explain clean accuracy: D and SC remain strongly impaired even
|
| 106 |
+
when their internal global spectral quantities are not reduced.
|
| 107 |
+
|
| 108 |
+
## 4. Global Mixing and Energy
|
| 109 |
+
|
| 110 |
+
Block-equal global FFT measurements are:
|
| 111 |
+
|
| 112 |
+
| Arm | Top-1 | `M_off` | `M_res` | Output HF PSD | Clip crossing |
|
| 113 |
+
|---|---:|---:|---:|---:|---:|
|
| 114 |
+
| B | 78.798 | 0.49870 | 0.59710 | 0.42622 | 0.109% |
|
| 115 |
+
| D | 54.362 | 0.47599 | 0.63741 | 0.46490 | 0.475% |
|
| 116 |
+
| S | 76.774 | 0.48950 | 0.61677 | 0.45042 | 0.00012% |
|
| 117 |
+
| C | 77.794 | 0.47316 | 0.72972 | 0.43025 | 0.00008% |
|
| 118 |
+
| SC | 69.508 | 0.44940 | 0.68922 | 0.41232 | 0.602% |
|
| 119 |
+
|
| 120 |
+
For D versus B:
|
| 121 |
+
|
| 122 |
+
- FFT `M_off` is `95.45%` of B: relative difference `-4.554%`, 90% CI
|
| 123 |
+
`[-4.617%, -4.490%]`.
|
| 124 |
+
- `M_res` is `106.75%` of B: relative difference `+6.752%`, 90% CI
|
| 125 |
+
`[+6.683%, +6.819%]`.
|
| 126 |
+
- Protocol raw output RMS is `2.52583` versus `1.60854`, or `157.0%` of B.
|
| 127 |
+
- FFT output high-frequency PSD is `0.46490` versus `0.42622`, or `109.1%`.
|
| 128 |
+
- Conditional FFT `M_off` is `0.57331` versus `0.54344`, or `105.5%`.
|
| 129 |
+
- Top-1 nevertheless falls by `24.436 pp`.
|
| 130 |
+
|
| 131 |
+
Thus D does not fail because raw output energy, normalized high-frequency energy,
|
| 132 |
+
or global mixing simply disappears. The result supports a distinction between
|
| 133 |
+
the **amount** of mixing and the **task-aligned, sample-conditioned organization**
|
| 134 |
+
of that mixing.
|
| 135 |
+
|
| 136 |
+
## 5. Alignment and Gradient Interpretation
|
| 137 |
+
|
| 138 |
+
### Sample alignment
|
| 139 |
+
|
| 140 |
+
D retains substantial global mixing while destroying same-sample carrier-gate
|
| 141 |
+
coupling and losing 24.436 pp. This is the strongest new support for the claim
|
| 142 |
+
that input-conditioned coupling, rather than indiscriminate spectral transfer,
|
| 143 |
+
provides task value.
|
| 144 |
+
|
| 145 |
+
### Channel alignment
|
| 146 |
+
|
| 147 |
+
C has `rho_used` around `0.137`, but loses only 1.004 pp. It retains `94.9%` of
|
| 148 |
+
B's FFT `M_off`, and its `M_res` is `122.2%` of B. Exact channel correspondence is
|
| 149 |
+
therefore helpful but partly adaptable; the result does not support a universal
|
| 150 |
+
necessity claim.
|
| 151 |
+
|
| 152 |
+
### Gate-gradient path
|
| 153 |
+
|
| 154 |
+
S retains the same forward input (`rho_used=1`) but loses 2.024 pp. Under the
|
| 155 |
+
same fixed channel permutation, SC falls 8.286 pp below C. Together these results
|
| 156 |
+
support a contribution from the gate-gradient path to learning and mismatch
|
| 157 |
+
adaptation, distinct from forward gate-feature alignment.
|
| 158 |
+
|
| 159 |
+
## 6. D Order Sensitivity
|
| 160 |
+
|
| 161 |
+
| Quantity | D canonical | D_order1 | D_order2 |
|
| 162 |
+
|---|---:|---:|---:|
|
| 163 |
+
| Top-1 | 54.362 | 54.848 | 54.936 |
|
| 164 |
+
| FFT `M_off` | 0.475991 | 0.475700 | 0.475766 |
|
| 165 |
+
|
| 166 |
+
The alternate-only Top-1 span is `0.088 pp`. The alternate-only FFT `M_off`
|
| 167 |
+
span is `0.0000667`, or `0.0140%` of canonical D. Both are far below the
|
| 168 |
+
registered `2 pp` and `20%` narrowing thresholds.
|
| 169 |
+
|
| 170 |
+
The effect is therefore stable across the two registered alternative orders.
|
| 171 |
+
This does not establish generalization to arbitrary independent gates.
|
| 172 |
+
|
| 173 |
+
## 7. Registered Claim Gate
|
| 174 |
+
|
| 175 |
+
| Condition | Result |
|
| 176 |
+
|---|---|
|
| 177 |
+
| B mixing denominators defined | Pass |
|
| 178 |
+
| Registered accuracy directions | Pass |
|
| 179 |
+
| D retains at least 50% mixing in all three orders | Pass |
|
| 180 |
+
| D is at least 10 pp below B in all three orders | Pass |
|
| 181 |
+
| D quantity-only explanation excluded | Pass |
|
| 182 |
+
| C retains at least 80% mixing and is within 2 pp of B | Pass |
|
| 183 |
+
| SC is at least 3 pp below C | Pass |
|
| 184 |
+
| D/C stage mixing consistency | Pass |
|
| 185 |
+
| FFT/DCT direction agreement | **Fail** |
|
| 186 |
+
|
| 187 |
+
The only scientific gate failure is D-B Stage 1 output high-frequency PSD:
|
| 188 |
+
|
| 189 |
+
```text
|
| 190 |
+
FFT delta: +0.015009
|
| 191 |
+
DCT delta: -0.053384
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
Accordingly:
|
| 195 |
+
|
| 196 |
+
```text
|
| 197 |
+
strong_mechanism_claim_supported = false
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
The global mechanism evidence remains informative, but the paper must not claim
|
| 201 |
+
that every depth and transform basis shows the same directional redistribution.
|
| 202 |
+
|
| 203 |
+
## 8. No Matched-Total-Mixing Claim
|
| 204 |
+
|
| 205 |
+
No intervention arm satisfies the complete registered matched-total-mixing rule:
|
| 206 |
+
|
| 207 |
+
- D: suppressed fraction differs from B by `9.263 pp`, over the `5 pp` limit.
|
| 208 |
+
- S: suppressed fraction differs by `5.971 pp`.
|
| 209 |
+
- C: `M_res` is `+22.211%`, outside the `+/-10%` margin.
|
| 210 |
+
- SC: `M_res` is `+15.429%`, and suppressed fraction differs by `7.017 pp`.
|
| 211 |
+
|
| 212 |
+
Use `substantial`, `nonzero`, or `redistributed` mixing. Do not use `matched
|
| 213 |
+
mixing`, `equal mixing`, or `mixing strength held constant`.
|
| 214 |
+
|
| 215 |
+
## 9. Clipping Conclusion
|
| 216 |
+
|
| 217 |
+
Clip crossing is clearly non-monotonic with clean accuracy: S and C are almost
|
| 218 |
+
never clipped and remain accurate; D and SC cross more often but have very
|
| 219 |
+
different accuracies; B lies between them and is best.
|
| 220 |
+
|
| 221 |
+
The ImageNet result supports only the following role for clipping:
|
| 222 |
+
|
| 223 |
+
- it defines the gate operating range;
|
| 224 |
+
- it controls spectral spill and alias behavior when combined with E1/E2;
|
| 225 |
+
- it is not a monotonic predictor or unique source of clean ImageNet accuracy.
|
| 226 |
+
|
| 227 |
+
Because all five arms use ReLU6, this audit does not compare clipping functions
|
| 228 |
+
and cannot establish a new clipping method contribution.
|
| 229 |
+
|
| 230 |
+
## 10. Journal-Safe Story
|
| 231 |
+
|
| 232 |
+
Recommended claim:
|
| 233 |
+
|
| 234 |
+
> GmNet's gate produces substantial multiplicative spectral mixing, but its task
|
| 235 |
+
> value is not determined by raw energy or total mixing magnitude alone. Severe
|
| 236 |
+
> sample misalignment preserves or increases several global mixing and energy
|
| 237 |
+
> quantities while sharply reducing accuracy, supporting a role for
|
| 238 |
+
> sample-conditioned carrier-gate coupling. Fixed channel mismatch is partly
|
| 239 |
+
> adaptable, and the gate-gradient path contributes to that adaptation. Clipping
|
| 240 |
+
> controls the operating range and spectral spill. Spectral redistribution is
|
| 241 |
+
> depth- and basis-dependent, so no matched-total-mixing or uniform per-stage
|
| 242 |
+
> claim is made.
|
| 243 |
+
|
| 244 |
+
This is stronger and better supported than the previous qualitative story, but
|
| 245 |
+
narrower than the pre-registered strong statement.
|
| 246 |
+
|
| 247 |
+
## 11. Required Follow-Up
|
| 248 |
+
|
| 249 |
+
Do not rerun the current YAML unchanged; four byte-identical executions prove
|
| 250 |
+
that it will deterministically fail again.
|
| 251 |
+
|
| 252 |
+
Recommended recovery sequence:
|
| 253 |
+
|
| 254 |
+
1. Version the aggregator and make order-task cutoff validation respect the
|
| 255 |
+
manifest's `run_lowpass=false` contract.
|
| 256 |
+
2. Resolve the discrepancy between the frozen protocol's aggregate B tolerance
|
| 257 |
+
and the implementation's stricter row-level/exact-definedness requirement.
|
| 258 |
+
Record the decision as an explicit amendment; do not silently relax it.
|
| 259 |
+
3. If aggregate protocol semantics are retained, reaggregate one immutable
|
| 260 |
+
partial root, preserve both validator hashes, run an independent
|
| 261 |
+
`--check-only`, and generate a recovery manifest. No eight-GPU rerun is needed.
|
| 262 |
+
4. If exact row-level invariance remains mandatory, revise the order control to
|
| 263 |
+
use invariant batch packing or a constant-shape padded tail, then rerun the
|
| 264 |
+
affected audit tasks under a new protocol version.
|
| 265 |
+
5. Regardless of the engineering resolution, retain
|
| 266 |
+
`strong_mechanism_claim_supported=false` and the Stage 1 FFT/DCT caveat.
|
| 267 |
+
|
gmnet/project/gmnet_tpami/IMAGENET_MATCHED_SPECTRAL_IMPLEMENTATION_CHECKLIST.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Matched ImageNet Spectral Audit: Implementation Checklist
|
| 2 |
+
|
| 3 |
+
Snapshot: 2026-07-19 UTC
|
| 4 |
+
|
| 5 |
+
## Status
|
| 6 |
+
|
| 7 |
+
**Deployment status: READY FOR FORMAL LAUNCH, NOT SUBMITTED.**
|
| 8 |
+
|
| 9 |
+
**Scientific status: NO FORMAL SPECTRAL RESULT YET.** Local GPU smoke output is
|
| 10 |
+
marked `PARTIAL` and is implementation evidence only. Journal claims may be
|
| 11 |
+
updated only after the formal result root contains `COMPLETE` and a fresh
|
| 12 |
+
aggregator `--check-only` pass reproduces every root artifact byte-for-byte.
|
| 13 |
+
|
| 14 |
+
The frozen training tree `/nfs/ywang29/GmNet/journal_exp` was not modified.
|
| 15 |
+
|
| 16 |
+
## Frozen Identities
|
| 17 |
+
|
| 18 |
+
| Artifact | SHA256 |
|
| 19 |
+
|---|---|
|
| 20 |
+
| Protocol | `b66f0aa2f620135584483fb0057fe6fec9a55b4b501b08fd26065034a892b4a2` |
|
| 21 |
+
| Input manifest | `8b32da7c33f6b578dd2b5359d727afe313462be0c0040212a2640755ad2fadf7` |
|
| 22 |
+
| 4,096-image subset | `52a3e937d8862b19d6352e60833a864aa5bea376436acd2290415cac58232adb` |
|
| 23 |
+
| Formal runner | `2b56465319e651716170fbaa58d43f14924d70f694b0a273ab63255c2697edfe` |
|
| 24 |
+
| Runner tests | `0d520eca7baeec28932fb98fa6b2522207ea434264009f8daadd5d86f65b7004` |
|
| 25 |
+
| Cross-task aggregator | `9027155739ccbeba1150d5bdaa6d94930d8169ed4d4edb5c5fe2af2bd655b5e5` |
|
| 26 |
+
| Generated YAML | `696d3c198cb9bde125fb726b75daac9703136f50ad7dab76a891767de85d87c3` |
|
| 27 |
+
| Deploy manifest | `4ff8001c29a89bdc68c9c3578e354e9808223d6143c9663df8b64130f1e26578` |
|
| 28 |
+
|
| 29 |
+
Code provenance is hard-bound to audit runtime source
|
| 30 |
+
`f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9`
|
| 31 |
+
and alignment training source
|
| 32 |
+
`4a62bc48370247d882196cd9afc1a0f1629a5bbfd522c3f599ffaf0c1187641f`.
|
| 33 |
+
|
| 34 |
+
## Launch Contract
|
| 35 |
+
|
| 36 |
+
- [x] PyTorch `2.9.0+cu130`, torchvision `0.24.0+cu130`, CUDA 13.0 image.
|
| 37 |
+
- [x] Eight A100 tasks: `B:0`, `D:1`, `S:2`, `C:3`, `SC:4`,
|
| 38 |
+
`D_order1:5`, `D_order2:6`, and `B_order1:7`.
|
| 39 |
+
- [x] Canonical batch size 256 with the 80-image tail preserved.
|
| 40 |
+
- [x] ImageNet is downloaded from the registered S3 archive and staged at
|
| 41 |
+
`/tmp/gmnet_data/imagenet-1k` before inference.
|
| 42 |
+
- [x] Non-data code, manifests, checkpoints, deployment files, and outputs stay
|
| 43 |
+
under `/nfs/ywang29/GmNet`.
|
| 44 |
+
- [x] The LongLive `init_run.sh` export block, including the empty
|
| 45 |
+
`LD_LIBRARY_PATH`, is byte-identical and statically checked.
|
| 46 |
+
- [x] The generator only writes YAML/JSON. Neither pre-run nor command contains
|
| 47 |
+
a `launchjob` invocation.
|
| 48 |
+
|
| 49 |
+
## Runner Contract
|
| 50 |
+
|
| 51 |
+
- [x] All five canonical arms run a true unfiltered bypass plus four registered
|
| 52 |
+
Butterworth low-pass cutoffs on all 50,000 validation images.
|
| 53 |
+
- [x] All eight tasks use one frozen 4,096-receiver subset with class histogram
|
| 54 |
+
904 classes x 4 and 96 classes x 5.
|
| 55 |
+
- [x] D uses the full ordered 50,000-image stream before selecting spectral
|
| 56 |
+
receiver rows and records per-block donor bijection, shift, hashes, zero fixed
|
| 57 |
+
points, and receiver coverage.
|
| 58 |
+
- [x] Exact unfiltered Top-1/Top-5 integer replay is required for every arm.
|
| 59 |
+
- [x] FFT and orthonormal DCT-II emit normalized PSD, JSD, coherence,
|
| 60 |
+
output-minus-carrier deltas, `M_res`, 4x4 transfer, `M_off`, and `M_disp` for
|
| 61 |
+
every one of 17 blocks.
|
| 62 |
+
- [x] Normalized PSD/JSD/residual/suppression reductions are image-equal;
|
| 63 |
+
coherence/transfer reductions are image-within-class then class-equal.
|
| 64 |
+
- [x] Raw amplitude and gate operating diagnostics use finite-aware float64
|
| 65 |
+
conventional midpoint medians over channels, including the even-channel case.
|
| 66 |
+
- [x] Constant gates and suppressed outputs are legitimate states. Undefined
|
| 67 |
+
normalized quantities are blank with explicit validity counts; valid source
|
| 68 |
+
rows suppressed to zero remain zero rows in primary transfer.
|
| 69 |
+
- [x] The runner records complete package lock, source hashes, manifest hashes,
|
| 70 |
+
checkpoint/config identities, numerical tests, and artifact hashes.
|
| 71 |
+
|
| 72 |
+
## Aggregation Contract
|
| 73 |
+
|
| 74 |
+
- [x] Five-arm canonical accuracy is exactly 25 rows; three order-probe accuracy
|
| 75 |
+
rows are isolated in a separate table.
|
| 76 |
+
- [x] Canonical block spectra are exactly 170 wide rows and canonical stage
|
| 77 |
+
summaries are exactly 120 rows; order-probe block spectra are 102 separate rows.
|
| 78 |
+
- [x] Accuracy uses a shared 50,000-image, 1,000-class stratified 10,000-replicate
|
| 79 |
+
bootstrap. Spectral contrasts reuse one shared 4,096-receiver class-stratified
|
| 80 |
+
resample across arms and blocks.
|
| 81 |
+
- [x] Per-cell primary/conditional transfer intervals and per-block scalar
|
| 82 |
+
`M_off`, `M_disp`, `M_res`, suppression, and validity intervals are emitted.
|
| 83 |
+
- [x] `d_order_sensitivity_by_block.csv` has exactly 34 rows and 2,093 columns;
|
| 84 |
+
it keeps canonical D separate and derives fail-closed alternate ranges only
|
| 85 |
+
from `D_order1` and `D_order2`, including raw and transfer diagnostics.
|
| 86 |
+
- [x] B/B_order1 invariance is checked after canonical-index alignment across
|
| 87 |
+
accuracy rows, every spectral NPZ member, and the complete block-summary
|
| 88 |
+
registry; only registered task/order identity fields may differ.
|
| 89 |
+
- [x] Sparse legitimate invalid rows use explicit valid masks. Undefined claim
|
| 90 |
+
inputs close the corresponding claim and add narrowing text; they do not make
|
| 91 |
+
a mechanically valid audit crash.
|
| 92 |
+
- [x] D may be described only over the three registered orders. The output can
|
| 93 |
+
never claim generalization to arbitrary independent gates.
|
| 94 |
+
- [x] Six deterministic pure-SVG paper assets and a linked `REPORT.md` are
|
| 95 |
+
mandatory.
|
| 96 |
+
- [x] The aggregator never writes root `COMPLETE`.
|
| 97 |
+
|
| 98 |
+
## Required Root Output
|
| 99 |
+
|
| 100 |
+
The wrapper denies completion unless the root includes protocol/input/environment/
|
| 101 |
+
checkpoint/subset provenance; canonical and order-probe CSVs; accuracy and
|
| 102 |
+
spectral NPZs; raw, gate, coherence, transfer, bootstrap, block, and stage tables;
|
| 103 |
+
six SVGs; `REPORT.md`; `results.json`; `validation.json`; pairing evidence; and
|
| 104 |
+
`source_artifacts.sha256`.
|
| 105 |
+
|
| 106 |
+
After normal aggregation, a separate `--check-only` pass must reproduce all
|
| 107 |
+
bytes. Immediately before registration, runner, aggregator, and input manifest
|
| 108 |
+
are rehashed against frozen values. Only the wrapper then writes `COMPLETE` and
|
| 109 |
+
atomically moves the partial directory into place.
|
| 110 |
+
|
| 111 |
+
## Verification Completed
|
| 112 |
+
|
| 113 |
+
- [x] Runner: 21/21 tests pass under `-W error`; Python compilation passes.
|
| 114 |
+
- [x] Final B GPU smoke passes matching `--nonformal-smoke --check-only` and is
|
| 115 |
+
bound to the final runner SHA. Its `PARTIAL` marker is intentional.
|
| 116 |
+
- [x] Independent runner review reports no blocker and independently verifies
|
| 117 |
+
normalized PSD, coherence, transfer, paired deltas, and artifact hashes.
|
| 118 |
+
- [x] Aggregator: Python compilation and all 30 self-tests pass.
|
| 119 |
+
- [x] A two-image, eight-task end-to-end fixture builds all tables, six SVGs,
|
| 120 |
+
and `REPORT.md`; all publishability checks pass and B/B_order1 agree across
|
| 121 |
+
8,160 aligned aggregate values.
|
| 122 |
+
- [x] Input verification passes all five checkpoints, official certificates,
|
| 123 |
+
C/SC permutation identity, subset, protocol, source identities, and runner hash.
|
| 124 |
+
- [x] Alignment snapshot reconstruction and the original mechanism deployment
|
| 125 |
+
generator `--check` pass.
|
| 126 |
+
- [x] Deploy generator write, generator `--check`, wrapper `bash -n`, and
|
| 127 |
+
`static_check.py --require-generated` pass.
|
| 128 |
+
|
| 129 |
+
## Remaining Scientific Work
|
| 130 |
+
|
| 131 |
+
- [ ] Submit the generated YAML and wait for all eight tasks plus aggregation.
|
| 132 |
+
- [ ] Require formal PyTorch 2.9 source-equivalence evidence and root `COMPLETE`.
|
| 133 |
+
- [ ] Interpret the measured output strictly through the registered claim gate.
|
| 134 |
+
- [ ] Add seeds 1/2 before making population-level training claims.
|
| 135 |
+
- [ ] Use a detached-batch intervention for a cleaner forward-alignment causal
|
| 136 |
+
claim; the current D arm remains batch/order dependent.
|
| 137 |
+
- [ ] Run corrected learned/adaptive clipping with robustness and latency before
|
| 138 |
+
claiming a new clipping method contribution.
|
| 139 |
+
|
| 140 |
+
## Paths
|
| 141 |
+
|
| 142 |
+
```text
|
| 143 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/
|
| 144 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/e4_matched_spectral_5arms_seed0.yaml
|
| 145 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/deploy_manifest.json
|
| 146 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/results/matched_5arm_seed0_20260718
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
The last result path does not exist yet. Deployment readiness is not scientific
|
| 150 |
+
completion.
|
gmnet/project/gmnet_tpami/IMAGENET_V2_PREGATE_CONCLUSIONS.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ImageNet v2 CIFAR-100 Pre-Gate Evidence
|
| 2 |
+
|
| 3 |
+
Decision: **PASS**. This is a technical/controller pre-gate, not an accuracy-selection rule.
|
| 4 |
+
|
| 5 |
+
All runs completed 100 fixed epochs and full clean plus five-corruption evaluation. Intervals use the three paired training seeds; n=3 intervals are necessarily wide.
|
| 6 |
+
|
| 7 |
+
| Variant | Clean Top-1 effect | Mean-corruption Top-1 effect | Clean NLL effect | Corruption NLL effect |
|
| 8 |
+
|---|---:|---:|---:|---:|
|
| 9 |
+
| smooth_corrected | +0.587 [-0.522, +1.695] | -0.342 [-4.068, +3.384] | -0.165 [-0.299, -0.031] | -0.168 [-0.239, -0.098] |
|
| 10 |
+
| relu6_only | +1.137 [-1.130, +3.403] | +0.853 [-2.326, +4.033] | -0.067 [-0.189, +0.055] | -0.087 [-0.252, +0.079] |
|
| 11 |
+
|
| 12 |
+
## Controller Audit
|
| 13 |
+
|
| 14 |
+
The learned-smooth minimum cap across seeds/blocks is `1.6864`; the predefined severe-collapse boundary is `0.6000`. Controller non-collapse: `True`.
|
| 15 |
+
The fixed-c6 controller remains at 6.0: `True`.
|
| 16 |
+
|
| 17 |
+
The old learned-cap collapse cannot be interpreted as adaptation because `raw_clip` received weight decay. With zero controller weight decay, caps remain finite and stage-dependent, so corrected learned-smooth is eligible for ImageNet.
|
| 18 |
+
|
| 19 |
+
## Design Consequence
|
| 20 |
+
|
| 21 |
+
Activation-only does not show the locally expected material loss. Its ImageNet test must therefore not be an early fixed-sequence gate that suppresses the ReLU and smooth hypotheses. Treat the four predeclared primary contrasts with simultaneous family-wise correction, and interpret activation-only as an operator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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ImageNet Long-Run Protocol v2
|
| 2 |
+
|
| 3 |
+
## Why The Matrix Changed
|
| 4 |
+
|
| 5 |
+
The local CIFAR-100 results support the complete gated operator but do not show
|
| 6 |
+
a unique ReLU6 advantage over ReLU, GELU, or the original learned-smooth run.
|
| 7 |
+
They also show that high-frequency energy alone does not explain accuracy. The
|
| 8 |
+
original learned-smooth thresholds were trained with weight decay on
|
| 9 |
+
`raw_clip`, so their absolute values are potentially regularization-confounded.
|
| 10 |
+
They motivate the corrected experiment but are not evidence that the corrected
|
| 11 |
+
controller will learn the same thresholds.
|
| 12 |
+
|
| 13 |
+
The long-run matrix therefore tests a narrower claim: replacing the structured
|
| 14 |
+
multiplicative operator can materially affect accuracy, while gate shape and
|
| 15 |
+
clipping are comparative mechanisms rather than assumed improvements. The
|
| 16 |
+
term "protocol v2" refers to this experiment revision, not the ImageNet-V2
|
| 17 |
+
natural-shift dataset.
|
| 18 |
+
|
| 19 |
+
| Gate | Purpose and claim boundary |
|
| 20 |
+
|---|---|
|
| 21 |
+
| ReLU6 self-gate | canonical anchor |
|
| 22 |
+
| ReLU self-gate | remove clipping while preserving rectification and multiplication |
|
| 23 |
+
| corrected learned-smooth | learn a smooth clipping threshold with `raw_clip` excluded from weight decay |
|
| 24 |
+
| ReLU6-only | matched-training operator replacement; it removes self-multiplication but also changes activation scale, gradients, and learned representations |
|
| 25 |
+
| no-gate | remove the complete gating nonlinearity and multiplication |
|
| 26 |
+
| fixed-smooth-c6, seed 0 only | distinguish smooth parameterization from threshold learning |
|
| 27 |
+
|
| 28 |
+
All shared model weights use the same paper recipe. Zero weight decay for the
|
| 29 |
+
learned-smooth scalar controller is an explicit controller treatment, not a
|
| 30 |
+
change to regularization of shared weights. GELU is omitted because the revised
|
| 31 |
+
matrix separates clipping, rectification, and multiplication more directly.
|
| 32 |
+
|
| 33 |
+
## Anchor And Reproduction
|
| 34 |
+
|
| 35 |
+
The canonical target is `79.3` Top-1 from the conference main table and
|
| 36 |
+
ablation. The conflicting `81.3` introduction value is recorded as a manuscript
|
| 37 |
+
discrepancy and is not used as a launch threshold.
|
| 38 |
+
|
| 39 |
+
The seed-0 anchor has two separate reviews:
|
| 40 |
+
|
| 41 |
+
1. **Technical QC** requires the paper-default 7,791,544-parameter topology,
|
| 42 |
+
exact 1,281,167/50,000 sample counts, fixed final checkpoint, matching
|
| 43 |
+
config/data fingerprints, finite artifacts, and strict official-evaluation
|
| 44 |
+
validation.
|
| 45 |
+
2. **Accuracy sanity** requires seed-0 Top-1 in `[78.8, 79.8]`. This broad
|
| 46 |
+
window protects long-run resources; it is not a statistical reproduction
|
| 47 |
+
claim.
|
| 48 |
+
|
| 49 |
+
Formal baseline reporting uses all three ReLU6 seeds. Report each seed, mean,
|
| 50 |
+
sample standard deviation, and a two-sided 95% confidence interval. Record
|
| 51 |
+
whether the mean is within `79.3 +/- 0.2` pp, but do not call this a test of
|
| 52 |
+
equality to a published point estimate whose run uncertainty is unavailable.
|
| 53 |
+
|
| 54 |
+
## Confirmatory Analysis
|
| 55 |
+
|
| 56 |
+
All five S3 variants use the fixed final checkpoint and seeds 0/1/2. Clean
|
| 57 |
+
ImageNet validation Top-1 is the only primary endpoint. Effects are candidate
|
| 58 |
+
minus ReLU6 in percentage points. Identical seed IDs and validation images are
|
| 59 |
+
paired. Confirmatory inference uses paired seed-level t tests with training seed
|
| 60 |
+
as the statistical unit. A 2,000-replicate hierarchical paired bootstrap
|
| 61 |
+
resamples training seeds and paired validation images only as a supplemental
|
| 62 |
+
sample-sensitivity interval; it does not replace seed-level inference. The
|
| 63 |
+
three per-seed effects and their sample standard deviation remain mandatory.
|
| 64 |
+
|
| 65 |
+
Familywise alpha is `0.05`, controlled by hierarchical gatekeeping. The fixed
|
| 66 |
+
entry gate is no-gate minus ReLU6: its one-sided test must reject at alpha
|
| 67 |
+
`0.05` and the two-sided 95% paired-seed confidence interval upper endpoint
|
| 68 |
+
must be below `-1.0` pp. If it fails, every downstream result is exploratory.
|
| 69 |
+
|
| 70 |
+
If the entry gate passes, three downstream hypotheses form a parallel Holm
|
| 71 |
+
family. Failure of one does not block the other two:
|
| 72 |
+
|
| 73 |
+
1. ReLU6-only minus ReLU6 non-inferiority: Holm-adjusted one-sided p-value
|
| 74 |
+
below `0.05` and the two-sided 95% paired-seed interval lower endpoint above
|
| 75 |
+
`-0.3` pp.
|
| 76 |
+
2. ReLU minus ReLU6 equivalence: Holm-adjusted TOST p-value below `0.05` and,
|
| 77 |
+
conservatively, the two-sided 95% interval contained in `[-0.3, 0.3]` pp.
|
| 78 |
+
3. Corrected learned-smooth minus ReLU6 non-inferiority: Holm-adjusted
|
| 79 |
+
one-sided p-value below `0.05` and the two-sided 95% interval lower endpoint
|
| 80 |
+
above `-0.2` pp.
|
| 81 |
+
|
| 82 |
+
The margins were fixed before ImageNet results. One percentage point denotes a
|
| 83 |
+
material necessity effect, 0.3 pp a negligible gate-shape difference, and 0.2
|
| 84 |
+
pp the maximum allowed learned-smooth degradation. They are protocol decision
|
| 85 |
+
thresholds, not universal practical-significance constants.
|
| 86 |
+
|
| 87 |
+
The activation-only hypothesis is non-inferiority, not a predeclared claim that
|
| 88 |
+
multiplication must cause a material accuracy gain. ReLU6-only estimates the
|
| 89 |
+
total effect of replacing the trained operator. It does not uniquely attribute
|
| 90 |
+
an accuracy difference to spectral mixing, and it does not establish training-
|
| 91 |
+
time causality for sample, spatial, or channel alignment. Those claims still
|
| 92 |
+
require the separately matched E4 retraining protocol.
|
| 93 |
+
|
| 94 |
+
## Secondary Analysis
|
| 95 |
+
|
| 96 |
+
The only hypothesis-tested secondary family is classification quality:
|
| 97 |
+
`Top-5`, `NLL`, and `ECE` for each of ReLU, corrected learned-smooth,
|
| 98 |
+
ReLU6-only, and no-gate versus ReLU6. Apply Holm correction within these 12
|
| 99 |
+
unique hypotheses at alpha `0.05`; aliases count once.
|
| 100 |
+
|
| 101 |
+
Learned clip values and clip-crossing fractions are descriptive diagnostics.
|
| 102 |
+
S1/S2/S4 ReLU6 results are single-seed descriptive context for Top-1,
|
| 103 |
+
parameters, and FLOPs. They do not support a scale trend, cross-scale gate
|
| 104 |
+
effect, or multi-seed scaling claim.
|
| 105 |
+
|
| 106 |
+
Corruption and frequency endpoints are deferred because their ImageNet data,
|
| 107 |
+
runner, and aggregation rules are not frozen in this 21-task protocol. Partial
|
| 108 |
+
local corruptions and post hoc frequency summaries remain exploratory. A future
|
| 109 |
+
amendment must define corruption types as the mechanism-level inference units,
|
| 110 |
+
deduplicate metric aliases, and register each family before evaluation.
|
| 111 |
+
|
| 112 |
+
## Phases And Unlocks
|
| 113 |
+
|
| 114 |
+
| Phase | Work | Unlock condition |
|
| 115 |
+
|---|---|---|
|
| 116 |
+
| 0 | S3 ReLU6 seed-0 anchor | initially allowed; pass technical QC and accuracy sanity |
|
| 117 |
+
| 1 | non-anchor gate seed-0 runs | manual anchor review passes; learned-smooth also requires external `smooth_local_pregate=passed` evidence |
|
| 118 |
+
| 2 | seeds 1/2 for every predeclared gate | corresponding seed-0 run is technically valid |
|
| 119 |
+
| 3 | fixed-c6 and S1/S2/S4 seed-0 diagnostics | named prerequisite is technically valid |
|
| 120 |
+
| 4 | two recipe audits | explicit discrepancy condition is documented |
|
| 121 |
+
|
| 122 |
+
"Technically valid" means protocol adherence, completeness, and finite
|
| 123 |
+
artifacts. It never depends on seed-0 accuracy or effect direction; therefore
|
| 124 |
+
seed-0 results cannot be used to select which predeclared seeds 1/2 are run.
|
| 125 |
+
|
| 126 |
+
The external smooth pre-gate has passed manual review using
|
| 127 |
+
`/nfs/ywang29/GmNet/local_results/imagenet_v2_pregate/CONCLUSIONS.md`: all 7/7
|
| 128 |
+
runs are complete and finite, the learned cap minimum `1.6864` exceeds the
|
| 129 |
+
predefined severe-collapse boundary `0.6`, and fixed-c6 remains `6.0`. The
|
| 130 |
+
ImageNet smooth seed-0 task remains held behind the internal anchor
|
| 131 |
+
prerequisite. A single-seed 0.2 pp accuracy cutoff is not used.
|
| 132 |
+
|
| 133 |
+
## Recipe Audits
|
| 134 |
+
|
| 135 |
+
The release-paper-BN audit is conditional on technical QC passing while the
|
| 136 |
+
anchor misses `[78.8, 79.8]`. It changes a recipe bundle: weight decay, CutMix,
|
| 137 |
+
DropPath, and the 310-epoch schedule including cooldown. It can compare the
|
| 138 |
+
paper recipe with the released bundle, but cannot identify one hyperparameter
|
| 139 |
+
as causal. It still uses this repository's data/augmentation/training loop, so
|
| 140 |
+
it is an approximation of the released README bundle rather than a release-exact
|
| 141 |
+
replay of timm scheduler call timing and augmentation order.
|
| 142 |
+
|
| 143 |
+
Only if the release-paper-BN bundle remains outside the registered reproduction
|
| 144 |
+
tolerance may the matched release-full-BN run be unlocked. That second audit
|
| 145 |
+
tests whether topology contributes to the remaining discrepancy; topology is
|
| 146 |
+
not declared responsible before the run. Both are single-seed diagnostics and
|
| 147 |
+
are excluded from the confirmatory gate family.
|
| 148 |
+
|
| 149 |
+
## Operational Contract
|
| 150 |
+
|
| 151 |
+
The canonical data source is
|
| 152 |
+
`s3://snap-research-cv-code/ywang29/datasets/imagenet-1k/`, read through
|
| 153 |
+
`/s3-code/ywang29/datasets/imagenet-1k`. Its frozen manifest is
|
| 154 |
+
`/nfs/ywang29/GmNet/depoly/imagenet_v2/data_manifest_canonical.json` with
|
| 155 |
+
SHA-256 `bb70bc9f530db6bb24f70e648624b35281bfbc76a57775d589a2e0209dd98661`.
|
| 156 |
+
It covers the complete relative-path/target index and one raw-file content
|
| 157 |
+
sample per class for both train and validation.
|
| 158 |
+
|
| 159 |
+
Complete-epoch resume restores each rank's Python, NumPy, torch CPU/CUDA, and
|
| 160 |
+
DataLoader-generator RNG streams. Persistent DataLoader workers are disabled.
|
| 161 |
+
This is RNG-exact state restoration; because the registered recipe retains
|
| 162 |
+
nondeterministic CUDA kernels, it is not presented as bitwise floating-point
|
| 163 |
+
replay.
|
| 164 |
+
|
| 165 |
+
The machine-readable source of truth is
|
| 166 |
+
`configs/imagenet_v2_protocol.yaml`. Generated task IDs, launchjob names, and
|
| 167 |
+
output directories use the `imv2` namespace under
|
| 168 |
+
`/nfs/ywang29/GmNet/runs/imagenet_v2`. The generated
|
| 169 |
+
`/nfs/ywang29/GmNet/depoly/task_matrix.yaml` records internal dependencies,
|
| 170 |
+
external prerequisites, status, resolved-config semantics, and decision rules.
|
| 171 |
+
|
| 172 |
+
Only `imv2_e0_s3_relu6_seed0` is initially submit-ready. Every generated
|
| 173 |
+
`held` or `conditional` YAML checks `GMNET_PROTOCOL_UNLOCK_TASK` before setup or
|
| 174 |
+
training and exits with code 64 unless its value exactly equals that task ID.
|
| 175 |
+
The token may be supplied only after the documented manual review. Preparing 21
|
| 176 |
+
YAMLs does not authorize batch submission, and the generator never calls
|
| 177 |
+
`launchjob`.
|
gmnet/project/gmnet_tpami/LOCAL_EXPERIMENT_CONCLUSIONS.md
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet Journal 本地实验结论
|
| 2 |
+
|
| 3 |
+
更新时间:2026-07-13 UTC
|
| 4 |
+
|
| 5 |
+
## 1. 执行范围与状态
|
| 6 |
+
|
| 7 |
+
本轮完成了当前节点、现有数据和现有 checkpoint 能够严谨执行的本地实验。
|
| 8 |
+
训练或评估输出保留在 `/tmp/gmnet_runs/`,可复核的小型结果表、JSON 和
|
| 9 |
+
Markdown 已归档到 `/nfs/ywang29/GmNet/local_results/20260712/`。
|
| 10 |
+
|
| 11 |
+
| 实验 | 本地状态 | 主要交付物 | 结论用途 |
|
| 12 |
+
|---|---|---|---|
|
| 13 |
+
| E0 environment/DDP smoke | 完成 | 单卡和 8 卡 DDP 均成功 | 只证明训练链路可运行 |
|
| 14 |
+
| E1 operator spectral audit | 完成 | 1,080 条频谱记录,5 seeds | 验证频率测量与算子机制 |
|
| 15 |
+
| E1 trained-feature audit | 完成 | 6 gates x 3 seeds x 10k | 检验训练后频谱与准确率关系 |
|
| 16 |
+
| E2 synthetic mechanism | 完成 | 5 seeds,5,610 条观测 | 分离谐波、alias、clipping 和 cue coupling |
|
| 17 |
+
| E3 CIFAR-100 gate screen | 完成 | 18 个 100-epoch run | clean、5 corruption、paired bootstrap |
|
| 18 |
+
| ImageNet-v2 local pre-gate | 完成 | 7 个 100-epoch run | corrected smooth、fixed-c6、activation-only |
|
| 19 |
+
| E4 frozen intervention | 完成 | ReLU6 三 seeds,全 10k test | gate alignment 敏感性诊断 |
|
| 20 |
+
| Legacy ImageNet clean | 完成 | 50k validation | historical checkpoint 兼容性结果 |
|
| 21 |
+
| E6 partial corruption | 完成 | 类均衡 5,000 图 | 自定义 corruption 局部结论 |
|
| 22 |
+
| E8 partial attack | 完成 | 类均衡 1,000 图 | PGD-10 与等 L2 频带攻击 |
|
| 23 |
+
| E12 local deployment | 完成 | 5 个独立进程 | A100、CPU、ONNX Runtime |
|
| 24 |
+
| E7/E9/E10 | 当前不可运行 | 数据或正式 runner 缺失 | 不产生结果 |
|
| 25 |
+
| ImageNet-v2 long runs | 超过 12 小时 | revised 21-task staged matrix | 仅 anchor 可提交,尚未提交 |
|
| 26 |
+
|
| 27 |
+
所有 CIFAR-100 模型均使用固定第 100 轮 `checkpoint_last.pt`。没有使用
|
| 28 |
+
CIFAR-100 test set 选择 `checkpoint_best.pt`。E3 的主要差异采用 2,000 次
|
| 29 |
+
hierarchical paired bootstrap,同时重采样训练 seed 和配对测试样本。
|
| 30 |
+
|
| 31 |
+
## 2. 总体科学结论
|
| 32 |
+
|
| 33 |
+
本地证据支持的主线不是“高频能量越多,分类越好”,而是:
|
| 34 |
+
|
| 35 |
+
1. 自乘 gate 会产生可重复的跨频率混合,线性 no-gate 对照不会产生新谐波。
|
| 36 |
+
2. 完全移除 gate 会显著降低分类准确率,但 activation-only retraining 并未下降;
|
| 37 |
+
因此本地结果支持 gated operator 的作用,不支持“乘法本身对最终准确率必要”。
|
| 38 |
+
ReLU6、ReLU、GELU 和 smooth-static 的 primary Top-1 也没有显著差异。
|
| 39 |
+
3. 训练得到的样本、空间和通道对齐比总高频能量更重要。破坏对齐会使冻结模型
|
| 40 |
+
接近随机,而 no-gate 模型虽然有更高的 feature PSD centroid,准确率却最低。
|
| 41 |
+
4. clipping 能控制算子频谱,但标准 ReLU6 在训练模型中很少真正到达 6。旧
|
| 42 |
+
smooth gate 的 0.8 至 1.2 阈值受 `raw_clip` weight decay 混杂,不能解释为
|
| 43 |
+
主动适应;zero-WD 重跑得到稳定且分 stage 的 1.69 至 6.0 阈值。
|
| 44 |
+
5. 当前 checkpoint 对普通 corruption 有一定保持率,但对 PGD-10 不鲁棒。
|
| 45 |
+
频带攻击只证明当前较强等 L2 预算下各频带都能破坏模型,不证明独特的高频脆弱性。
|
| 46 |
+
|
| 47 |
+
因此 journal 的稳健叙事应改为:**input-dependent multiplicative spectral mixing、
|
| 48 |
+
learned alignment 和 controllable clipping**,而不是把 raw high-frequency energy
|
| 49 |
+
直接等同于有效语义或准确率来源。
|
| 50 |
+
|
| 51 |
+
## 3. E1:频谱测量与训练后特征
|
| 52 |
+
|
| 53 |
+
### 3.1 测量协议审计
|
| 54 |
+
|
| 55 |
+
- FFT、DCT-II 和 Haar 的全逆变换/分带重构最大误差为 `8.53e-14`。
|
| 56 |
+
- 三种基底对 paired frequency shift 的排序一致,最低 Spearman `rho=0.933`。
|
| 57 |
+
- 高幅输入下,ReLU6 相比 ReLU 将 gate-only frequency-AUC 增量从
|
| 58 |
+
`0.06220` 降至 `0.05248`,降幅为 `15.6%`。
|
| 59 |
+
- smooth-clipped 与 ReLU6 的该指标只差 `3.44e-5`。
|
| 60 |
+
- 随机初始化 block 的 gate 前值达到 6 的比例仅 `0.00427%`,ReLU6 与 ReLU
|
| 61 |
+
residual branch 的频谱差仅 `3.31e-5`。这说明未经训练时 cap 几乎不生效。
|
| 62 |
+
|
| 63 |
+
该结果验证了测量工具和 clipping 对高幅输入的机制效应,但 energy AUC 不是分类
|
| 64 |
+
准确率,也不是模型函数频率。
|
| 65 |
+
|
| 66 |
+
### 3.2 训练模型的 Frequency-Accuracy AUC
|
| 67 |
+
|
| 68 |
+
| Gate | Clean Top-1 (%) | Frequency-Accuracy AUC |
|
| 69 |
+
|---|---:|---:|
|
| 70 |
+
| ReLU | 57.53 +/- 0.97 | 43.416 +/- 0.363 |
|
| 71 |
+
| smooth-static | 57.15 +/- 1.44 | 43.380 +/- 0.765 |
|
| 72 |
+
| ReLU6 | 57.07 +/- 1.62 | 43.174 +/- 1.237 |
|
| 73 |
+
| GELU | 57.04 +/- 0.47 | 43.525 +/- 0.328 |
|
| 74 |
+
| identity self-gate | 56.91 +/- 0.73 | 43.162 +/- 0.473 |
|
| 75 |
+
| no-gate | 43.07 +/- 0.31 | 32.761 +/- 0.145 |
|
| 76 |
+
|
| 77 |
+
no-gate 的 stage1/stage2 spectral centroid 为 `0.363/0.489`,高于 ReLU6 的
|
| 78 |
+
`0.304/0.454`,但其 Top-1 低约 14 pp。这直接否定“高频能量越多,识别越好”
|
| 79 |
+
的强主张。更高的 PSD centroid 可能对应无用细节、alias 或未对齐能量。
|
| 80 |
+
|
| 81 |
+
ReLU6 的实际 clip crossing 主要集中于 stage1,为 `0.430%`,后续 stage
|
| 82 |
+
接近 0。旧 smooth-static 的 stage1 到 stage4 clip 均值为
|
| 83 |
+
`1.19/1.21/0.95/0.81`,实际 crossing 为 `5.64%/0.52%/0.31%/0.49%`。
|
| 84 |
+
由于该 run 对 `raw_clip` 施加了 weight decay,这些绝对阈值只说明旧模型实际发生
|
| 85 |
+
了 clipping,不能证明阈值下降来自任务自适应。ReLU6 在深层仍近似 ReLU。
|
| 86 |
+
|
| 87 |
+
identity gate 在 soft-low-pass 后的 stage3 出现 6 个非有限观测,共影响 36 个
|
| 88 |
+
PSD 派生字段。正式聚合仅使用 finite 值,全非有限统计记为 JSON `null`/报告 `NA`,
|
| 89 |
+
并单独保存诊断;identity 的部分 filtered-feature 证据应视为不完整。
|
| 90 |
+
|
| 91 |
+
## 4. E2:受控合成机制
|
| 92 |
+
|
| 93 |
+
E2 在 128 x 128 周期信号上运行 5 seeds,共 5,610 条观测。
|
| 94 |
+
|
| 95 |
+
| Gate | 单频带外能量 | 随机场带外转移 |
|
| 96 |
+
|---|---:|---:|
|
| 97 |
+
| no-gate | 0 | 0 |
|
| 98 |
+
| ReLU6 | 0.5168 | 0.4361 |
|
| 99 |
+
| ReLU | 0.5194 | 0.4361 |
|
| 100 |
+
| smooth-clipped | 0.5152 | 0.4360 |
|
| 101 |
+
| GELU | 0.6419 | 0.4862 |
|
| 102 |
+
| identity self-gate | 1.0000 | 0.7710 |
|
| 103 |
+
|
| 104 |
+
单频 alias fraction 中 ReLU6 为 `0.06244`,ReLU 为 `0.06536`,约降低
|
| 105 |
+
`4.5%`;这支持 clipping 小幅抑制 alias,但不是经过 multiple-comparison
|
| 106 |
+
校正的确认性对比。幅值增加到 9 后,ReLU6 和 smooth-clipped 的带外能量均为
|
| 107 |
+
`0.5062`,ReLU 保持 `0.5194`,说明进入裁剪区后 smooth 近似能复现 ReLU6。
|
| 108 |
+
|
| 109 |
+
低频 cue 相位翻转会使 ReLU6/ReLU 的高频读出改变约 `2.12%`,smooth 为
|
| 110 |
+
`2.02%`,no-gate 为 0,支持非线性交叉频率耦合。绝对相位敏感性接近 0,
|
| 111 |
+
因此不能将该现象解释为平移不变性失效。随机场 Frequency-AUC 与 cue-preference
|
| 112 |
+
没有显示 ReLU6 的普遍高频偏好。
|
| 113 |
+
|
| 114 |
+
## 5. E3:CIFAR-100 gate screening
|
| 115 |
+
|
| 116 |
+
### 5.1 三 seed 汇总
|
| 117 |
+
|
| 118 |
+
| Gate | Clean Top-1 | Mean corruption Top-1 | Retention | Clean NLL |
|
| 119 |
+
|---|---:|---:|---:|---:|
|
| 120 |
+
| ReLU6 | 57.07 +/- 1.62 | 38.08 +/- 1.41 | 66.75 +/- 2.75 | 2.20 +/- 0.11 |
|
| 121 |
+
| ReLU | 57.53 +/- 0.97 | 37.50 +/- 0.90 | 65.19 +/- 2.40 | 2.11 +/- 0.04 |
|
| 122 |
+
| GELU | 57.04 +/- 0.47 | 38.24 +/- 1.36 | 67.05 +/- 2.64 | 2.33 +/- 0.03 |
|
| 123 |
+
| smooth-static | 57.15 +/- 1.44 | 38.39 +/- 0.73 | 67.22 +/- 2.73 | 2.15 +/- 0.06 |
|
| 124 |
+
| identity | 56.91 +/- 0.73 | 38.22 +/- 0.54 | 67.17 +/- 1.33 | 数值失稳 |
|
| 125 |
+
| no-gate | 43.07 +/- 0.31 | 26.27 +/- 0.32 | 61.00 +/- 1.11 | 2.23 +/- 0.01 |
|
| 126 |
+
|
| 127 |
+
相对 ReLU6 的 paired-bootstrap primary Top-1 差异如下:
|
| 128 |
+
|
| 129 |
+
| Gate | Clean 差异 [95% CI] | Corruption 差异 [95% CI] | 结论 |
|
| 130 |
+
|---|---:|---:|---|
|
| 131 |
+
| ReLU | +0.47 [-1.05, 2.03] | -0.58 [-2.37, 1.52] | 不显著 |
|
| 132 |
+
| GELU | -0.03 [-1.61, 1.83] | +0.16 [-1.12, 1.60] | 不显著 |
|
| 133 |
+
| smooth-static | +0.08 [-1.28, 1.22] | +0.31 [-0.54, 1.03] | 不显著 |
|
| 134 |
+
| identity | -0.16 [-1.21, 1.00] | +0.14 [-1.81, 1.88] | 不显著且 NLL 失稳 |
|
| 135 |
+
| no-gate | -14.00 [-15.72, -12.00] | -11.81 [-13.01, -10.50] | 显著下降 |
|
| 136 |
+
|
| 137 |
+
E3 明确支持 complete gated operator 相比 no-gate 的作用,但新增 activation-only
|
| 138 |
+
retraining 不支持 multiplication 对最终准确率的必要性。ReLU6 在 clean 或 corruption
|
| 139 |
+
Top-1 上也未显著优于 ReLU、GELU 或 smooth-static。smooth-static 的 mean-corruption
|
| 140 |
+
NLL 改善 `-0.1095 [-0.1638, -0.0605]`,mean-corruption Top-5 改善
|
| 141 |
+
`+0.503 [0.024, 0.960]`,只能称为 nominal significance:125 项比较未做
|
| 142 |
+
多重校正,且包含别名重复指标。
|
| 143 |
+
|
| 144 |
+
identity 的 clean accuracy 接近其他 gate,但一个 seed 的 NLL 达到约 `8.67e31`,
|
| 145 |
+
三 seed clean NLL 均值约 `1.87e31`。它不应作为稳定候选进入 ImageNet 主实验。
|
| 146 |
+
|
| 147 |
+
### 5.2 ImageNet-v2 本地 pre-gate
|
| 148 |
+
|
| 149 |
+
为消除旧 smooth controller 的 weight-decay 混杂,额外完成 corrected
|
| 150 |
+
learned-smooth 三 seeds、activation-only 三 seeds 和 fixed-smooth-c6 seed 0。
|
| 151 |
+
相对原 ReLU6 三 seed 的 paired-seed 差异为:
|
| 152 |
+
|
| 153 |
+
| Variant | Clean Top-1 差异 [95% CI] | Mean corruption Top-1 差异 [95% CI] |
|
| 154 |
+
|---|---:|---:|
|
| 155 |
+
| corrected smooth, zero-WD | +0.587 [-0.522, 1.695] | -0.342 [-4.068, 3.384] |
|
| 156 |
+
| ReLU6 activation-only | +1.137 [-1.130, 3.403] | +0.853 [-2.326, 4.033] |
|
| 157 |
+
|
| 158 |
+
corrected smooth 的 clean/corruption NLL 差异分别为 `-0.165 [-0.299, -0.031]`
|
| 159 |
+
和 `-0.168 [-0.239, -0.098]`,但这是本地 pre-gate 的有限样本结果,不作为
|
| 160 |
+
ImageNet 选择阈值。zero-WD learned cap 的三 seed stage 均值约为
|
| 161 |
+
`2.74/4.62/5.98/5.93`,全局最小值 `1.686`,高于预注册 severe-collapse
|
| 162 |
+
边界 `0.6`;fixed-c6 保持为 6。controller pre-gate 因而通过。
|
| 163 |
+
|
| 164 |
+
activation-only 没有显示预期的 material loss。ImageNet 设计将其改为
|
| 165 |
+
operator-replacement non-inferiority 检验,并与 ReLU/smooth 形状检验并行校正;
|
| 166 |
+
不再用它作为会阻断后续假设的固定序列前置项。
|
| 167 |
+
|
| 168 |
+
## 6. E4:冻结 gate 干预
|
| 169 |
+
|
| 170 |
+
在三个 ReLU6 checkpoint 的全 10,000 张 test set 上:
|
| 171 |
+
|
| 172 |
+
| 模式 | Top-1 (%) | NLL | ECE (%) |
|
| 173 |
+
|---|---:|---:|---:|
|
| 174 |
+
| baseline | 57.07 +/- 1.62 | 2.197 +/- 0.107 | 21.43 +/- 0.93 |
|
| 175 |
+
| batch shuffle | 2.02 +/- 0.19 | 31.15 +/- 8.35 | 83.73 +/- 1.97 |
|
| 176 |
+
| channel shuffle | 2.17 +/- 0.21 | 19.85 +/- 2.11 | 74.51 +/- 1.45 |
|
| 177 |
+
| spatial shuffle | 2.52 +/- 1.02 | 48.24 +/- 19.54 | 84.07 +/- 6.03 |
|
| 178 |
+
| mean gate | 3.01 +/- 0.81 | 13.05 +/- 1.85 | 65.73 +/- 12.72 |
|
| 179 |
+
|
| 180 |
+
预测与 baseline 的一致率也仅为约 2% 至 3%。这支持冻结模型依赖 gate 与当前
|
| 181 |
+
样本、空间位置和通道的精确对齐,单独保留边际分布或平均能量不够。
|
| 182 |
+
|
| 183 |
+
该实验同时干预全部 16 个 blocks,是严重分布外的 frozen-forward diagnostic,
|
| 184 |
+
没有 matched retraining,也没有逐 stage 剂量扫描。它不能证明某个 shuffle 维度
|
| 185 |
+
具有独立训练因果性。`stop_gradient` 在 inference 时前向等价,必须通过重训练评估。
|
| 186 |
+
|
| 187 |
+
## 7. Historical ImageNet、E6 与 E8
|
| 188 |
+
|
| 189 |
+
### 7.1 checkpoint 边界
|
| 190 |
+
|
| 191 |
+
公开 `/nfs/ywang29/GmNet/gmnet_s3.npy` 含 535 个 key,严格匹配 historical
|
| 192 |
+
full-BN topology,参数量 7,822,744;它不匹配 365-key paper-default topology。
|
| 193 |
+
因此以下结果是历史实现分析,不是 paper-default E0 严格复现。
|
| 194 |
+
|
| 195 |
+
完整 ImageNet-1K validation 50,000 图结果:Top-1 `76.292%`、Top-5
|
| 196 |
+
`93.222%`、NLL `1.1121`、ECE `15.836%`。
|
| 197 |
+
|
| 198 |
+
### 7.2 E6 partial corruption
|
| 199 |
+
|
| 200 |
+
E6 使用每类 5 张、共 5,000 张的固定类别均衡子集。
|
| 201 |
+
|
| 202 |
+
| Condition | Top-1 | Top-5 |
|
| 203 |
+
|---|---:|---:|
|
| 204 |
+
| clean | 76.66 | 93.86 |
|
| 205 |
+
| Gaussian noise | 59.80 | 82.16 |
|
| 206 |
+
| Gaussian blur | 72.36 | 91.20 |
|
| 207 |
+
| JPEG | 72.22 | 91.08 |
|
| 208 |
+
| contrast | 75.40 | 92.66 |
|
| 209 |
+
| shift 2px | 76.64 | 93.72 |
|
| 210 |
+
|
| 211 |
+
五种 corruption 平均 Top-1 为 `71.28`,clean-normalized retention 为
|
| 212 |
+
`92.99%`。模型对小平移和对比度变化较稳定,对 Gaussian noise 最敏感。
|
| 213 |
+
这不是完整 ImageNet-C/P:没有多 severity、mCE、mFR 或完整 50k 统计。
|
| 214 |
+
|
| 215 |
+
### 7.3 E8 partial attack
|
| 216 |
+
|
| 217 |
+
E8 使用每类 1 张、共 1,000 张。clean Top-1/Top-5 为 `77.20/94.10`。
|
| 218 |
+
|
| 219 |
+
| Attack | Top-1 | Top-5 | Mean L2 | Mean L-inf |
|
| 220 |
+
|---|---:|---:|---:|---:|
|
| 221 |
+
| PGD-10 L-inf 4/255 | 0.00 | 0.00 | 4.2913 | 0.015686 |
|
| 222 |
+
| low-band PGD | 0.30 | 2.10 | 6.0268 | 0.1102 |
|
| 223 |
+
| mid-band PGD | 0.00 | 0.00 | 5.8088 | 0.1328 |
|
| 224 |
+
| high-band PGD | 0.00 | 0.00 | 5.8001 | 0.1464 |
|
| 225 |
+
| per-sample worst band | 0.00 | 0.00 | - | - |
|
| 226 |
+
|
| 227 |
+
低/中/高频攻击使用共同最大 L2 预算 `6.085951`,带内能量比例均高于
|
| 228 |
+
`0.99992`。worst-band 选择中 high/mid/low 分别为 649/337/14 张。
|
| 229 |
+
|
| 230 |
+
标准 L-inf PGD 与频带 PGD 不是等 L-inf 约束,三类频带攻击的像素 L-inf
|
| 231 |
+
明显更大;三类频带之间实际 L2 也有小幅差异。因此只可得出“当前较强等 L2
|
| 232 |
+
预算下各频带都能破坏模型”,不能声称独特高频脆弱性。该协议是单随机起点
|
| 233 |
+
PGD-10,不是 AutoAttack,也没有多重启或攻击收敛性证明。
|
| 234 |
+
|
| 235 |
+
## 8. E12:本地部署与导出
|
| 236 |
+
|
| 237 |
+
五个独立进程在无其他 compute PID 的主机上顺序测量。表中为进程均值 +/-
|
| 238 |
+
进程间样本标准差。
|
| 239 |
+
|
| 240 |
+
| Device | Precision | Batch | p50 ms | p95 ms | image/s | Peak MiB |
|
| 241 |
+
|---|---|---:|---:|---:|---:|---:|
|
| 242 |
+
| A100 | FP32 | 1 | 6.357 +/- 0.031 | 6.499 +/- 0.033 | 157.22 +/- 0.70 | 49.8 |
|
| 243 |
+
| A100 | FP32 | 32 | 10.681 +/- 0.008 | 10.694 +/- 0.008 | 2995.60 +/- 2.25 | 348.1 |
|
| 244 |
+
| A100 | BF16 | 1 | 8.277 +/- 0.101 | 8.417 +/- 0.098 | 120.51 +/- 1.20 | 59.6 |
|
| 245 |
+
| A100 | BF16 | 32 | 9.703 +/- 0.007 | 9.715 +/- 0.006 | 3296.79 +/- 2.21 | 226.3 |
|
| 246 |
+
| CPU PyTorch | FP32 | 1 | 23.084 +/- 0.138 | 23.543 +/- 0.249 | 43.20 +/- 0.23 | - |
|
| 247 |
+
| CPU PyTorch | FP32 | 32 | 501.900 +/- 23.229 | 554.875 +/- 10.161 | 63.99 +/- 2.40 | - |
|
| 248 |
+
| ONNX Runtime CPU | FP32 | 1 | 6.090 +/- 0.118 | 6.366 +/- 0.166 | 163.41 +/- 3.40 | - |
|
| 249 |
+
|
| 250 |
+
BF16 在 batch32 提升吞吐约 10.1% 并降低峰值显存,但 batch1 比 FP32 慢,
|
| 251 |
+
不能笼统声称 BF16 总是更快。ONNX opset18 checker 通过,五次导出的 logits
|
| 252 |
+
最大绝对误差为 `2.15e-6`,Top-1 均与 PyTorch 一致。
|
| 253 |
+
|
| 254 |
+
INT8 仍为 blocked:当前没有经过校准与验证的 whole-model INT8 pipeline。
|
| 255 |
+
不能把只量化 Linear 层的 dynamic quantization 当成完整 INT8 结果。
|
| 256 |
+
|
| 257 |
+
## 9. 当前不可本地完成的实验
|
| 258 |
+
|
| 259 |
+
- E7 natural shift:缺 ImageNet-V2/A/R/Sketch 和 ObjectNet。
|
| 260 |
+
- 完整 E6:缺 ImageNet-C 和 ImageNet-P。
|
| 261 |
+
- 完整 E8:只有 PGD-10/频带 PGD,缺 AutoAttack、多重启和收敛审计。
|
| 262 |
+
- E9 semantic OOD:缺 NINCO。
|
| 263 |
+
- E10 fine-grained transfer:缺 CUB-200、Aircraft、Cars、DTD,且正式 transfer
|
| 264 |
+
runner 尚未完成验证。
|
| 265 |
+
- E11 dense prediction:缺匹配的 COCO/ADE20K/Cityscapes 适配器、数据和训练审计。
|
| 266 |
+
- iPhone/Jetson profiling:当前节点没有目标设备。
|
| 267 |
+
|
| 268 |
+
这些项目没有伪造占位结果。Revised ImageNet-v2 的 21 个超过 12 小时 YAML
|
| 269 |
+
位于 `/nfs/ywang29/GmNet/depoly/imagenet_v2/`,本轮未提交 launchjob。只有
|
| 270 |
+
`imv2_e0_s3_relu6_seed0` 初始允许提交,其余为 held 或 conditional。
|
| 271 |
+
|
| 272 |
+
## 10. Journal 决策建议
|
| 273 |
+
|
| 274 |
+
### 10.1 可以进入论文的结论
|
| 275 |
+
|
| 276 |
+
1. multiplicative self-gating 会产生跨频率混合;该效应跨 FFT/DCT/Haar 可复核。
|
| 277 |
+
2. complete gate 相比 no-gate 对准确率重要,且冻结 self-gated 模型强依赖样本、
|
| 278 |
+
空间和通道对齐;乘法本身的必要性尚未建立。
|
| 279 |
+
3. raw PSD centroid 不是有效频率贡���的充分条件。
|
| 280 |
+
4. clipping 可控制 alias;zero-WD learned smooth cap 有稳定、分 stage 的工作区间。
|
| 281 |
+
5. ReLU6、ReLU、GELU、smooth 在 CIFAR-100 Top-1 上处于同一统计区间。
|
| 282 |
+
|
| 283 |
+
### 10.2 当前不能进入论文的强主张
|
| 284 |
+
|
| 285 |
+
1. “ReLU6 显著优于其他 gate”。本地 primary Top-1 不支持。
|
| 286 |
+
2. “高频能量增加直接导致准确率提升”。no-gate 反例不支持。
|
| 287 |
+
3. “模型对 corruption/attack 普遍鲁棒”。E6 只是 partial,E8 显示 PGD 崩溃。
|
| 288 |
+
4. “historical checkpoint 等于 paper-default 复现”。两种拓扑不兼容。
|
| 289 |
+
5. “shuffle 干预证明训练因果”。需要 matched retraining 和逐 stage 干预。
|
| 290 |
+
|
| 291 |
+
### 10.3 下一批长实验优先级
|
| 292 |
+
|
| 293 |
+
1. 只先提交 S3 ReLU6 seed-0 anchor,审核固定轮指标、日志、checkpoint 和配方。
|
| 294 |
+
2. anchor 通过后运行 ReLU、corrected learned-smooth、ReLU6-only、no-gate 的
|
| 295 |
+
seed-0 screen;技术有效性而非 seed-0 accuracy 决定 seeds 1/2 解锁,并补齐
|
| 296 |
+
ReLU6 seeds 1/2。
|
| 297 |
+
3. fixed-smooth-c6 只做单 seed 机制诊断;S1/S2/S4 ReLU6 只做单 seed scale context,
|
| 298 |
+
不把它们包装成三 seed confirmatory claim。
|
| 299 |
+
4. release+paper-BN 与 release+historical-full-BN 仅在复现差异被记录后条件运行。
|
| 300 |
+
5. ImageNet 主结果稳定后,再做 E4 matched retraining;补齐 shift/OOD 数据后再扩展鲁棒性主张。
|
| 301 |
+
|
| 302 |
+
## 11. 结果索引
|
| 303 |
+
|
| 304 |
+
持久归档根目录:`/nfs/ywang29/GmNet/local_results/20260712/`
|
| 305 |
+
|
| 306 |
+
- E1 operator:`e1_operator/REPORT.md`
|
| 307 |
+
- E1 trained:`e1_trained/REPORT.md`
|
| 308 |
+
- E2:`e2_synthetic/CONCLUSIONS.md`
|
| 309 |
+
- E3:`e3_cifar100/CONCLUSIONS.md`
|
| 310 |
+
- ImageNet-v2 pre-gate:`../imagenet_v2_pregate/CONCLUSIONS.md`
|
| 311 |
+
- E4:`e4_cifar100/AGGREGATE.md`
|
| 312 |
+
- Legacy ImageNet:`legacy_imagenet_clean/RESULTS.md`
|
| 313 |
+
- E6:`e6_imagenet_partial/CONCLUSIONS.md`
|
| 314 |
+
- E8:`e8_imagenet_partial/CONCLUSIONS.md`
|
| 315 |
+
- E12:`e12/AGGREGATE.md`
|
| 316 |
+
|
| 317 |
+
原始 checkpoints、逐样本 E3 correctness 和完整运行日志仍在
|
| 318 |
+
`/tmp/gmnet_runs/`。数据规范来源为
|
| 319 |
+
`s3://snap-research-cv-code/ywang29/datasets/`,节点 staging 位于
|
| 320 |
+
`/tmp/gmnet_data/`。所有新增正式 shell 均保留了
|
| 321 |
+
`/nfs/ywang29/LongLive/scripts/init_run.sh` 的 export 块。
|
gmnet/project/gmnet_tpami/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet Journal 扩展材料
|
| 2 |
+
|
| 3 |
+
主文档:
|
| 4 |
+
|
| 5 |
+
- [GMNET_TPAMI_JOURNAL_EXTENSION_PLAN.md](./GMNET_TPAMI_JOURNAL_EXTENSION_PLAN.md)
|
| 6 |
+
- [LOCAL_EXPERIMENT_CONCLUSIONS.md](./LOCAL_EXPERIMENT_CONCLUSIONS.md)
|
| 7 |
+
- [IMAGENET_V2_REVISED_PROTOCOL.md](./IMAGENET_V2_REVISED_PROTOCOL.md)
|
| 8 |
+
- [IMAGENET_V2_PREGATE_CONCLUSIONS.md](./IMAGENET_V2_PREGATE_CONCLUSIONS.md)
|
| 9 |
+
- [E4_MECHANISM_UNIFIED_CONCLUSIONS.md](./E4_MECHANISM_UNIFIED_CONCLUSIONS.md)
|
| 10 |
+
- [IMAGENET_MATCHED_SPECTRAL_AUDIT_PROTOCOL.md](./IMAGENET_MATCHED_SPECTRAL_AUDIT_PROTOCOL.md)
|
| 11 |
+
- [IMAGENET_MATCHED_SPECTRAL_IMPLEMENTATION_CHECKLIST.md](./IMAGENET_MATCHED_SPECTRAL_IMPLEMENTATION_CHECKLIST.md)
|
| 12 |
+
- [IMAGENET_MATCHED_SPECTRAL_DIAGNOSTIC_20260720.md](./IMAGENET_MATCHED_SPECTRAL_DIAGNOSTIC_20260720.md)
|
| 13 |
+
- [E4_SOURCE_EQUIVALENCE_AUDIT.md](./E4_SOURCE_EQUIVALENCE_AUDIT.md)
|
| 14 |
+
|
| 15 |
+
本地参考材料:
|
| 16 |
+
|
| 17 |
+
- **reference/gmnet_v3.pdf**:arXiv v3 原文;
|
| 18 |
+
- **reference/source/**:v3 TeX source;
|
| 19 |
+
- **reference/GmNet-code/**:2026-07-12 拉取的公开代码快照。
|
| 20 |
+
|
| 21 |
+
主文档包含论文与代码审计、推荐 journal 贡献、理论路线、新门控候选、
|
| 22 |
+
E0-E12 实验矩阵、统计规范、Go/No-Go 条件、算力与排期,以及相关工作链接。
|
| 23 |
+
|
| 24 |
+
本地实验结论文档记录已完成的 E0/E1/E2/E3/E4/E6/E8/E12、historical
|
| 25 |
+
ImageNet 和 7-run ImageNet-v2 pre-gate。E4 统一结论进一步汇总了已完成的
|
| 26 |
+
current-code baseline、batch derangement、stop-gradient、channel derangement
|
| 27 |
+
及 combined ImageNet 长实验,并冻结其 artifact、effect size 和 claim 边界。
|
| 28 |
+
|
| 29 |
+
正式 matched ImageNet 频谱审计的非数据文件位于:
|
| 30 |
+
|
| 31 |
+
```text
|
| 32 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
8 卡 launchjob YAML 位于:
|
| 36 |
+
|
| 37 |
+
```text
|
| 38 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
该部署包由生成器冻结并标记为 `ready_not_submitted`;当前 runner SHA256 为
|
| 42 |
+
`2b56465319e651716170fbaa58d43f14924d70f694b0a273ab63255c2697edfe`,聚合器
|
| 43 |
+
SHA256 为 `9027155739ccbeba1150d5bdaa6d94930d8169ed4d4edb5c5fe2af2bd655b5e5`。
|
| 44 |
+
生成的 YAML SHA256 为
|
| 45 |
+
`696d3c198cb9bde125fb726b75daac9703136f50ad7dab76a891767de85d87c3`,deploy
|
| 46 |
+
manifest SHA256 为
|
| 47 |
+
`4ff8001c29a89bdc68c9c3578e354e9808223d6143c9663df8b64130f1e26578`。
|
| 48 |
+
|
| 49 |
+
目前没有正式 matched spectral 结果,也没有提交新 job。只有正式作业生成根目录
|
| 50 |
+
`COMPLETE` 且独立 `--check-only` 复核通过后,才能把输出并入 journal 结论。
|
gmnet/project/gmnet_tpami/reference/GmNet-code/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GmNet: Revisiting Gating Mechanisms From A Frequency View
|
| 2 |
+
|
| 3 |
+
<p align="center"> <b>ICLR 2026</b> </p> <p align="center"> <a href="https://arxiv.org/abs/2503.22841">📄 arxiv</a> | <a href="https://github.com/YFWang1999/GmNet">💻 Code</a> </p>
|
| 4 |
+
|
| 5 |
+
### Install requirements
|
| 6 |
+
|
| 7 |
+
Run the following command to install the dependences:
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
pip install -r requirements.txt
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
### Data preparation
|
| 14 |
+
|
| 15 |
+
We need to prepare ImageNet-1k dataset from [`http://www.image-net.org/`](http://www.image-net.org/).
|
| 16 |
+
|
| 17 |
+
- ImageNet-1k
|
| 18 |
+
|
| 19 |
+
ImageNet-1k contains 1.28 M images for training and 50 K images for validation.
|
| 20 |
+
The images shall be stored as individual files:
|
| 21 |
+
|
| 22 |
+
```
|
| 23 |
+
ImageNet/
|
| 24 |
+
├── train
|
| 25 |
+
│ ├── n01440764
|
| 26 |
+
│ │ ├── n01440764_10026.JPEG
|
| 27 |
+
│ │ ├── n01440764_10027.JPEG
|
| 28 |
+
...
|
| 29 |
+
├── val
|
| 30 |
+
│ ├── n01440764
|
| 31 |
+
│ │ ├── ILSVRC2012_val_00000293.JPEG
|
| 32 |
+
...
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Our code also supports storing the train set and validation set as the `*.tar` archives:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
ImageNet/
|
| 39 |
+
├── train.tar
|
| 40 |
+
│ ├── n01440764
|
| 41 |
+
│ │ ├── n01440764_10026.JPEG
|
| 42 |
+
...
|
| 43 |
+
└── val.tar
|
| 44 |
+
│ ├── n01440764
|
| 45 |
+
│ │ ├── ILSVRC2012_val_00000293.JPEG
|
| 46 |
+
...
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
## Training
|
| 52 |
+
|
| 53 |
+
To train the model on a single node with 8 GPUs for 300 epochs and distributed evaluation, run:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
python3 -m torch.distributed.launch --nproc_per_node=8 train_imagenet.py --data {path to dataset} --model gmnet_s3 -b 256 --lr 3e-3 --weight-decay 0.05 --aa rand-m1-mstd0.5-inc1 --cutmix 0.2 --color-jitter 0. --drop-path 0. --log-wandb
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
You can find the checkpoints in [Google Drive](https://drive.google.com/drive/folders/1hUF4ozaNTLl6TxQM87jOfD7evWD585NY?usp=drive_link) (Keep Updating ...)
|
| 60 |
+
|
| 61 |
+
## Speed test
|
| 62 |
+
|
| 63 |
+
Run the following command to compare the throughputs on GPU/CPU:
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
python benchmark_onnx.py.py
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
## BibTeX
|
| 70 |
+
|
| 71 |
+
@article{wang2025gmnet,
|
| 72 |
+
title={GmNet: Revisiting Gating Mechanisms From A Frequency View},
|
| 73 |
+
author={Wang, Yifan and Ma, Xu and Zhang, Yitian and Wang, Zhongruo and Kim, Sung-Cheol and Mirjalili, Vahid and Renganathan, Vidya and Fu, Yun},
|
| 74 |
+
journal={arXiv preprint arXiv:2503.22841},
|
| 75 |
+
year={2025}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
The majority of GmNet is licensed under an [Apache License 2.0](https://github.com/ma-xu/Rewrite-the-Stars/blob/main/LICENSE)
|
| 80 |
+
|
| 81 |
+
|
gmnet/project/gmnet_tpami/reference/GmNet-code/benchmark_onnx.py
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
r"""
|
| 2 |
+
# Use case:
|
| 3 |
+
# CUDA_VISIBLE_DEVICES=0 python3 benchmark_onnx.py --model {model-name} --input-size 3 244 244 --benchmark_cpu
|
| 4 |
+
|
| 5 |
+
Created by: Xu Ma (Email: ma.xu1@northeastern.edu)
|
| 6 |
+
Modified Date: Mar/29/2024
|
| 7 |
+
"""
|
| 8 |
+
import argparse
|
| 9 |
+
import os
|
| 10 |
+
import sys
|
| 11 |
+
import csv
|
| 12 |
+
import glob
|
| 13 |
+
import json
|
| 14 |
+
import time
|
| 15 |
+
import logging
|
| 16 |
+
import numpy as np
|
| 17 |
+
import torch
|
| 18 |
+
import torch.nn.parallel
|
| 19 |
+
|
| 20 |
+
import timm
|
| 21 |
+
from timm.models import create_model
|
| 22 |
+
from timm.data import resolve_data_config
|
| 23 |
+
from timm.utils import setup_default_logging
|
| 24 |
+
import onnx
|
| 25 |
+
import onnxruntime
|
| 26 |
+
import cpuinfo
|
| 27 |
+
import tensorrt
|
| 28 |
+
from fvcore.nn import FlopCountAnalysis
|
| 29 |
+
from thop import profile, clever_format
|
| 30 |
+
import starnet
|
| 31 |
+
import starnet_rebuttle
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
torch.backends.cudnn.benchmark = True
|
| 35 |
+
_logger = logging.getLogger('benchmark')
|
| 36 |
+
|
| 37 |
+
parser = argparse.ArgumentParser(description='ONNX benchmark')
|
| 38 |
+
parser.add_argument('--model', '-m', metavar='NAME', default='dpn92',
|
| 39 |
+
help='model architecture (default: dpn92)')
|
| 40 |
+
parser.add_argument('--input-size', default=None, nargs=3, type=int,
|
| 41 |
+
metavar='N N N',
|
| 42 |
+
help='Input all image dimensions (d h w, e.g. --input-size 3 224 224), uses model default if empty')
|
| 43 |
+
parser.add_argument('--pretrained', dest='pretrained', action='store_true',
|
| 44 |
+
help='use pre-trained model')
|
| 45 |
+
# speed benchmark
|
| 46 |
+
parser.add_argument('--nwarmup', default=50, type=int, help='warm up iterations')
|
| 47 |
+
parser.add_argument('--nruns', default=400, type=int,
|
| 48 |
+
help='Average benchmark speed over {nruns} iterations')
|
| 49 |
+
parser.add_argument('--benchmark_bs', default=1, type=int,
|
| 50 |
+
help='The batch size for speed benchmark')
|
| 51 |
+
parser.add_argument('--comments', default="", type=str,
|
| 52 |
+
help='Any string comments for this script')
|
| 53 |
+
parser.add_argument('--results_file', default='debug.csv', type=str, metavar='FILENAME',
|
| 54 |
+
help='Output csv file for benchmark results (summary)')
|
| 55 |
+
parser.add_argument('--intra_op_num_threads', default=1, type=int,
|
| 56 |
+
help='threads for onnxruntime test, works for gpu, cpu and pytorch')
|
| 57 |
+
parser.add_argument('--benchmark_cpu', default=False, action='store_true',
|
| 58 |
+
help='If we should benchmark the inference speed on cpu')
|
| 59 |
+
parser.add_argument('--opset_version', default=12, type=int, help='opset version')
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def validate(args):
|
| 63 |
+
# create model
|
| 64 |
+
model = create_model(args.model, pretrained=args.pretrained)
|
| 65 |
+
model.eval()
|
| 66 |
+
model_params = sum([m.numel() for m in model.parameters()])
|
| 67 |
+
_logger.info('Model %s created, param count: %d' % (args.model, model_params))
|
| 68 |
+
|
| 69 |
+
data_config = resolve_data_config(vars(args), model=model, use_test_size=True, verbose=True)
|
| 70 |
+
|
| 71 |
+
# export onnx
|
| 72 |
+
dummy_input = torch.randn(args.benchmark_bs, data_config['input_size'][0], data_config['input_size'][1],
|
| 73 |
+
data_config['input_size'][2], requires_grad=True)
|
| 74 |
+
if not os.path.exists("onnx_models"):
|
| 75 |
+
os.makedirs("onnx_models")
|
| 76 |
+
torch.onnx.export(model,
|
| 77 |
+
dummy_input,
|
| 78 |
+
os.path.join("onnx_models", args.model + ".onnx"),
|
| 79 |
+
export_params=True, # store the trained parameter weights inside the model file
|
| 80 |
+
opset_version=args.opset_version, # the ONNX version to export the model to
|
| 81 |
+
do_constant_folding=True, # whether to execute constant folding for optimization
|
| 82 |
+
input_names=['input'], # the model's input names
|
| 83 |
+
output_names=['output'],
|
| 84 |
+
dynamic_axes={'input': {0: 'batch_size'}, # variable lenght axes
|
| 85 |
+
'output': {0: 'batch_size'}
|
| 86 |
+
}
|
| 87 |
+
) # the model's output names
|
| 88 |
+
_logger.info(f"===> Successfully export onnx")
|
| 89 |
+
|
| 90 |
+
model = model.cuda()
|
| 91 |
+
|
| 92 |
+
model.eval()
|
| 93 |
+
flops_input = torch.randn((1,) + tuple(data_config['input_size'])).cuda()
|
| 94 |
+
fvcore_flops = FlopCountAnalysis(model, flops_input)
|
| 95 |
+
# _logger.info(f"flops is: {flops.total()}")
|
| 96 |
+
### update: the profile lib calculate error param numbers, use ours.
|
| 97 |
+
model_macs, _ = profile(model, inputs=(flops_input,), verbose=False)
|
| 98 |
+
model_flops, model_macs, model_params = clever_format([fvcore_flops.total(), model_macs, model_params], "%.3f")
|
| 99 |
+
_logger.info(f"flops is: {model_flops}, macs is: {model_macs}, params is: {model_params}")
|
| 100 |
+
|
| 101 |
+
### benchmark speed ####
|
| 102 |
+
_logger.info('\n===> Start benchmarking speed\n')
|
| 103 |
+
input = torch.randn((args.benchmark_bs,) + tuple(data_config['input_size'])).cuda()
|
| 104 |
+
# benchmark
|
| 105 |
+
# 1: speed benchmark: PyTorch
|
| 106 |
+
_logger.info(f"\n===> Warm up {args.nwarmup} iterations for Pytorch speed benchmarking ...")
|
| 107 |
+
with torch.no_grad():
|
| 108 |
+
for _ in range(args.nwarmup):
|
| 109 |
+
features = model(input)
|
| 110 |
+
torch.cuda.synchronize()
|
| 111 |
+
timings = []
|
| 112 |
+
_logger.info(f"\n===> Benchmark {args.nruns} iterations for Pytorch speed benchmarking ...")
|
| 113 |
+
with torch.no_grad():
|
| 114 |
+
for i in range(1, args.nruns + 1):
|
| 115 |
+
torch.cuda.synchronize()
|
| 116 |
+
start_time = time.time()
|
| 117 |
+
model(input)
|
| 118 |
+
torch.cuda.synchronize()
|
| 119 |
+
end_time = time.time()
|
| 120 |
+
timings.append(end_time - start_time)
|
| 121 |
+
pytorch_speed = np.mean(timings) * 1000
|
| 122 |
+
_logger.info('\n===> Benchmarking Pytorch speed, avgerage batch time %.2f ms\n\n' % (pytorch_speed))
|
| 123 |
+
|
| 124 |
+
# 2: speed benchmark: ONNX GPU
|
| 125 |
+
input = input.detach().cpu().numpy() if input.requires_grad else input.cpu().numpy()
|
| 126 |
+
_logger.info(f"\n===> Warm up {args.nwarmup} iterations for ONNX GPU speed benchmarking ...")
|
| 127 |
+
providers = [('CUDAExecutionProvider', {
|
| 128 |
+
'device_id': 0,
|
| 129 |
+
'arena_extend_strategy': 'kNextPowerOfTwo',
|
| 130 |
+
'gpu_mem_limit': 8 * 1024 * 1024 * 1024,
|
| 131 |
+
'cudnn_conv_algo_search': 'EXHAUSTIVE',
|
| 132 |
+
'do_copy_in_default_stream': True,
|
| 133 |
+
})]
|
| 134 |
+
opts = onnxruntime.SessionOptions()
|
| 135 |
+
opts.enable_profiling = True # if profiling the details
|
| 136 |
+
if not os.path.exists("./model_profiles/"):
|
| 137 |
+
os.makedirs("./model_profiles/")
|
| 138 |
+
opts.profile_file_prefix = "./model_profiles/" + args.model
|
| 139 |
+
opts.intra_op_num_threads = args.intra_op_num_threads
|
| 140 |
+
session = onnxruntime.InferenceSession(os.path.join("onnx_models", args.model + ".onnx")
|
| 141 |
+
, providers=providers, sess_options=opts)
|
| 142 |
+
# IOBinding
|
| 143 |
+
input_names = session.get_inputs()[0].name
|
| 144 |
+
output_names = session.get_outputs()[0].name
|
| 145 |
+
io_binding = session.io_binding()
|
| 146 |
+
io_binding.bind_cpu_input(input_names, input)
|
| 147 |
+
io_binding.bind_output(output_names, 'cuda')
|
| 148 |
+
# for profiling
|
| 149 |
+
session.run_with_iobinding(io_binding)
|
| 150 |
+
profile_file = session.end_profiling()
|
| 151 |
+
print(f"\n===> Profiling file name is: {profile_file}")
|
| 152 |
+
for _ in range(args.nwarmup):
|
| 153 |
+
session.run_with_iobinding(io_binding)
|
| 154 |
+
torch.cuda.synchronize()
|
| 155 |
+
timings = []
|
| 156 |
+
_logger.info(f"\n===> Benchmark {args.nruns} iterations for ONNX GPU speed benchmarking ...")
|
| 157 |
+
with torch.no_grad():
|
| 158 |
+
for i in range(1, args.nruns + 1):
|
| 159 |
+
torch.cuda.synchronize()
|
| 160 |
+
start_time = time.time()
|
| 161 |
+
session.run_with_iobinding(io_binding)
|
| 162 |
+
torch.cuda.synchronize()
|
| 163 |
+
end_time = time.time()
|
| 164 |
+
timings.append(end_time - start_time)
|
| 165 |
+
onnx_gpu_speed = np.mean(timings) * 1000
|
| 166 |
+
_logger.info('\n===> Benchmarking ONNX GPU speed, avgerage batch time %.2f ms\n\n' % (onnx_gpu_speed))
|
| 167 |
+
|
| 168 |
+
memory_allocated = torch.cuda.memory_allocated(device=next(model.parameters()).device)
|
| 169 |
+
max_memory_allocated = torch.cuda.max_memory_allocated(device=next(model.parameters()).device)
|
| 170 |
+
torch.cuda.reset_peak_memory_stats()
|
| 171 |
+
_logger.info(f"ONNX memory_allocated: {memory_allocated}, max_memory_allocated: {max_memory_allocated}")
|
| 172 |
+
|
| 173 |
+
del session
|
| 174 |
+
|
| 175 |
+
# 3: speed benchmark: ONNX CPU
|
| 176 |
+
onnx_cpu_speed = 0.
|
| 177 |
+
if args.benchmark_cpu:
|
| 178 |
+
_logger.info(f"\n===> Warm up {args.nwarmup} iterations for ONNX CPU speed benchmarking ...")
|
| 179 |
+
providers = ['CPUExecutionProvider']
|
| 180 |
+
opts = onnxruntime.SessionOptions()
|
| 181 |
+
# opts.enable_profiling = True
|
| 182 |
+
opts.intra_op_num_threads = args.intra_op_num_threads
|
| 183 |
+
session = onnxruntime.InferenceSession(os.path.join("onnx_models", args.model + ".onnx"),
|
| 184 |
+
providers=providers, sess_options=opts)
|
| 185 |
+
for _ in range(args.nwarmup):
|
| 186 |
+
session.run([], {'input': input})
|
| 187 |
+
torch.cuda.synchronize()
|
| 188 |
+
timings = []
|
| 189 |
+
_logger.info(f"\n===> Benchmark {args.nruns} iterations for ONNX CPU speed benchmarking ...")
|
| 190 |
+
with torch.no_grad():
|
| 191 |
+
# reduce nruns to reduce waiting time for cpu since it is really stable.
|
| 192 |
+
for i in range(1, args.nruns // 5 + 1):
|
| 193 |
+
start_time = time.time()
|
| 194 |
+
session.run([], {'input': input})
|
| 195 |
+
end_time = time.time()
|
| 196 |
+
timings.append(end_time - start_time)
|
| 197 |
+
onnx_cpu_speed = np.mean(timings) * 1000
|
| 198 |
+
_logger.info('\n===> Benchmarking ONNX CPU speed, avgerage batch time %.2f ms\n\n' % (onnx_cpu_speed))
|
| 199 |
+
del session
|
| 200 |
+
|
| 201 |
+
log_results = {
|
| 202 |
+
# model related logs
|
| 203 |
+
"model_model": args.model,
|
| 204 |
+
"model_params": model_params,
|
| 205 |
+
"model_flops": model_flops,
|
| 206 |
+
"model_macs": model_macs,
|
| 207 |
+
"model_memory": clever_format(memory_allocated, "%.3f"),
|
| 208 |
+
# data related
|
| 209 |
+
"data_input_size": data_config['input_size'],
|
| 210 |
+
# benchmark related
|
| 211 |
+
"benchmark_git_commit_id": get_git_commit_id(),
|
| 212 |
+
"benchmark_date": time.strftime('%Y-%m-%d:%H:%M:%S', time.localtime()),
|
| 213 |
+
"benchmark_pytorch_latency": "{:.3f}".format(pytorch_speed),
|
| 214 |
+
"benchmark_onnx_gpu_latency": "{:.3f}".format(onnx_gpu_speed),
|
| 215 |
+
"benchmark_onnx_cpu_latency": "{:.3f}".format(onnx_cpu_speed),
|
| 216 |
+
"benchmark_bs": args.benchmark_bs,
|
| 217 |
+
"benchmark_nwarmup": args.nwarmup,
|
| 218 |
+
"benchmark_nruns": args.nruns,
|
| 219 |
+
# system related logs
|
| 220 |
+
"system_verision_python": sys.version.replace('\n', ''),
|
| 221 |
+
"system_verision_pytorch": torch.__version__,
|
| 222 |
+
"system_verision_timm": timm.__version__,
|
| 223 |
+
"system_verision_cuda": torch.version.cuda,
|
| 224 |
+
"system_verision_cudnn": torch.backends.cudnn.version(),
|
| 225 |
+
"system_verision_onnx": onnx.__version__,
|
| 226 |
+
"system_verision_onnxruntime": onnxruntime.__version__,
|
| 227 |
+
"system_verision_tensorrt": tensorrt.__version__,
|
| 228 |
+
"system_gpu_name": torch.cuda.get_device_name(0),
|
| 229 |
+
"system_cpu_arch": cpuinfo.get_cpu_info()["arch"],
|
| 230 |
+
"system_cpu_brand_raw": cpuinfo.get_cpu_info()["brand_raw"],
|
| 231 |
+
"opset_version": args.opset_version,
|
| 232 |
+
"others_comments": args.comments,
|
| 233 |
+
"profile_file": profile_file
|
| 234 |
+
}
|
| 235 |
+
return log_results
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
def get_git_commit_id():
|
| 239 |
+
try:
|
| 240 |
+
import subprocess
|
| 241 |
+
cmd_out = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
|
| 242 |
+
return cmd_out
|
| 243 |
+
except:
|
| 244 |
+
# indicating no git found.
|
| 245 |
+
return "0000000"
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def main():
|
| 249 |
+
setup_default_logging()
|
| 250 |
+
args = parser.parse_args()
|
| 251 |
+
results = validate(args)
|
| 252 |
+
# output results in JSON to stdout w/ delimiter for runner script
|
| 253 |
+
print(f'\n===> Benchmark result:\n{json.dumps(results, indent=4)}')
|
| 254 |
+
try:
|
| 255 |
+
write_results(args.results_file, results)
|
| 256 |
+
print(f"Successfully write results to {args.results_file}")
|
| 257 |
+
except:
|
| 258 |
+
print(f"Write CSV error")
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def write_results(results_file, results):
|
| 262 |
+
csv_isfile = os.path.isfile(results_file)
|
| 263 |
+
with open(results_file, 'a') as csvfile:
|
| 264 |
+
writer = csv.DictWriter(csvfile, fieldnames=results.keys())
|
| 265 |
+
if not csv_isfile:
|
| 266 |
+
writer.writeheader()
|
| 267 |
+
writer.writerows([results])
|
| 268 |
+
csvfile.flush()
|
| 269 |
+
csvfile.close()
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
if __name__ == '__main__':
|
| 273 |
+
main()
|
gmnet/project/gmnet_tpami/reference/GmNet-code/export_coreml.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import argparse
|
| 3 |
+
import coremltools as ct
|
| 4 |
+
from models import *
|
| 5 |
+
import starnet
|
| 6 |
+
import timm
|
| 7 |
+
import os
|
| 8 |
+
from timm.models import create_model
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def parse():
|
| 12 |
+
parser = argparse.ArgumentParser(description='EfficientFormer Toolbox')
|
| 13 |
+
parser.add_argument('--model', default="gmnet_s1", metavar='ARCH')
|
| 14 |
+
parser.add_argument('--pretrained', action='store_true', default=False)
|
| 15 |
+
parser.add_argument('--ckpt', type=str, metavar='PATH',
|
| 16 |
+
help='path to checkpoint')
|
| 17 |
+
parser.add_argument("--resolution", default=224, type=int)
|
| 18 |
+
args = parser.parse_args()
|
| 19 |
+
return args
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
if __name__ == '__main__':
|
| 23 |
+
args = parse()
|
| 24 |
+
model = create_model(model_name=args.model, pretrained=args.pretrained)
|
| 25 |
+
try:
|
| 26 |
+
model.load_state_dict(torch.load(args.ckpt, map_location='cpu')['model'])
|
| 27 |
+
print('load success, model is initialized with pretrained checkpoint')
|
| 28 |
+
except:
|
| 29 |
+
print('model initialized without pretrained checkpoint')
|
| 30 |
+
|
| 31 |
+
model.eval()
|
| 32 |
+
dummy_input = torch.randn(1, 3, args.resolution, args.resolution)
|
| 33 |
+
|
| 34 |
+
example_input = dummy_input
|
| 35 |
+
traced_model = torch.jit.trace(model, example_input)
|
| 36 |
+
out = traced_model(example_input)
|
| 37 |
+
|
| 38 |
+
model = ct.convert(
|
| 39 |
+
traced_model,
|
| 40 |
+
inputs=[ct.ImageType(shape=example_input.shape, channel_first=True)]
|
| 41 |
+
)
|
| 42 |
+
model.save(os.path.join("coreml_models", args.model + ".mlmodel"))
|
| 43 |
+
print('successfully export coreML')
|
gmnet/project/gmnet_tpami/reference/GmNet-code/gment.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import math
|
| 3 |
+
import torch
|
| 4 |
+
import torch.nn as nn
|
| 5 |
+
import torch.nn.functional as F
|
| 6 |
+
import torch.utils.checkpoint as checkpoint
|
| 7 |
+
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
|
| 8 |
+
from timm.models.registry import register_model
|
| 9 |
+
|
| 10 |
+
from torchvision import transforms
|
| 11 |
+
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
|
| 12 |
+
from timm.data import create_transform
|
| 13 |
+
from torch.jit import Final
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class Block(nn.Module):
|
| 17 |
+
def __init__(self, dim, mlp_ratio=3, kernel_size=7,
|
| 18 |
+
f12_bn=False, g_bn=True, dwconv2_bn=False, act=nn.ReLU,
|
| 19 |
+
drop_path=0., layer_scale=1e-6):
|
| 20 |
+
|
| 21 |
+
super().__init__()
|
| 22 |
+
self.dwconv = ConvBN(dim, dim, kernel_size, 1, (kernel_size-1)//2, groups=dim, with_bn=True)
|
| 23 |
+
self.f1 = ConvBN(dim, mlp_ratio*dim, 1, with_bn=f12_bn)
|
| 24 |
+
self.g = ConvBN(mlp_ratio*dim, dim, 1, with_bn=g_bn)
|
| 25 |
+
self.dwconv2 = ConvBN(dim, dim, kernel_size, 1, (kernel_size - 1) // 2, groups=dim, with_bn=dwconv2_bn)
|
| 26 |
+
self.act = act()
|
| 27 |
+
self.gamma = nn.Parameter(layer_scale * torch.ones((dim)),
|
| 28 |
+
requires_grad=True) if layer_scale > 0 else None
|
| 29 |
+
if drop_path > 0.:
|
| 30 |
+
self.drop_path = DropPath(drop_path)
|
| 31 |
+
|
| 32 |
+
def forward(self, x):
|
| 33 |
+
input = x
|
| 34 |
+
B, C, H, W = x.shape
|
| 35 |
+
x = self.dwconv(x)
|
| 36 |
+
x = self.f1(x)
|
| 37 |
+
x = self.act(x) * (x)
|
| 38 |
+
x = self.g(x)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
x = self.dwconv2(x)
|
| 42 |
+
x = x.permute(0, 2, 3, 1) # (N, C, H, W) -> (N, H, W, C)
|
| 43 |
+
if self.gamma is not None:
|
| 44 |
+
x = self.gamma * x
|
| 45 |
+
x = x.permute(0, 3, 1, 2) # (N, H, W, C) -> (N, C, H, W)
|
| 46 |
+
if hasattr(self, "drop_path"):
|
| 47 |
+
x = input + self.drop_path(x)
|
| 48 |
+
else:
|
| 49 |
+
x = input + x
|
| 50 |
+
return x
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class ConvBN(torch.nn.Sequential):
|
| 55 |
+
def __init__(self, in_planes, out_planes, kernel_size=1, stride=1, padding=0, dilation=1,
|
| 56 |
+
groups=1, with_bn=True):
|
| 57 |
+
super().__init__()
|
| 58 |
+
self.kernel_size = kernel_size
|
| 59 |
+
self.in_planes = in_planes
|
| 60 |
+
self.out_planes = out_planes
|
| 61 |
+
self.add_module('conv', torch.nn.Conv2d(
|
| 62 |
+
in_planes, out_planes, kernel_size, stride, padding, dilation, groups))
|
| 63 |
+
if with_bn:
|
| 64 |
+
self.add_module('bn', torch.nn.BatchNorm2d(out_planes))
|
| 65 |
+
torch.nn.init.constant_(self.bn.weight, 1)
|
| 66 |
+
torch.nn.init.constant_(self.bn.bias, 0)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class PermuteLienar(nn.Module):
|
| 70 |
+
def __init__(self, in_planes, out_planes):
|
| 71 |
+
"""
|
| 72 |
+
input: [B, C, H, W]
|
| 73 |
+
"""
|
| 74 |
+
super().__init__()
|
| 75 |
+
self.layer = nn.Linear(in_planes, out_planes)
|
| 76 |
+
|
| 77 |
+
def forward(self, x):
|
| 78 |
+
return self.layer(x.permute(0,2,3,1)).permute(0,3,1,2)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class Model(nn.Module):
|
| 82 |
+
def __init__(self, num_classes=1000,
|
| 83 |
+
# newwork configuration
|
| 84 |
+
embed_dim=[32, 64, 128, 256], depths=[2, 2, 8, 2],
|
| 85 |
+
f12_bn=False, g_bn=False, dwconv2_bn=False, act=nn.ReLU, downsampler_act = nn.ReLU,
|
| 86 |
+
mlp_ratio=[4, 4, 4, 4], layer_scale=1e-6,
|
| 87 |
+
drop_path_rate=0.0, kernel_size=7, block=None,
|
| 88 |
+
**kwargs):
|
| 89 |
+
super().__init__()
|
| 90 |
+
self.num_classes = num_classes
|
| 91 |
+
self.in_channel = 32
|
| 92 |
+
|
| 93 |
+
self.stem = nn.Sequential(
|
| 94 |
+
ConvBN(3, self.in_channel, kernel_size=3, stride=2, padding=1),
|
| 95 |
+
act(),
|
| 96 |
+
# nn.Conv2d(self.in_channel, self.in_channel, kernel_size=1, stride=1, padding=0),
|
| 97 |
+
# nn.BatchNorm2d(self.in_channel)
|
| 98 |
+
)
|
| 99 |
+
# stochastic depth
|
| 100 |
+
dpr = [x.item() for x in torch.linspace(0, drop_path_rate, sum(depths))]
|
| 101 |
+
|
| 102 |
+
# build stages
|
| 103 |
+
self.stages = nn.ModuleList()
|
| 104 |
+
cur = 0
|
| 105 |
+
for i_layer in range(len(depths)):
|
| 106 |
+
down_sampler = nn.Sequential(
|
| 107 |
+
ConvBN(self.in_channel, embed_dim[i_layer], 3, 2, 1),
|
| 108 |
+
downsampler_act()
|
| 109 |
+
)
|
| 110 |
+
self.in_channel = embed_dim[i_layer]
|
| 111 |
+
blocks = [
|
| 112 |
+
block(self.in_channel, mlp_ratio=mlp_ratio[i_layer], kernel_size=kernel_size,
|
| 113 |
+
f12_bn=f12_bn, g_bn=g_bn, dwconv2_bn=dwconv2_bn, act=act,
|
| 114 |
+
drop_path=dpr[cur+i], layer_scale=layer_scale)
|
| 115 |
+
for i in range(depths[i_layer])]
|
| 116 |
+
cur += depths[i_layer]
|
| 117 |
+
stage = nn.Sequential(down_sampler, *blocks)
|
| 118 |
+
self.stages.append(stage)
|
| 119 |
+
# head
|
| 120 |
+
self.norm = nn.BatchNorm2d(self.in_channel)
|
| 121 |
+
self.avgpool = nn.AdaptiveAvgPool2d(1)
|
| 122 |
+
self.head = nn.Linear(self.in_channel, num_classes)
|
| 123 |
+
self.apply(self._init_weights)
|
| 124 |
+
|
| 125 |
+
def _init_weights(self, m):
|
| 126 |
+
if isinstance(m, nn.Linear or nn.Conv2d):
|
| 127 |
+
trunc_normal_(m.weight, std=.02)
|
| 128 |
+
if isinstance(m, nn.Linear) and m.bias is not None:
|
| 129 |
+
nn.init.constant_(m.bias, 0)
|
| 130 |
+
elif isinstance(m, nn.LayerNorm or nn.BatchNorm2d):
|
| 131 |
+
nn.init.constant_(m.bias, 0)
|
| 132 |
+
nn.init.constant_(m.weight, 1.0)
|
| 133 |
+
|
| 134 |
+
def forward(self, x):
|
| 135 |
+
|
| 136 |
+
x = self.stem(x) # [B,in_planes, 112,112]
|
| 137 |
+
for stage in self.stages:
|
| 138 |
+
x = stage(x)
|
| 139 |
+
#pdb.set_trace()
|
| 140 |
+
#pdb.set_trace()
|
| 141 |
+
x = self.norm(x)
|
| 142 |
+
x = self.avgpool(x)
|
| 143 |
+
x = torch.flatten(x, 1)
|
| 144 |
+
x = self.head(x)
|
| 145 |
+
return x
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def convert_model(model):
|
| 149 |
+
# search for all to-be-replaced layers
|
| 150 |
+
for name, layer in model.named_children():
|
| 151 |
+
if isinstance(layer, ConvBN) and layer.kernel_size==1:
|
| 152 |
+
fc_layer = PermuteLienar(in_planes=layer.in_planes, out_planes=layer.out_planes)
|
| 153 |
+
setattr(model, name, fc_layer)
|
| 154 |
+
elif isinstance(layer, nn.Module):
|
| 155 |
+
convert_model(layer)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
@register_model
|
| 159 |
+
def gmnet_s3(pretrained=False, **kwargs):
|
| 160 |
+
base_dim = 48
|
| 161 |
+
dim_expand = [1, 2, 4, 8]
|
| 162 |
+
embed_dim = [int(base_dim * expand) for expand in dim_expand]
|
| 163 |
+
print(embed_dim)
|
| 164 |
+
depths = [3,3,8,3] # [1,1,4,2]
|
| 165 |
+
mlp_ratio = [4,4,4,4]
|
| 166 |
+
kernel_size = 7
|
| 167 |
+
model = Model(
|
| 168 |
+
embed_dim=embed_dim, depths=depths, mlp_ratio=mlp_ratio, kernel_size=kernel_size,
|
| 169 |
+
f12_bn=False, g_bn=True, dwconv2_bn=False, act=nn.ReLU6, downsampler_act=nn.Identity,
|
| 170 |
+
block = Block,
|
| 171 |
+
**kwargs
|
| 172 |
+
)
|
| 173 |
+
if pretrained:
|
| 174 |
+
convert_model(model)
|
| 175 |
+
return model
|
| 176 |
+
|
gmnet/project/gmnet_tpami/reference/GmNet-code/requirements.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch==1.13.1
|
| 2 |
+
torchvision==0.14.1
|
| 3 |
+
timm==0.6.13
|
| 4 |
+
einops
|
| 5 |
+
fvcore
|
| 6 |
+
h5py
|
| 7 |
+
pyyaml
|
| 8 |
+
wandb
|
| 9 |
+
numpy==1.26.0
|
gmnet/project/gmnet_tpami/reference/GmNet-code/train_imagenet.py
ADDED
|
@@ -0,0 +1,1286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
import argparse
|
| 2 |
+
import logging
|
| 3 |
+
import os
|
| 4 |
+
import time
|
| 5 |
+
import glob
|
| 6 |
+
from collections import OrderedDict
|
| 7 |
+
from contextlib import suppress
|
| 8 |
+
from datetime import datetime
|
| 9 |
+
import shutil
|
| 10 |
+
import operator
|
| 11 |
+
import numpy as np
|
| 12 |
+
|
| 13 |
+
import torch
|
| 14 |
+
import torch.nn as nn
|
| 15 |
+
import torchvision.utils
|
| 16 |
+
import yaml
|
| 17 |
+
from torch.nn.parallel import DistributedDataParallel as NativeDDP
|
| 18 |
+
|
| 19 |
+
from timm import utils
|
| 20 |
+
from timm.data import create_dataset, create_loader, resolve_data_config, Mixup, FastCollateMixup, AugMixDataset
|
| 21 |
+
from timm.loss import JsdCrossEntropy, SoftTargetCrossEntropy, BinaryCrossEntropy, \
|
| 22 |
+
LabelSmoothingCrossEntropy
|
| 23 |
+
from timm.models import create_model, safe_model_name, resume_checkpoint, load_checkpoint, \
|
| 24 |
+
convert_splitbn_model, convert_sync_batchnorm, model_parameters, set_fast_norm
|
| 25 |
+
from timm.optim import create_optimizer_v2, optimizer_kwargs
|
| 26 |
+
from timm.scheduler import create_scheduler
|
| 27 |
+
# from timm.utils import ApexScaler, NativeScaler
|
| 28 |
+
from utils import ApexScalerAccum as ApexScaler
|
| 29 |
+
from utils import NativeScalerAccum as NativeScaler
|
| 30 |
+
from utils import auto_resume_helper, DistillationLoss
|
| 31 |
+
import gmnet
|
| 32 |
+
import pdb
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
try:
|
| 36 |
+
from apex import amp
|
| 37 |
+
from apex.parallel import DistributedDataParallel as ApexDDP
|
| 38 |
+
from apex.parallel import convert_syncbn_model
|
| 39 |
+
has_apex = True
|
| 40 |
+
except ImportError:
|
| 41 |
+
has_apex = False
|
| 42 |
+
|
| 43 |
+
has_native_amp = False
|
| 44 |
+
try:
|
| 45 |
+
if getattr(torch.cuda.amp, 'autocast') is not None:
|
| 46 |
+
has_native_amp = True
|
| 47 |
+
except AttributeError:
|
| 48 |
+
pass
|
| 49 |
+
|
| 50 |
+
try:
|
| 51 |
+
import wandb
|
| 52 |
+
has_wandb = True
|
| 53 |
+
except ImportError:
|
| 54 |
+
has_wandb = False
|
| 55 |
+
|
| 56 |
+
try:
|
| 57 |
+
from functorch.compile import memory_efficient_fusion
|
| 58 |
+
has_functorch = True
|
| 59 |
+
except ImportError as e:
|
| 60 |
+
has_functorch = False
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
torch.backends.cudnn.benchmark = True
|
| 64 |
+
_logger = logging.getLogger('train')
|
| 65 |
+
|
| 66 |
+
# The first arg parser parses out only the --config argument, this argument is used to
|
| 67 |
+
# load a yaml file containing key-values that override the defaults for the main parser below
|
| 68 |
+
config_parser = parser = argparse.ArgumentParser(description='Training Config', add_help=False)
|
| 69 |
+
parser.add_argument('-c', '--config', default='', type=str, metavar='FILE',
|
| 70 |
+
help='YAML config file specifying default arguments')
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
parser = argparse.ArgumentParser(description='PyTorch ImageNet Training')
|
| 74 |
+
|
| 75 |
+
# Dataset parameters
|
| 76 |
+
group = parser.add_argument_group('Dataset parameters')
|
| 77 |
+
# Keep this argument outside of the dataset group because it is positional.
|
| 78 |
+
parser.add_argument('--data', metavar='DIR',
|
| 79 |
+
help='path to dataset')
|
| 80 |
+
group.add_argument('--dataset', '-d', metavar='NAME', default='',
|
| 81 |
+
help='dataset type (default: ImageFolder/ImageTar if empty)')
|
| 82 |
+
group.add_argument('--train-split', metavar='NAME', default='train',
|
| 83 |
+
help='dataset train split (default: train)')
|
| 84 |
+
group.add_argument('--val-split', metavar='NAME', default='validation',
|
| 85 |
+
help='dataset validation split (default: validation)')
|
| 86 |
+
group.add_argument('--dataset-download', action='store_true', default=False,
|
| 87 |
+
help='Allow download of dataset for torch/ and tfds/ datasets that support it.')
|
| 88 |
+
group.add_argument('--class-map', default='', type=str, metavar='FILENAME',
|
| 89 |
+
help='path to class to idx mapping file (default: "")')
|
| 90 |
+
|
| 91 |
+
# Model parameters
|
| 92 |
+
group = parser.add_argument_group('Model parameters')
|
| 93 |
+
group.add_argument('--model', default='resnet50', type=str, metavar='MODEL',
|
| 94 |
+
help='Name of model to train (default: "resnet50"')
|
| 95 |
+
group.add_argument('--pretrained', action='store_true', default=False,
|
| 96 |
+
help='Start with pretrained version of specified network (if avail)')
|
| 97 |
+
group.add_argument('--initial-checkpoint', default='', type=str, metavar='PATH',
|
| 98 |
+
help='Initialize model from this checkpoint (default: none)')
|
| 99 |
+
group.add_argument('--resume', default='', type=str, metavar='PATH',
|
| 100 |
+
help='Resume full model and optimizer state from checkpoint (default: none)')
|
| 101 |
+
group.add_argument('--no-resume-opt', action='store_true', default=False,
|
| 102 |
+
help='prevent resume of optimizer state when resuming model')
|
| 103 |
+
group.add_argument('--num-classes', type=int, default=None, metavar='N',
|
| 104 |
+
help='number of label classes (Model default if None)')
|
| 105 |
+
group.add_argument('--gp', default=None, type=str, metavar='POOL',
|
| 106 |
+
help='Global pool type, one of (fast, avg, max, avgmax, avgmaxc). Model default if None.')
|
| 107 |
+
group.add_argument('--img-size', type=int, default=None, metavar='N',
|
| 108 |
+
help='Image patch size (default: None => model default)')
|
| 109 |
+
group.add_argument('--input-size', default=None, nargs=3, type=int,
|
| 110 |
+
metavar='N N N', help='Input all image dimensions (d h w, e.g. --input-size 3 224 224), uses model default if empty')
|
| 111 |
+
group.add_argument('--crop-pct', default=None, type=float,
|
| 112 |
+
metavar='N', help='Input image center crop percent (for validation only)')
|
| 113 |
+
group.add_argument('--mean', type=float, nargs='+', default=None, metavar='MEAN',
|
| 114 |
+
help='Override mean pixel value of dataset')
|
| 115 |
+
group.add_argument('--std', type=float, nargs='+', default=None, metavar='STD',
|
| 116 |
+
help='Override std deviation of dataset')
|
| 117 |
+
group.add_argument('--interpolation', default='', type=str, metavar='NAME',
|
| 118 |
+
help='Image resize interpolation type (overrides model)')
|
| 119 |
+
group.add_argument('-b', '--batch-size', type=int, default=128, metavar='N',
|
| 120 |
+
help='Input batch size for training (default: 128)')
|
| 121 |
+
group.add_argument('-vb', '--validation-batch-size', type=int, default=None, metavar='N',
|
| 122 |
+
help='Validation batch size override (default: None)')
|
| 123 |
+
group.add_argument('--channels-last', action='store_true', default=False,
|
| 124 |
+
help='Use channels_last memory layout')
|
| 125 |
+
scripting_group = group.add_mutually_exclusive_group()
|
| 126 |
+
scripting_group.add_argument('--torchscript', dest='torchscript', action='store_true',
|
| 127 |
+
help='torch.jit.script the full model')
|
| 128 |
+
scripting_group.add_argument('--aot-autograd', default=False, action='store_true',
|
| 129 |
+
help="Enable AOT Autograd support. (It's recommended to use this option with `--fuser nvfuser` together)")
|
| 130 |
+
group.add_argument('--fuser', default='', type=str,
|
| 131 |
+
help="Select jit fuser. One of ('', 'te', 'old', 'nvfuser')")
|
| 132 |
+
group.add_argument('--fast-norm', default=False, action='store_true',
|
| 133 |
+
help='enable experimental fast-norm')
|
| 134 |
+
group.add_argument('--grad-checkpointing', action='store_true', default=False,
|
| 135 |
+
help='Enable gradient checkpointing through model blocks/stages')
|
| 136 |
+
|
| 137 |
+
# Optimizer parameters
|
| 138 |
+
group = parser.add_argument_group('Optimizer parameters')
|
| 139 |
+
group.add_argument('--opt', default='adamw', type=str, metavar='OPTIMIZER',
|
| 140 |
+
help='Optimizer (default: "adamw"')
|
| 141 |
+
group.add_argument('--opt-eps', default=None, type=float, metavar='EPSILON',
|
| 142 |
+
help='Optimizer Epsilon (default: None, use opt default)')
|
| 143 |
+
group.add_argument('--opt-betas', default=None, type=float, nargs='+', metavar='BETA',
|
| 144 |
+
help='Optimizer Betas (default: None, use opt default)')
|
| 145 |
+
group.add_argument('--momentum', type=float, default=0.9, metavar='M',
|
| 146 |
+
help='Optimizer momentum (default: 0.9)')
|
| 147 |
+
group.add_argument('--weight-decay', type=float, default=0.05,
|
| 148 |
+
help='weight decay (default: 0.05)')
|
| 149 |
+
group.add_argument('--clip-grad', type=float, default=None, metavar='NORM',
|
| 150 |
+
help='Clip gradient norm (default: None, no clipping)')
|
| 151 |
+
group.add_argument('--clip-mode', type=str, default='norm',
|
| 152 |
+
help='Gradient clipping mode. One of ("norm", "value", "agc")')
|
| 153 |
+
group.add_argument('--layer-decay', type=float, default=None,
|
| 154 |
+
help='layer-wise learning rate decay (default: None)')
|
| 155 |
+
|
| 156 |
+
# Learning rate schedule parameters
|
| 157 |
+
group = parser.add_argument_group('Learning rate schedule parameters')
|
| 158 |
+
group.add_argument('--sched', default='cosine', type=str, metavar='SCHEDULER',
|
| 159 |
+
help='LR scheduler (default: "cosine"')
|
| 160 |
+
group.add_argument('--lr', type=float, default=0.05, metavar='LR',
|
| 161 |
+
help='learning rate (default: 0.05)')
|
| 162 |
+
group.add_argument('--lr-noise', type=float, nargs='+', default=None, metavar='pct, pct',
|
| 163 |
+
help='learning rate noise on/off epoch percentages')
|
| 164 |
+
group.add_argument('--lr-noise-pct', type=float, default=0.67, metavar='PERCENT',
|
| 165 |
+
help='learning rate noise limit percent (default: 0.67)')
|
| 166 |
+
group.add_argument('--lr-noise-std', type=float, default=1.0, metavar='STDDEV',
|
| 167 |
+
help='learning rate noise std-dev (default: 1.0)')
|
| 168 |
+
group.add_argument('--lr-cycle-mul', type=float, default=1.0, metavar='MULT',
|
| 169 |
+
help='learning rate cycle len multiplier (default: 1.0)')
|
| 170 |
+
group.add_argument('--lr-cycle-decay', type=float, default=0.5, metavar='MULT',
|
| 171 |
+
help='amount to decay each learning rate cycle (default: 0.5)')
|
| 172 |
+
group.add_argument('--lr-cycle-limit', type=int, default=1, metavar='N',
|
| 173 |
+
help='learning rate cycle limit, cycles enabled if > 1')
|
| 174 |
+
group.add_argument('--lr-k-decay', type=float, default=1.0,
|
| 175 |
+
help='learning rate k-decay for cosine/poly (default: 1.0)')
|
| 176 |
+
group.add_argument('--warmup-lr', type=float, default=1e-6, metavar='LR',
|
| 177 |
+
help='warmup learning rate (default: 1e-6)')
|
| 178 |
+
group.add_argument('--min-lr', type=float, default=1e-5, metavar='LR',
|
| 179 |
+
help='lower lr bound for cyclic schedulers that hit 0 (1e-5)')
|
| 180 |
+
group.add_argument('--epochs', type=int, default=300, metavar='N',
|
| 181 |
+
help='number of epochs to train (default: 300)')
|
| 182 |
+
parser.add_argument('--grad-accum-steps', default=1, type=int,
|
| 183 |
+
help='gradient accumulation steps')
|
| 184 |
+
group.add_argument('--epoch-repeats', type=float, default=0., metavar='N',
|
| 185 |
+
help='epoch repeat multiplier (number of times to repeat dataset epoch per train epoch).')
|
| 186 |
+
group.add_argument('--start-epoch', default=None, type=int, metavar='N',
|
| 187 |
+
help='manual epoch number (useful on restarts)')
|
| 188 |
+
group.add_argument('--decay-milestones', default=[30, 60], type=int, nargs='+', metavar="MILESTONES",
|
| 189 |
+
help='list of decay epoch indices for multistep lr. must be increasing')
|
| 190 |
+
group.add_argument('--decay-epochs', type=float, default=100, metavar='N',
|
| 191 |
+
help='epoch interval to decay LR')
|
| 192 |
+
group.add_argument('--warmup-epochs', type=int, default=5, metavar='N',
|
| 193 |
+
help='epochs to warmup LR, if scheduler supports')
|
| 194 |
+
group.add_argument('--cooldown-epochs', type=int, default=10, metavar='N',
|
| 195 |
+
help='epochs to cooldown LR at min_lr, after cyclic schedule ends')
|
| 196 |
+
group.add_argument('--patience-epochs', type=int, default=10, metavar='N',
|
| 197 |
+
help='patience epochs for Plateau LR scheduler (default: 10')
|
| 198 |
+
group.add_argument('--decay-rate', '--dr', type=float, default=0.1, metavar='RATE',
|
| 199 |
+
help='LR decay rate (default: 0.1)')
|
| 200 |
+
|
| 201 |
+
# Augmentation & regularization parameters
|
| 202 |
+
group = parser.add_argument_group('Augmentation and regularization parameters')
|
| 203 |
+
group.add_argument('--no-aug', action='store_true', default=False,
|
| 204 |
+
help='Disable all training augmentation, override other train aug args')
|
| 205 |
+
group.add_argument('--scale', type=float, nargs='+', default=[0.08, 1.0], metavar='PCT',
|
| 206 |
+
help='Random resize scale (default: 0.08 1.0)')
|
| 207 |
+
group.add_argument('--ratio', type=float, nargs='+', default=[3./4., 4./3.], metavar='RATIO',
|
| 208 |
+
help='Random resize aspect ratio (default: 0.75 1.33)')
|
| 209 |
+
group.add_argument('--hflip', type=float, default=0.5,
|
| 210 |
+
help='Horizontal flip training aug probability')
|
| 211 |
+
group.add_argument('--vflip', type=float, default=0.,
|
| 212 |
+
help='Vertical flip training aug probability')
|
| 213 |
+
group.add_argument('--color-jitter', type=float, default=0.4, metavar='PCT',
|
| 214 |
+
help='Color jitter factor (default: 0.4)')
|
| 215 |
+
group.add_argument('--aa', type=str, default='rand-m9-mstd0.5-inc1', metavar='NAME', ## rand-m1-mstd0.5-inc1
|
| 216 |
+
help='Use AutoAugment policy. "v0" or "original". (default: rand-m9-mstd0.5-inc1)'),
|
| 217 |
+
group.add_argument('--aug-repeats', type=float, default=0,
|
| 218 |
+
help='Number of augmentation repetitions (distributed training only) (default: 0)')
|
| 219 |
+
group.add_argument('--aug-splits', type=int, default=0,
|
| 220 |
+
help='Number of augmentation splits (default: 0, valid: 0 or >=2)')
|
| 221 |
+
group.add_argument('--jsd-loss', action='store_true', default=False,
|
| 222 |
+
help='Enable Jensen-Shannon Divergence + CE loss. Use with `--aug-splits`.')
|
| 223 |
+
group.add_argument('--bce-loss', action='store_true', default=False,
|
| 224 |
+
help='Enable BCE loss w/ Mixup/CutMix use.')
|
| 225 |
+
group.add_argument('--bce-target-thresh', type=float, default=None,
|
| 226 |
+
help='Threshold for binarizing softened BCE targets (default: None, disabled)')
|
| 227 |
+
group.add_argument('--reprob', type=float, default=0.25, metavar='PCT',
|
| 228 |
+
help='Random erase prob (default: 0.25)')
|
| 229 |
+
group.add_argument('--remode', type=str, default='pixel',
|
| 230 |
+
help='Random erase mode (default: "pixel")')
|
| 231 |
+
group.add_argument('--recount', type=int, default=1,
|
| 232 |
+
help='Random erase count (default: 1)')
|
| 233 |
+
group.add_argument('--resplit', action='store_true', default=False,
|
| 234 |
+
help='Do not random erase first (clean) augmentation split')
|
| 235 |
+
group.add_argument('--mixup', type=float, default=0.8,
|
| 236 |
+
help='mixup alpha, mixup enabled if > 0. (default: 0.8)')
|
| 237 |
+
group.add_argument('--cutmix', type=float, default=1.0,
|
| 238 |
+
help='cutmix alpha, cutmix enabled if > 0. (default: 1.0)')
|
| 239 |
+
group.add_argument('--cutmix-minmax', type=float, nargs='+', default=None,
|
| 240 |
+
help='cutmix min/max ratio, overrides alpha and enables cutmix if set (default: None)')
|
| 241 |
+
group.add_argument('--mixup-prob', type=float, default=1.0,
|
| 242 |
+
help='Probability of performing mixup or cutmix when either/both is enabled')
|
| 243 |
+
group.add_argument('--mixup-switch-prob', type=float, default=0.5,
|
| 244 |
+
help='Probability of switching to cutmix when both mixup and cutmix enabled')
|
| 245 |
+
group.add_argument('--mixup-mode', type=str, default='batch',
|
| 246 |
+
help='How to apply mixup/cutmix params. Per "batch", "pair", or "elem"')
|
| 247 |
+
group.add_argument('--mixup-off-epoch', default=0, type=int, metavar='N',
|
| 248 |
+
help='Turn off mixup after this epoch, disabled if 0 (default: 0)')
|
| 249 |
+
group.add_argument('--smoothing', type=float, default=0.1,
|
| 250 |
+
help='Label smoothing (default: 0.1)')
|
| 251 |
+
group.add_argument('--train-interpolation', type=str, default='random',
|
| 252 |
+
help='Training interpolation (random, bilinear, bicubic default: "random")')
|
| 253 |
+
group.add_argument('--drop', type=float, default=0.0, metavar='PCT',
|
| 254 |
+
help='Dropout rate (default: 0.)')
|
| 255 |
+
group.add_argument('--drop-connect', type=float, default=None, metavar='PCT',
|
| 256 |
+
help='Drop connect rate, DEPRECATED, use drop-path (default: None)')
|
| 257 |
+
group.add_argument('--drop-path', type=float, default=None, metavar='PCT',
|
| 258 |
+
help='Drop path rate (default: None)')
|
| 259 |
+
group.add_argument('--drop-block', type=float, default=None, metavar='PCT',
|
| 260 |
+
help='Drop block rate (default: None)')
|
| 261 |
+
group.add_argument('--head-dropout', type=float, default=0.0, metavar='PCT',
|
| 262 |
+
help='dropout rate for classifier (default: 0.0)')
|
| 263 |
+
|
| 264 |
+
# Batch norm parameters (only works with gen_efficientnet based models currently)
|
| 265 |
+
group = parser.add_argument_group('Batch norm parameters', 'Only works with gen_efficientnet based models currently.')
|
| 266 |
+
group.add_argument('--bn-momentum', type=float, default=None,
|
| 267 |
+
help='BatchNorm momentum override (if not None)')
|
| 268 |
+
group.add_argument('--bn-eps', type=float, default=None,
|
| 269 |
+
help='BatchNorm epsilon override (if not None)')
|
| 270 |
+
group.add_argument('--sync-bn', action='store_true',
|
| 271 |
+
help='Enable NVIDIA Apex or Torch synchronized BatchNorm.')
|
| 272 |
+
group.add_argument('--dist-bn', type=str, default='reduce',
|
| 273 |
+
help='Distribute BatchNorm stats between nodes after each epoch ("broadcast", "reduce", or "")')
|
| 274 |
+
group.add_argument('--split-bn', action='store_true',
|
| 275 |
+
help='Enable separate BN layers per augmentation split.')
|
| 276 |
+
|
| 277 |
+
# Model Exponential Moving Average
|
| 278 |
+
group = parser.add_argument_group('Model exponential moving average parameters')
|
| 279 |
+
group.add_argument('--model-ema', action='store_true', default=False,
|
| 280 |
+
help='Enable tracking moving average of model weights')
|
| 281 |
+
group.add_argument('--model-ema-force-cpu', action='store_true', default=False,
|
| 282 |
+
help='Force ema to be tracked on CPU, rank=0 node only. Disables EMA validation.')
|
| 283 |
+
group.add_argument('--model-ema-decay', type=float, default=0.9998,
|
| 284 |
+
help='decay factor for model weights moving average (default: 0.9998)')
|
| 285 |
+
|
| 286 |
+
# Misc
|
| 287 |
+
group = parser.add_argument_group('Miscellaneous parameters')
|
| 288 |
+
group.add_argument('--seed', type=int, default=42, metavar='S',
|
| 289 |
+
help='random seed (default: 42)')
|
| 290 |
+
group.add_argument('--worker-seeding', type=str, default='all',
|
| 291 |
+
help='worker seed mode (default: all)')
|
| 292 |
+
group.add_argument('--log-interval', type=int, default=50, metavar='N',
|
| 293 |
+
help='how many batches to wait before logging training status')
|
| 294 |
+
group.add_argument('--recovery-interval', type=int, default=0, metavar='N',
|
| 295 |
+
help='how many batches to wait before writing recovery checkpoint')
|
| 296 |
+
group.add_argument('--checkpoint-hist', type=int, default=10, metavar='N',
|
| 297 |
+
help='number of checkpoints to keep (default: 10)')
|
| 298 |
+
group.add_argument('-j', '--workers', type=int, default=8, metavar='N',
|
| 299 |
+
help='how many training processes to use (default: 8)')
|
| 300 |
+
group.add_argument('--save-images', action='store_true', default=False,
|
| 301 |
+
help='save images of input bathes every log interval for debugging')
|
| 302 |
+
group.add_argument('--amp', action='store_true', default=False,
|
| 303 |
+
help='use NVIDIA Apex AMP or Native AMP for mixed precision training')
|
| 304 |
+
group.add_argument('--apex-amp', action='store_true', default=False,
|
| 305 |
+
help='Use NVIDIA Apex AMP mixed precision')
|
| 306 |
+
group.add_argument('--native-amp', action='store_true', default=False,
|
| 307 |
+
help='Use Native Torch AMP mixed precision')
|
| 308 |
+
group.add_argument('--no-ddp-bb', action='store_true', default=False,
|
| 309 |
+
help='Force broadcast buffers for native DDP to off.')
|
| 310 |
+
group.add_argument('--pin-mem', action='store_true', default=False,
|
| 311 |
+
help='Pin CPU memory in DataLoader for more efficient (sometimes) transfer to GPU.')
|
| 312 |
+
group.add_argument('--no-prefetcher', action='store_true', default=False,
|
| 313 |
+
help='disable fast prefetcher')
|
| 314 |
+
group.add_argument('--output', default='/scratch/wang.huan/yf/starnet_output/', type=str, metavar='PATH',
|
| 315 |
+
help='path to output folder (default: none, current dir)')
|
| 316 |
+
group.add_argument('--experiment', default='', type=str, metavar='NAME',
|
| 317 |
+
help='name of train experiment, name of sub-folder for output')
|
| 318 |
+
group.add_argument('--eval-metric', default='top1', type=str, metavar='EVAL_METRIC',
|
| 319 |
+
help='Best metric (default: "top1"')
|
| 320 |
+
group.add_argument('--tta', type=int, default=0, metavar='N',
|
| 321 |
+
help='Test/inference time augmentation (oversampling) factor. 0=None (default: 0)')
|
| 322 |
+
group.add_argument("--local_rank", default=0, type=int)
|
| 323 |
+
group.add_argument('--use-multi-epochs-loader', action='store_true', default=False,
|
| 324 |
+
help='use the multi-epochs-loader to save time at the beginning of every epoch')
|
| 325 |
+
group.add_argument('--log-wandb', action='store_true', default=False,
|
| 326 |
+
help='log training and validation metrics to wandb')
|
| 327 |
+
group.add_argument('--auto-resume', action='store_true', default=False,
|
| 328 |
+
help='If use auto-resume to automatically resume, mainly for MS cluster.')
|
| 329 |
+
group.add_argument('--exp_tag', default='', type=str, metavar='NAME',
|
| 330 |
+
help='add tag for particular experiment')
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
# Distillation parameters
|
| 334 |
+
group = parser.add_argument_group('Distillation Parameters')
|
| 335 |
+
group.add_argument('--teacher_model', default='regnety_160', type=str, metavar='MODEL',
|
| 336 |
+
help='Name of teacher model to train (default: "regnety_160"')
|
| 337 |
+
group.add_argument('--teacher-path', type=str,
|
| 338 |
+
default='https://dl.fbaipublicfiles.com/deit/regnety_160-a5fe301d.pth')
|
| 339 |
+
group.add_argument('--distillation-type', default='none',
|
| 340 |
+
choices=['none', 'soft', 'hard'], type=str, help="")
|
| 341 |
+
group.add_argument('--distillation-alpha',
|
| 342 |
+
default=0.9, type=float, help="")
|
| 343 |
+
group.add_argument('--distillation-tau', default=4.0, type=float, help="")
|
| 344 |
+
|
| 345 |
+
def _parse_args():
|
| 346 |
+
# Do we have a config file to parse?
|
| 347 |
+
args_config, remaining = config_parser.parse_known_args()
|
| 348 |
+
if args_config.config:
|
| 349 |
+
with open(args_config.config, 'r') as f:
|
| 350 |
+
cfg = yaml.safe_load(f)
|
| 351 |
+
parser.set_defaults(**cfg)
|
| 352 |
+
|
| 353 |
+
# The main arg parser parses the rest of the args, the usual
|
| 354 |
+
# defaults will have been overridden if config file specified.
|
| 355 |
+
args = parser.parse_args(remaining)
|
| 356 |
+
|
| 357 |
+
# Cache the args as a text string to save them in the output dir later
|
| 358 |
+
args_text = yaml.safe_dump(args.__dict__, default_flow_style=False)
|
| 359 |
+
return args, args_text
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
def main():
|
| 363 |
+
utils.setup_default_logging()
|
| 364 |
+
args, args_text = _parse_args()
|
| 365 |
+
|
| 366 |
+
args.prefetcher = not args.no_prefetcher
|
| 367 |
+
|
| 368 |
+
args.distributed = False
|
| 369 |
+
if 'WORLD_SIZE' in os.environ:
|
| 370 |
+
args.distributed = int(os.environ['WORLD_SIZE']) > 1
|
| 371 |
+
args.device = 'cuda:0'
|
| 372 |
+
args.world_size = 1
|
| 373 |
+
args.rank = 0 # global rank
|
| 374 |
+
#
|
| 375 |
+
#print(args.distributed)
|
| 376 |
+
if args.distributed:
|
| 377 |
+
if 'LOCAL_RANK' in os.environ:
|
| 378 |
+
args.local_rank = int(os.getenv('LOCAL_RANK'))
|
| 379 |
+
args.device = 'cuda:%d' % args.local_rank
|
| 380 |
+
torch.cuda.set_device(args.local_rank)
|
| 381 |
+
torch.distributed.init_process_group(backend='nccl', init_method='env://')
|
| 382 |
+
args.world_size = torch.distributed.get_world_size()
|
| 383 |
+
args.rank = torch.distributed.get_rank()
|
| 384 |
+
_logger.info('Training in distributed mode with multiple processes, 1 GPU per process. Process %d, total %d.'
|
| 385 |
+
% (args.rank, args.world_size))
|
| 386 |
+
else:
|
| 387 |
+
_logger.info('Training with a single process on 1 GPUs.')
|
| 388 |
+
assert args.rank >= 0
|
| 389 |
+
|
| 390 |
+
if args.rank == 0 and args.log_wandb:
|
| 391 |
+
if has_wandb:
|
| 392 |
+
wandb.init(project=args.experiment, config=args)
|
| 393 |
+
else:
|
| 394 |
+
_logger.warning("You've requested to log metrics to wandb but package not found. "
|
| 395 |
+
"Metrics not being logged to wandb, try `pip install wandb`")
|
| 396 |
+
|
| 397 |
+
# resolve AMP arguments based on PyTorch / Apex availability
|
| 398 |
+
use_amp = None
|
| 399 |
+
if args.amp:
|
| 400 |
+
# `--amp` chooses native amp before apex (APEX ver not actively maintained)
|
| 401 |
+
if has_native_amp:
|
| 402 |
+
args.native_amp = True
|
| 403 |
+
elif has_apex:
|
| 404 |
+
args.apex_amp = True
|
| 405 |
+
if args.apex_amp and has_apex:
|
| 406 |
+
use_amp = 'apex'
|
| 407 |
+
elif args.native_amp and has_native_amp:
|
| 408 |
+
use_amp = 'native'
|
| 409 |
+
elif args.apex_amp or args.native_amp:
|
| 410 |
+
_logger.warning("Neither APEX or native Torch AMP is available, using float32. "
|
| 411 |
+
"Install NVIDA apex or upgrade to PyTorch 1.6")
|
| 412 |
+
|
| 413 |
+
utils.random_seed(args.seed, args.rank)
|
| 414 |
+
|
| 415 |
+
if args.fuser:
|
| 416 |
+
utils.set_jit_fuser(args.fuser)
|
| 417 |
+
if args.fast_norm:
|
| 418 |
+
set_fast_norm()
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
create_model_args = dict(
|
| 423 |
+
model_name=args.model,
|
| 424 |
+
pretrained=args.pretrained,
|
| 425 |
+
num_classes=args.num_classes,
|
| 426 |
+
drop_rate=args.drop,
|
| 427 |
+
drop_connect_rate=args.drop_connect, # DEPRECATED, use drop_path
|
| 428 |
+
drop_path_rate=args.drop_path,
|
| 429 |
+
drop_block_rate=args.drop_block,
|
| 430 |
+
global_pool=args.gp,
|
| 431 |
+
bn_momentum=args.bn_momentum,
|
| 432 |
+
bn_eps=args.bn_eps,
|
| 433 |
+
scriptable=args.torchscript,
|
| 434 |
+
# checkpoint_path=args.initial_checkpoint
|
| 435 |
+
)
|
| 436 |
+
|
| 437 |
+
model = create_model(**create_model_args)
|
| 438 |
+
# import pdb
|
| 439 |
+
# pdb.set_trace()
|
| 440 |
+
|
| 441 |
+
load_npy_weights_directly(model, args.initial_checkpoint)
|
| 442 |
+
|
| 443 |
+
import pdb
|
| 444 |
+
# pdb.set_trace()
|
| 445 |
+
|
| 446 |
+
if args.num_classes is None:
|
| 447 |
+
# assert hasattr(model, 'num_classes'), 'Model must have `num_classes` attr if not set on cmd line/config.'
|
| 448 |
+
try:
|
| 449 |
+
args.num_classes = model.num_classes # FIXME handle model default vs config num_classes more elegantly
|
| 450 |
+
except:
|
| 451 |
+
args.num_classes = 1000
|
| 452 |
+
|
| 453 |
+
if args.grad_checkpointing:
|
| 454 |
+
model.set_grad_checkpointing(enable=True)
|
| 455 |
+
|
| 456 |
+
if args.local_rank == 0:
|
| 457 |
+
_logger.info(
|
| 458 |
+
f'Model {safe_model_name(args.model)} created, param count:{sum([m.numel() for m in model.parameters()])}')
|
| 459 |
+
|
| 460 |
+
data_config = resolve_data_config(vars(args), model=model, verbose=args.local_rank == 0)
|
| 461 |
+
|
| 462 |
+
# setup augmentation batch splits for contrastive loss or split bn
|
| 463 |
+
num_aug_splits = 0
|
| 464 |
+
if args.aug_splits > 0:
|
| 465 |
+
assert args.aug_splits > 1, 'A split of 1 makes no sense'
|
| 466 |
+
num_aug_splits = args.aug_splits
|
| 467 |
+
|
| 468 |
+
# enable split bn (separate bn stats per batch-portion)
|
| 469 |
+
if args.split_bn:
|
| 470 |
+
assert num_aug_splits > 1 or args.resplit
|
| 471 |
+
model = convert_splitbn_model(model, max(num_aug_splits, 2))
|
| 472 |
+
|
| 473 |
+
# move model to GPU, enable channels last layout if set
|
| 474 |
+
model.cuda()
|
| 475 |
+
if args.channels_last:
|
| 476 |
+
model = model.to(memory_format=torch.channels_last)
|
| 477 |
+
|
| 478 |
+
# setup synchronized BatchNorm for distributed training
|
| 479 |
+
if args.distributed and args.sync_bn:
|
| 480 |
+
args.dist_bn = '' # disable dist_bn when sync BN active
|
| 481 |
+
assert not args.split_bn
|
| 482 |
+
if has_apex and use_amp == 'apex':
|
| 483 |
+
# Apex SyncBN used with Apex AMP
|
| 484 |
+
# WARNING this won't currently work with models using BatchNormAct2d
|
| 485 |
+
model = convert_syncbn_model(model)
|
| 486 |
+
else:
|
| 487 |
+
model = convert_sync_batchnorm(model)
|
| 488 |
+
if args.local_rank == 0:
|
| 489 |
+
_logger.info(
|
| 490 |
+
'Converted model to use Synchronized BatchNorm. WARNING: You may have issues if using '
|
| 491 |
+
'zero initialized BN layers (enabled by default for ResNets) while sync-bn enabled.')
|
| 492 |
+
|
| 493 |
+
if args.torchscript:
|
| 494 |
+
assert not use_amp == 'apex', 'Cannot use APEX AMP with torchscripted model'
|
| 495 |
+
assert not args.sync_bn, 'Cannot use SyncBatchNorm with torchscripted model'
|
| 496 |
+
model = torch.jit.script(model)
|
| 497 |
+
if args.aot_autograd:
|
| 498 |
+
assert has_functorch, "functorch is needed for --aot-autograd"
|
| 499 |
+
model = memory_efficient_fusion(model)
|
| 500 |
+
|
| 501 |
+
optimizer = create_optimizer_v2(model, **optimizer_kwargs(cfg=args))
|
| 502 |
+
|
| 503 |
+
# setup automatic mixed-precision (AMP) loss scaling and op casting
|
| 504 |
+
amp_autocast = suppress # do nothing
|
| 505 |
+
loss_scaler = None
|
| 506 |
+
if use_amp == 'apex':
|
| 507 |
+
model, optimizer = amp.initialize(model, optimizer, opt_level='O1')
|
| 508 |
+
loss_scaler = ApexScaler()
|
| 509 |
+
if args.local_rank == 0:
|
| 510 |
+
_logger.info('Using NVIDIA APEX AMP. Training in mixed precision.')
|
| 511 |
+
elif use_amp == 'native':
|
| 512 |
+
amp_autocast = torch.cuda.amp.autocast
|
| 513 |
+
loss_scaler = NativeScaler()
|
| 514 |
+
if args.local_rank == 0:
|
| 515 |
+
_logger.info('Using native Torch AMP. Training in mixed precision.')
|
| 516 |
+
else:
|
| 517 |
+
if args.local_rank == 0:
|
| 518 |
+
_logger.info('AMP not enabled. Training in float32.')
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
# auto resume for MS clusters
|
| 522 |
+
if args.auto_resume:
|
| 523 |
+
if args.experiment:
|
| 524 |
+
exp_name = args.experiment
|
| 525 |
+
else:
|
| 526 |
+
exp_name = '-'.join([
|
| 527 |
+
# datetime.now().strftime("%Y%m%d-%H%M%S"),
|
| 528 |
+
safe_model_name(args.model),
|
| 529 |
+
"bs"+str(args.batch_size),
|
| 530 |
+
"lr"+str(args.lr),
|
| 531 |
+
"minlr" + str(args.min_lr),
|
| 532 |
+
"wd"+str(args.weight_decay),
|
| 533 |
+
"warmupepoch"+str(args.warmup_epochs),
|
| 534 |
+
"smooth" + str(args.smoothing),
|
| 535 |
+
"mixup" + str(args.mixup),
|
| 536 |
+
"cutmix" + str(args.cutmix),
|
| 537 |
+
"reprob" + str(args.reprob),
|
| 538 |
+
"cj" + str(args.color_jitter),
|
| 539 |
+
"aa" + str(args.aa),
|
| 540 |
+
"distill"+str(args.distillation_type),
|
| 541 |
+
str(data_config['input_size'][-1])
|
| 542 |
+
])
|
| 543 |
+
if args.exp_tag:
|
| 544 |
+
exp_name = exp_name + "-Tag_" + args.exp_tag
|
| 545 |
+
output_dir = args.output if args.output else os.path.join('./OUTPUT/train', exp_name)
|
| 546 |
+
auto_resume_file = auto_resume_helper(output_dir)
|
| 547 |
+
if auto_resume_file:
|
| 548 |
+
args.resume = auto_resume_file
|
| 549 |
+
if args.local_rank == 0:
|
| 550 |
+
_logger.info(f"Auto resume: Change resume file from: {args.resume} to: {auto_resume_file}")
|
| 551 |
+
else:
|
| 552 |
+
if args.local_rank == 0:
|
| 553 |
+
_logger.info(f"Auto resume: No auto resume files found, ignored.")
|
| 554 |
+
|
| 555 |
+
# optionally resume from a checkpoint
|
| 556 |
+
resume_epoch = None
|
| 557 |
+
if args.resume:
|
| 558 |
+
resume_epoch = resume_checkpoint(
|
| 559 |
+
model, args.resume,
|
| 560 |
+
optimizer=None if args.no_resume_opt else optimizer,
|
| 561 |
+
loss_scaler=None if args.no_resume_opt else loss_scaler,
|
| 562 |
+
log_info=args.local_rank == 0)
|
| 563 |
+
|
| 564 |
+
# setup exponential moving average of model weights, SWA could be used here too
|
| 565 |
+
model_ema = None
|
| 566 |
+
if args.model_ema:
|
| 567 |
+
# Important to create EMA model after cuda(), DP wrapper, and AMP but before DDP wrapper
|
| 568 |
+
model_ema = utils.ModelEmaV2(
|
| 569 |
+
model, decay=args.model_ema_decay, device='cpu' if args.model_ema_force_cpu else None)
|
| 570 |
+
if args.resume:
|
| 571 |
+
load_checkpoint(model_ema.module, args.resume, use_ema=True)
|
| 572 |
+
|
| 573 |
+
# setup distributed training
|
| 574 |
+
if args.distributed:
|
| 575 |
+
if has_apex and use_amp == 'apex':
|
| 576 |
+
# Apex DDP preferred unless native amp is activated
|
| 577 |
+
if args.local_rank == 0:
|
| 578 |
+
_logger.info("Using NVIDIA APEX DistributedDataParallel.")
|
| 579 |
+
model = ApexDDP(model, delay_allreduce=True)
|
| 580 |
+
else:
|
| 581 |
+
if args.local_rank == 0:
|
| 582 |
+
_logger.info("Using native Torch DistributedDataParallel.")
|
| 583 |
+
model = NativeDDP(model, device_ids=[args.local_rank], broadcast_buffers=not args.no_ddp_bb)
|
| 584 |
+
# NOTE: EMA model does not need to be wrapped by DDP
|
| 585 |
+
|
| 586 |
+
# setup learning rate schedule and starting epoch
|
| 587 |
+
lr_scheduler, num_epochs = create_scheduler(args, optimizer)
|
| 588 |
+
start_epoch = 0
|
| 589 |
+
if args.start_epoch is not None:
|
| 590 |
+
# a specified start_epoch will always override the resume epoch
|
| 591 |
+
start_epoch = args.start_epoch
|
| 592 |
+
elif resume_epoch is not None:
|
| 593 |
+
start_epoch = resume_epoch
|
| 594 |
+
if lr_scheduler is not None and start_epoch > 0:
|
| 595 |
+
lr_scheduler.step(start_epoch)
|
| 596 |
+
|
| 597 |
+
if args.local_rank == 0:
|
| 598 |
+
_logger.info('Scheduled epochs: {}'.format(num_epochs))
|
| 599 |
+
|
| 600 |
+
# create the train and eval datasets
|
| 601 |
+
dataset_train = create_dataset(
|
| 602 |
+
args.dataset, root=args.data, split=args.train_split, is_training=True,
|
| 603 |
+
class_map=args.class_map,
|
| 604 |
+
download=args.dataset_download,
|
| 605 |
+
batch_size=args.batch_size,
|
| 606 |
+
repeats=args.epoch_repeats)
|
| 607 |
+
dataset_eval = create_dataset(
|
| 608 |
+
args.dataset, root=args.data, split=args.val_split, is_training=False,
|
| 609 |
+
class_map=args.class_map,
|
| 610 |
+
download=args.dataset_download,
|
| 611 |
+
batch_size=args.batch_size)
|
| 612 |
+
|
| 613 |
+
total_batch_size = args.batch_size * args.grad_accum_steps * args.world_size
|
| 614 |
+
num_training_steps_per_epoch = len(dataset_train) // total_batch_size
|
| 615 |
+
if args.local_rank == 0:
|
| 616 |
+
_logger.info('Total batch size: {}'.format(total_batch_size))
|
| 617 |
+
|
| 618 |
+
# setup mixup / cutmix
|
| 619 |
+
collate_fn = None
|
| 620 |
+
mixup_fn = None
|
| 621 |
+
mixup_active = args.mixup > 0 or args.cutmix > 0. or args.cutmix_minmax is not None
|
| 622 |
+
if mixup_active:
|
| 623 |
+
mixup_args = dict(
|
| 624 |
+
mixup_alpha=args.mixup, cutmix_alpha=args.cutmix, cutmix_minmax=args.cutmix_minmax,
|
| 625 |
+
prob=args.mixup_prob, switch_prob=args.mixup_switch_prob, mode=args.mixup_mode,
|
| 626 |
+
label_smoothing=args.smoothing, num_classes=args.num_classes)
|
| 627 |
+
if args.prefetcher:
|
| 628 |
+
assert not num_aug_splits # collate conflict (need to support deinterleaving in collate mixup)
|
| 629 |
+
collate_fn = FastCollateMixup(**mixup_args)
|
| 630 |
+
else:
|
| 631 |
+
mixup_fn = Mixup(**mixup_args)
|
| 632 |
+
|
| 633 |
+
# wrap dataset in AugMix helper
|
| 634 |
+
if num_aug_splits > 1:
|
| 635 |
+
dataset_train = AugMixDataset(dataset_train, num_splits=num_aug_splits)
|
| 636 |
+
|
| 637 |
+
# create data loaders w/ augmentation pipeiine
|
| 638 |
+
train_interpolation = args.train_interpolation
|
| 639 |
+
if args.no_aug or not train_interpolation:
|
| 640 |
+
train_interpolation = data_config['interpolation']
|
| 641 |
+
loader_train = create_loader(
|
| 642 |
+
dataset_train,
|
| 643 |
+
input_size=data_config['input_size'],
|
| 644 |
+
batch_size=args.batch_size,
|
| 645 |
+
is_training=True,
|
| 646 |
+
use_prefetcher=args.prefetcher,
|
| 647 |
+
no_aug=args.no_aug,
|
| 648 |
+
re_prob=args.reprob,
|
| 649 |
+
re_mode=args.remode,
|
| 650 |
+
re_count=args.recount,
|
| 651 |
+
re_split=args.resplit,
|
| 652 |
+
scale=args.scale,
|
| 653 |
+
ratio=args.ratio,
|
| 654 |
+
hflip=args.hflip,
|
| 655 |
+
vflip=args.vflip,
|
| 656 |
+
color_jitter=args.color_jitter,
|
| 657 |
+
auto_augment=args.aa,
|
| 658 |
+
num_aug_repeats=args.aug_repeats,
|
| 659 |
+
num_aug_splits=num_aug_splits,
|
| 660 |
+
interpolation=train_interpolation,
|
| 661 |
+
mean=data_config['mean'],
|
| 662 |
+
std=data_config['std'],
|
| 663 |
+
num_workers=args.workers,
|
| 664 |
+
distributed=args.distributed,
|
| 665 |
+
collate_fn=collate_fn,
|
| 666 |
+
pin_memory=args.pin_mem,
|
| 667 |
+
use_multi_epochs_loader=args.use_multi_epochs_loader,
|
| 668 |
+
worker_seeding=args.worker_seeding,
|
| 669 |
+
)
|
| 670 |
+
|
| 671 |
+
loader_eval = create_loader(
|
| 672 |
+
dataset_eval,
|
| 673 |
+
input_size=data_config['input_size'],
|
| 674 |
+
batch_size=args.validation_batch_size or args.batch_size,
|
| 675 |
+
is_training=False,
|
| 676 |
+
use_prefetcher=args.prefetcher,
|
| 677 |
+
interpolation=data_config['interpolation'],
|
| 678 |
+
mean=data_config['mean'],
|
| 679 |
+
std=data_config['std'],
|
| 680 |
+
num_workers=args.workers,
|
| 681 |
+
distributed=args.distributed,
|
| 682 |
+
crop_pct=data_config['crop_pct'],
|
| 683 |
+
pin_memory=args.pin_mem,
|
| 684 |
+
)
|
| 685 |
+
|
| 686 |
+
# setup loss function
|
| 687 |
+
if args.jsd_loss:
|
| 688 |
+
assert num_aug_splits > 1 # JSD only valid with aug splits set
|
| 689 |
+
train_loss_fn = JsdCrossEntropy(num_splits=num_aug_splits, smoothing=args.smoothing)
|
| 690 |
+
elif mixup_active:
|
| 691 |
+
# smoothing is handled with mixup target transform which outputs sparse, soft targets
|
| 692 |
+
if args.bce_loss:
|
| 693 |
+
train_loss_fn = BinaryCrossEntropy(target_threshold=args.bce_target_thresh)
|
| 694 |
+
else:
|
| 695 |
+
train_loss_fn = SoftTargetCrossEntropy()
|
| 696 |
+
elif args.smoothing:
|
| 697 |
+
if args.bce_loss:
|
| 698 |
+
train_loss_fn = BinaryCrossEntropy(smoothing=args.smoothing, target_threshold=args.bce_target_thresh)
|
| 699 |
+
else:
|
| 700 |
+
train_loss_fn = LabelSmoothingCrossEntropy(smoothing=args.smoothing)
|
| 701 |
+
else:
|
| 702 |
+
train_loss_fn = nn.CrossEntropyLoss()
|
| 703 |
+
train_loss_fn = train_loss_fn.cuda()
|
| 704 |
+
validate_loss_fn = nn.CrossEntropyLoss().cuda()
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
##### set up the distillation related ###
|
| 708 |
+
teacher_model = None
|
| 709 |
+
if args.distillation_type != 'none':
|
| 710 |
+
teach_pretrained = False if args.teacher_path else True
|
| 711 |
+
if args.local_rank == 0:
|
| 712 |
+
_logger.info(f'Using distillation, create teacher model: {args.teacher_model}')
|
| 713 |
+
if teach_pretrained:
|
| 714 |
+
_logger.info('Teacher model load pre-trained checkpoint')
|
| 715 |
+
else:
|
| 716 |
+
_logger.info(f'Teacher model load checkpoint: {args.teacher_path}')
|
| 717 |
+
teacher_model = create_model(
|
| 718 |
+
args.teacher_model,
|
| 719 |
+
pretrained=teach_pretrained,
|
| 720 |
+
num_classes=args.num_classes,
|
| 721 |
+
global_pool='avg',
|
| 722 |
+
)
|
| 723 |
+
if args.teacher_path:
|
| 724 |
+
if args.teacher_path.startswith('https'):
|
| 725 |
+
checkpoint = torch.hub.load_state_dict_from_url(
|
| 726 |
+
args.teacher_path, map_location='cpu', check_hash=True)
|
| 727 |
+
else:
|
| 728 |
+
checkpoint = torch.load(args.teacher_path, map_location='cpu')
|
| 729 |
+
teacher_model.load_state_dict(checkpoint['model'])
|
| 730 |
+
teacher_model.cuda()
|
| 731 |
+
teacher_model.eval()
|
| 732 |
+
|
| 733 |
+
# wrap the criterion in custom DistillationLoss, no matter if use Distillation.
|
| 734 |
+
# which just dispatches to the original criterion if args.distillation_type is 'none'
|
| 735 |
+
train_loss_fn = DistillationLoss(
|
| 736 |
+
train_loss_fn, teacher_model, args.distillation_type,
|
| 737 |
+
args.distillation_alpha, args.distillation_tau, args.num_classes
|
| 738 |
+
)
|
| 739 |
+
|
| 740 |
+
# setup checkpoint saver and eval metric tracking
|
| 741 |
+
eval_metric = args.eval_metric
|
| 742 |
+
best_metric = None
|
| 743 |
+
best_epoch = None
|
| 744 |
+
saver = None
|
| 745 |
+
output_dir = None
|
| 746 |
+
if args.rank == 0:
|
| 747 |
+
if args.experiment:
|
| 748 |
+
exp_name = args.experiment
|
| 749 |
+
else:
|
| 750 |
+
exp_name = '-'.join([
|
| 751 |
+
# datetime.now().strftime("%Y%m%d-%H%M%S"),
|
| 752 |
+
safe_model_name(args.model),
|
| 753 |
+
"bs" + str(args.batch_size),
|
| 754 |
+
"lr" + str(args.lr),
|
| 755 |
+
"minlr" + str(args.min_lr),
|
| 756 |
+
"wd" + str(args.weight_decay),
|
| 757 |
+
"warmupepoch" + str(args.warmup_epochs),
|
| 758 |
+
"smooth" + str(args.smoothing),
|
| 759 |
+
"mixup" + str(args.mixup),
|
| 760 |
+
"cutmix" + str(args.cutmix),
|
| 761 |
+
"reprob" + str(args.reprob),
|
| 762 |
+
"cj" + str(args.color_jitter),
|
| 763 |
+
"aa" + str(args.aa),
|
| 764 |
+
"distill" + str(args.distillation_type),
|
| 765 |
+
str(data_config['input_size'][-1])
|
| 766 |
+
])
|
| 767 |
+
if args.exp_tag:
|
| 768 |
+
exp_name = exp_name + "-Tag_" + args.exp_tag
|
| 769 |
+
output_dir = utils.get_outdir(args.output if args.output else './OUTPUT/train', exp_name)
|
| 770 |
+
decreasing = True if eval_metric == 'loss' else False
|
| 771 |
+
saver = CheckpointSaver(
|
| 772 |
+
model=model, optimizer=optimizer, args=args, model_ema=model_ema, amp_scaler=loss_scaler,
|
| 773 |
+
checkpoint_dir=output_dir, recovery_dir=output_dir, decreasing=decreasing, max_history=args.checkpoint_hist)
|
| 774 |
+
with open(os.path.join(output_dir, 'args.yaml'), 'w') as f:
|
| 775 |
+
f.write(args_text)
|
| 776 |
+
|
| 777 |
+
try:
|
| 778 |
+
for epoch in range(start_epoch, num_epochs):
|
| 779 |
+
if args.distributed and hasattr(loader_train.sampler, 'set_epoch'):
|
| 780 |
+
loader_train.sampler.set_epoch(epoch)
|
| 781 |
+
|
| 782 |
+
train_metrics = train_one_epoch(
|
| 783 |
+
epoch, model, loader_train, optimizer, train_loss_fn, args,
|
| 784 |
+
lr_scheduler=lr_scheduler, saver=saver, output_dir=output_dir,
|
| 785 |
+
amp_autocast=amp_autocast, loss_scaler=loss_scaler, model_ema=model_ema, mixup_fn=mixup_fn,
|
| 786 |
+
grad_accum_steps=args.grad_accum_steps, num_training_steps_per_epoch=num_training_steps_per_epoch
|
| 787 |
+
)
|
| 788 |
+
|
| 789 |
+
if args.distributed and args.dist_bn in ('broadcast', 'reduce'):
|
| 790 |
+
if args.local_rank == 0:
|
| 791 |
+
_logger.info("Distributing BatchNorm running means and vars")
|
| 792 |
+
utils.distribute_bn(model, args.world_size, args.dist_bn == 'reduce')
|
| 793 |
+
|
| 794 |
+
eval_metrics = validate(model, loader_eval, validate_loss_fn, args, amp_autocast=amp_autocast)
|
| 795 |
+
|
| 796 |
+
if model_ema is not None and not args.model_ema_force_cpu:
|
| 797 |
+
if args.distributed and args.dist_bn in ('broadcast', 'reduce'):
|
| 798 |
+
utils.distribute_bn(model_ema, args.world_size, args.dist_bn == 'reduce')
|
| 799 |
+
ema_eval_metrics = validate(
|
| 800 |
+
model_ema.module, loader_eval, validate_loss_fn, args, amp_autocast=amp_autocast, log_suffix=' (EMA)')
|
| 801 |
+
eval_metrics = ema_eval_metrics
|
| 802 |
+
|
| 803 |
+
if lr_scheduler is not None:
|
| 804 |
+
# step LR for next epoch
|
| 805 |
+
lr_scheduler.step(epoch + 1, eval_metrics[eval_metric])
|
| 806 |
+
|
| 807 |
+
if output_dir is not None:
|
| 808 |
+
utils.update_summary(
|
| 809 |
+
epoch, train_metrics, eval_metrics, os.path.join(output_dir, 'summary.csv'),
|
| 810 |
+
write_header=best_metric is None, log_wandb=args.log_wandb and has_wandb)
|
| 811 |
+
|
| 812 |
+
if saver is not None:
|
| 813 |
+
# save proper checkpoint with eval metric
|
| 814 |
+
save_metric = eval_metrics[eval_metric]
|
| 815 |
+
best_metric, best_epoch = saver.my_save_checkpoint(epoch, metric=save_metric)
|
| 816 |
+
|
| 817 |
+
except KeyboardInterrupt:
|
| 818 |
+
pass
|
| 819 |
+
if best_metric is not None:
|
| 820 |
+
_logger.info('*** Best metric: {0} (epoch {1})'.format(best_metric, best_epoch))
|
| 821 |
+
|
| 822 |
+
|
| 823 |
+
def train_one_epoch(
|
| 824 |
+
epoch, model, loader, optimizer, loss_fn, args,
|
| 825 |
+
lr_scheduler=None, saver=None, output_dir=None, amp_autocast=suppress,
|
| 826 |
+
loss_scaler=None, model_ema=None, mixup_fn=None,
|
| 827 |
+
grad_accum_steps=1, num_training_steps_per_epoch=None):
|
| 828 |
+
|
| 829 |
+
if args.mixup_off_epoch and epoch >= args.mixup_off_epoch:
|
| 830 |
+
if args.prefetcher and loader.mixup_enabled:
|
| 831 |
+
loader.mixup_enabled = False
|
| 832 |
+
elif mixup_fn is not None:
|
| 833 |
+
mixup_fn.mixup_enabled = False
|
| 834 |
+
|
| 835 |
+
second_order = hasattr(optimizer, 'is_second_order') and optimizer.is_second_order
|
| 836 |
+
batch_time_m = utils.AverageMeter()
|
| 837 |
+
data_time_m = utils.AverageMeter()
|
| 838 |
+
losses_m = utils.AverageMeter()
|
| 839 |
+
|
| 840 |
+
model.train()
|
| 841 |
+
optimizer.zero_grad()
|
| 842 |
+
|
| 843 |
+
end = time.time()
|
| 844 |
+
last_idx = len(loader) - 1
|
| 845 |
+
num_updates = epoch * len(loader)
|
| 846 |
+
for batch_idx, (input, target) in enumerate(loader):
|
| 847 |
+
step = batch_idx // grad_accum_steps
|
| 848 |
+
if step >= num_training_steps_per_epoch:
|
| 849 |
+
continue
|
| 850 |
+
# last_batch = batch_idx == last_idx
|
| 851 |
+
last_batch = ((batch_idx + 1) // grad_accum_steps) == num_training_steps_per_epoch
|
| 852 |
+
data_time_m.update(time.time() - end)
|
| 853 |
+
if not args.prefetcher:
|
| 854 |
+
input, target = input.cuda(), target.cuda()
|
| 855 |
+
if mixup_fn is not None:
|
| 856 |
+
input, target = mixup_fn(input, target)
|
| 857 |
+
if args.channels_last:
|
| 858 |
+
input = input.contiguous(memory_format=torch.channels_last)
|
| 859 |
+
|
| 860 |
+
with amp_autocast():
|
| 861 |
+
import pdb
|
| 862 |
+
# pdb.set_trace()
|
| 863 |
+
output = model(input)
|
| 864 |
+
loss = loss_fn(input, output, target)
|
| 865 |
+
|
| 866 |
+
if not args.distributed:
|
| 867 |
+
losses_m.update(loss.item(), input.size(0))
|
| 868 |
+
|
| 869 |
+
|
| 870 |
+
update_grad = (batch_idx + 1) % grad_accum_steps == 0
|
| 871 |
+
loss_update = loss / grad_accum_steps
|
| 872 |
+
if loss_scaler is not None:
|
| 873 |
+
loss_scaler(
|
| 874 |
+
loss_update, optimizer,
|
| 875 |
+
clip_grad=args.clip_grad, clip_mode=args.clip_mode,
|
| 876 |
+
parameters=model_parameters(model, exclude_head='agc' in args.clip_mode),
|
| 877 |
+
create_graph=second_order, update_grad=update_grad)
|
| 878 |
+
else:
|
| 879 |
+
loss_update.backward(create_graph=second_order)
|
| 880 |
+
if update_grad:
|
| 881 |
+
if args.clip_grad is not None:
|
| 882 |
+
utils.dispatch_clip_grad(
|
| 883 |
+
model_parameters(model, exclude_head='agc' in args.clip_mode),
|
| 884 |
+
value=args.clip_grad, mode=args.clip_mode)
|
| 885 |
+
optimizer.step()
|
| 886 |
+
|
| 887 |
+
if update_grad:
|
| 888 |
+
optimizer.zero_grad()
|
| 889 |
+
if model_ema is not None:
|
| 890 |
+
model_ema.update(model)
|
| 891 |
+
|
| 892 |
+
torch.cuda.synchronize()
|
| 893 |
+
num_updates += 1
|
| 894 |
+
batch_time_m.update(time.time() - end)
|
| 895 |
+
if last_batch or batch_idx % args.log_interval == 0:
|
| 896 |
+
lrl = [param_group['lr'] for param_group in optimizer.param_groups]
|
| 897 |
+
lr = sum(lrl) / len(lrl)
|
| 898 |
+
|
| 899 |
+
if args.distributed:
|
| 900 |
+
reduced_loss = utils.reduce_tensor(loss.data, args.world_size)
|
| 901 |
+
losses_m.update(reduced_loss.item(), input.size(0))
|
| 902 |
+
|
| 903 |
+
if args.local_rank == 0:
|
| 904 |
+
_logger.info(
|
| 905 |
+
'Train: {} [{:>4d}/{} ({:>3.0f}%)] '
|
| 906 |
+
'Loss: {loss.val:#.4g} ({loss.avg:#.3g}) '
|
| 907 |
+
'Time: {batch_time.val:.3f}s, {rate:>7.2f}/s '
|
| 908 |
+
'({batch_time.avg:.3f}s, {rate_avg:>7.2f}/s) '
|
| 909 |
+
'LR: {lr:.3e} '
|
| 910 |
+
'Data: {data_time.val:.3f} ({data_time.avg:.3f})'.format(
|
| 911 |
+
epoch,
|
| 912 |
+
batch_idx, len(loader),
|
| 913 |
+
100. * batch_idx / last_idx,
|
| 914 |
+
loss=losses_m,
|
| 915 |
+
batch_time=batch_time_m,
|
| 916 |
+
rate=input.size(0) * args.world_size / batch_time_m.val,
|
| 917 |
+
rate_avg=input.size(0) * args.world_size / batch_time_m.avg,
|
| 918 |
+
lr=lr,
|
| 919 |
+
data_time=data_time_m))
|
| 920 |
+
|
| 921 |
+
if args.save_images and output_dir:
|
| 922 |
+
torchvision.utils.save_image(
|
| 923 |
+
input,
|
| 924 |
+
os.path.join(output_dir, 'train-batch-%d.jpg' % batch_idx),
|
| 925 |
+
padding=0,
|
| 926 |
+
normalize=True)
|
| 927 |
+
|
| 928 |
+
if saver is not None and args.recovery_interval and (
|
| 929 |
+
last_batch or (batch_idx + 1) % args.recovery_interval == 0):
|
| 930 |
+
saver.save_recovery(epoch, batch_idx=batch_idx)
|
| 931 |
+
|
| 932 |
+
if lr_scheduler is not None:
|
| 933 |
+
lr_scheduler.step_update(num_updates=num_updates, metric=losses_m.avg)
|
| 934 |
+
|
| 935 |
+
end = time.time()
|
| 936 |
+
# end for
|
| 937 |
+
|
| 938 |
+
if hasattr(optimizer, 'sync_lookahead'):
|
| 939 |
+
optimizer.sync_lookahead()
|
| 940 |
+
|
| 941 |
+
return OrderedDict([('loss', losses_m.avg)])
|
| 942 |
+
|
| 943 |
+
|
| 944 |
+
def validate(model, loader, loss_fn, args, amp_autocast=suppress, log_suffix=''):
|
| 945 |
+
batch_time_m = utils.AverageMeter()
|
| 946 |
+
losses_m = utils.AverageMeter()
|
| 947 |
+
top1_m = utils.AverageMeter()
|
| 948 |
+
top5_m = utils.AverageMeter()
|
| 949 |
+
|
| 950 |
+
model.eval()
|
| 951 |
+
|
| 952 |
+
end = time.time()
|
| 953 |
+
last_idx = len(loader) - 1
|
| 954 |
+
with torch.no_grad():
|
| 955 |
+
for batch_idx, (input, target) in enumerate(loader):
|
| 956 |
+
last_batch = batch_idx == last_idx
|
| 957 |
+
if not args.prefetcher:
|
| 958 |
+
input = input.cuda()
|
| 959 |
+
target = target.cuda()
|
| 960 |
+
if args.channels_last:
|
| 961 |
+
input = input.contiguous(memory_format=torch.channels_last)
|
| 962 |
+
|
| 963 |
+
with amp_autocast():
|
| 964 |
+
output = model(input)
|
| 965 |
+
if isinstance(output, (tuple, list)):
|
| 966 |
+
output = output[0]
|
| 967 |
+
|
| 968 |
+
# augmentation reduction
|
| 969 |
+
reduce_factor = args.tta
|
| 970 |
+
if reduce_factor > 1:
|
| 971 |
+
output = output.unfold(0, reduce_factor, reduce_factor).mean(dim=2)
|
| 972 |
+
target = target[0:target.size(0):reduce_factor]
|
| 973 |
+
|
| 974 |
+
loss = loss_fn(output, target)
|
| 975 |
+
acc1, acc5 = utils.accuracy(output, target, topk=(1, 5))
|
| 976 |
+
|
| 977 |
+
if args.distributed:
|
| 978 |
+
reduced_loss = utils.reduce_tensor(loss.data, args.world_size)
|
| 979 |
+
acc1 = utils.reduce_tensor(acc1, args.world_size)
|
| 980 |
+
acc5 = utils.reduce_tensor(acc5, args.world_size)
|
| 981 |
+
else:
|
| 982 |
+
reduced_loss = loss.data
|
| 983 |
+
|
| 984 |
+
torch.cuda.synchronize()
|
| 985 |
+
|
| 986 |
+
losses_m.update(reduced_loss.item(), input.size(0))
|
| 987 |
+
top1_m.update(acc1.item(), output.size(0))
|
| 988 |
+
top5_m.update(acc5.item(), output.size(0))
|
| 989 |
+
|
| 990 |
+
batch_time_m.update(time.time() - end)
|
| 991 |
+
end = time.time()
|
| 992 |
+
if args.local_rank == 0 and (last_batch or batch_idx % args.log_interval == 0):
|
| 993 |
+
log_name = 'Test' + log_suffix
|
| 994 |
+
_logger.info(
|
| 995 |
+
'{0}: [{1:>4d}/{2}] '
|
| 996 |
+
'Time: {batch_time.val:.3f} ({batch_time.avg:.3f}) '
|
| 997 |
+
'Loss: {loss.val:>7.4f} ({loss.avg:>6.4f}) '
|
| 998 |
+
'Acc@1: {top1.val:>7.4f} ({top1.avg:>7.4f}) '
|
| 999 |
+
'Acc@5: {top5.val:>7.4f} ({top5.avg:>7.4f})'.format(
|
| 1000 |
+
log_name, batch_idx, last_idx, batch_time=batch_time_m,
|
| 1001 |
+
loss=losses_m, top1=top1_m, top5=top5_m))
|
| 1002 |
+
|
| 1003 |
+
metrics = OrderedDict([('loss', losses_m.avg), ('top1', top1_m.avg), ('top5', top5_m.avg)])
|
| 1004 |
+
|
| 1005 |
+
return metrics
|
| 1006 |
+
|
| 1007 |
+
|
| 1008 |
+
def load_npy_weights_directly(model: nn.Module, numpy_filepath: str):
|
| 1009 |
+
"""
|
| 1010 |
+
加载 NumPy 格式的权重,并将其加载到 PyTorch 模型实例中。
|
| 1011 |
+
|
| 1012 |
+
参数:
|
| 1013 |
+
model (nn.Module): 已经实例化好的 PyTorch 模型,权重将直接加载到此实例中。
|
| 1014 |
+
numpy_filepath (str): NumPy 权重文件的路径 (.npy 或 .npz)。
|
| 1015 |
+
|
| 1016 |
+
返回:
|
| 1017 |
+
bool: 如果加载成功返回 True,否则返回 False。
|
| 1018 |
+
"""
|
| 1019 |
+
print(f"--- 开始从 NumPy 文件加载权重到模型实例: {numpy_filepath} ---")
|
| 1020 |
+
|
| 1021 |
+
# --- 1. 加载 NumPy 权重 ---
|
| 1022 |
+
weights_dict = {}
|
| 1023 |
+
if numpy_filepath.endswith('.npz'):
|
| 1024 |
+
numpy_weights = np.load(numpy_filepath)
|
| 1025 |
+
weights_dict = {key: torch.from_numpy(numpy_weights[key]) for key in numpy_weights}
|
| 1026 |
+
elif numpy_filepath.endswith('.npy'):
|
| 1027 |
+
try:
|
| 1028 |
+
raw_data = np.load(numpy_filepath, allow_pickle=True)
|
| 1029 |
+
if raw_data.ndim == 0 and isinstance(raw_data.item(), dict):
|
| 1030 |
+
weights_dict = {k: torch.from_numpy(v) for k, v in raw_data.item().items()}
|
| 1031 |
+
else:
|
| 1032 |
+
raise ValueError("单个 .npy 文件必须包含一个字典。")
|
| 1033 |
+
except Exception as e:
|
| 1034 |
+
print(f"错误: 无法解析单个 .npy 文件为字典。{e}")
|
| 1035 |
+
return False
|
| 1036 |
+
else:
|
| 1037 |
+
print("错误: 不支持的文件格式。请使用 .npy 或 .npz。")
|
| 1038 |
+
return False
|
| 1039 |
+
|
| 1040 |
+
# --- 2. 映射和构建新的 state_dict ---
|
| 1041 |
+
pytorch_state_dict = model.state_dict()
|
| 1042 |
+
new_state_dict = {}
|
| 1043 |
+
loaded_params_count = 0
|
| 1044 |
+
|
| 1045 |
+
for np_key, np_tensor in weights_dict.items():
|
| 1046 |
+
# --- 键名对齐逻辑 ---
|
| 1047 |
+
pt_key = np_key
|
| 1048 |
+
|
| 1049 |
+
# 1. 修复 stages.x.y.f1/g.conv.* -> stages.x.y.f1/g.layer.* 的差异
|
| 1050 |
+
if '.f1.conv.' in pt_key:
|
| 1051 |
+
pt_key = pt_key.replace('.f1.conv.', '.f1.layer.')
|
| 1052 |
+
if '.g.conv.' in pt_key:
|
| 1053 |
+
pt_key = pt_key.replace('.g.conv.', '.g.layer.')
|
| 1054 |
+
|
| 1055 |
+
# 2. 修复 stages.x.y.f1/g.bn.* 键(在 PyTorch state_dict 中不存在)
|
| 1056 |
+
# 如果模型定义中 f1/g 没有 BN 层,则必须跳过这些键。
|
| 1057 |
+
if '.f1.bn.' in np_key or '.g.bn.' in np_key:
|
| 1058 |
+
print(f" [跳过] 键 '{np_key}' (可能因 f1/g 没有 BN 层而多余)。")
|
| 1059 |
+
continue
|
| 1060 |
+
|
| 1061 |
+
# 3. 修复 stages.x.y.gamma 键(如果有)
|
| 1062 |
+
# 暂时不需要额外操作。
|
| 1063 |
+
|
| 1064 |
+
# --- 形状处理和赋值 ---
|
| 1065 |
+
mapped_tensor = np_tensor.clone().float() # 确保是浮点数且独立
|
| 1066 |
+
|
| 1067 |
+
|
| 1068 |
+
if pt_key in pytorch_state_dict:
|
| 1069 |
+
target_shape = pytorch_state_dict[pt_key].shape
|
| 1070 |
+
|
| 1071 |
+
# --- !!!关键形状检查和转置逻辑 !!! ---
|
| 1072 |
+
if mapped_tensor.shape != target_shape:
|
| 1073 |
+
|
| 1074 |
+
# [新增逻辑] 检查是否为 Pointwise Conv (4D) 到 Linear (2D) 的转换
|
| 1075 |
+
if mapped_tensor.dim() == 4 and mapped_tensor.size()[-2:] == torch.Size([1, 1]):
|
| 1076 |
+
# 尝试 Squeeze 移除最后的 1x1 维度
|
| 1077 |
+
temp_tensor = mapped_tensor.squeeze()
|
| 1078 |
+
if temp_tensor.shape == target_shape:
|
| 1079 |
+
print(f" [Squeeze] 键 '{pt_key}' 形状不匹配 ({mapped_tensor.size()} vs {target_shape}),已执行 Squeeze (4D -> 2D)。")
|
| 1080 |
+
mapped_tensor = temp_tensor
|
| 1081 |
+
|
| 1082 |
+
# 尝试对 Linear Layer/FC Head 进行转置 (最常见的需求)
|
| 1083 |
+
if mapped_tensor.dim() == 2 and mapped_tensor.T.shape == target_shape:
|
| 1084 |
+
print(f" [转置] 键 '{pt_key}' 形状不匹配 ({mapped_tensor.size()} vs {target_shape}),已尝试转置。")
|
| 1085 |
+
mapped_tensor = mapped_tensor.T
|
| 1086 |
+
|
| 1087 |
+
# 尝试对 Conv Layer 进行 permute (如果 NumPy 格式是 [H, W, in_C, out_C])
|
| 1088 |
+
# 只有当 NumPy 存储的 Conv 格式不是 PyTorch 默认的 [out_C, in_C, H, W] 时才需要
|
| 1089 |
+
elif mapped_tensor.dim() == 4 and mapped_tensor.permute(3, 2, 0, 1).shape == target_shape:
|
| 1090 |
+
print(f" [Permute] 键 '{pt_key}' 形状不匹配 ({mapped_tensor.size()} vs {target_shape}),已尝试 permute (3, 2, 0, 1)。")
|
| 1091 |
+
mapped_tensor = mapped_tensor.permute(3, 2, 0, 1)
|
| 1092 |
+
|
| 1093 |
+
# 最终检查形状是否匹配
|
| 1094 |
+
if mapped_tensor.shape == target_shape:
|
| 1095 |
+
new_state_dict[pt_key] = mapped_tensor
|
| 1096 |
+
loaded_params_count += 1
|
| 1097 |
+
else:
|
| 1098 |
+
print(f"警告: 形状依然不匹配。PyTorch: {target_shape}, NumPy: {mapped_tensor.size()}. 键: {pt_key}")
|
| 1099 |
+
else:
|
| 1100 |
+
# 这里的警告会捕获那些 NumPy 中有,但 PyTorch 模型中没有的键
|
| 1101 |
+
print(f"警告: NumPy 键 '{np_key}' (映射后为 '{pt_key}') 未在 PyTorch 模型中找到对应项,已跳过。")
|
| 1102 |
+
|
| 1103 |
+
|
| 1104 |
+
# --- 3. 直接加载到模型中 ---
|
| 1105 |
+
if loaded_params_count > 0:
|
| 1106 |
+
# 使用 strict=False 忽略那些 PyTorch 模型中存在但 NumPy 文件中缺失的键
|
| 1107 |
+
model.load_state_dict(new_state_dict, strict=False)
|
| 1108 |
+
|
| 1109 |
+
print(f"\n✅ 加载成功!已加载 {loaded_params_count} 个参数到模型实例。")
|
| 1110 |
+
return True
|
| 1111 |
+
else:
|
| 1112 |
+
print("\n❌ 加载失败:未能加载任何参数。请检查您的 NumPy 文件键名是否正确。")
|
| 1113 |
+
return False
|
| 1114 |
+
|
| 1115 |
+
|
| 1116 |
+
class CheckpointSaver:
|
| 1117 |
+
def __init__(
|
| 1118 |
+
self,
|
| 1119 |
+
model,
|
| 1120 |
+
optimizer,
|
| 1121 |
+
args=None,
|
| 1122 |
+
model_ema=None,
|
| 1123 |
+
amp_scaler=None,
|
| 1124 |
+
checkpoint_prefix='checkpoint',
|
| 1125 |
+
recovery_prefix='recovery',
|
| 1126 |
+
checkpoint_dir='',
|
| 1127 |
+
recovery_dir='',
|
| 1128 |
+
decreasing=False,
|
| 1129 |
+
max_history=10,
|
| 1130 |
+
unwrap_fn=utils.model.unwrap_model):
|
| 1131 |
+
|
| 1132 |
+
# objects to save state_dicts of
|
| 1133 |
+
self.model = model
|
| 1134 |
+
self.optimizer = optimizer
|
| 1135 |
+
self.args = args
|
| 1136 |
+
self.model_ema = model_ema
|
| 1137 |
+
self.amp_scaler = amp_scaler
|
| 1138 |
+
|
| 1139 |
+
# state
|
| 1140 |
+
self.checkpoint_files = [] # (filename, metric) tuples in order of decreasing betterness
|
| 1141 |
+
self.best_epoch = None
|
| 1142 |
+
self.best_metric = None
|
| 1143 |
+
self.curr_recovery_file = ''
|
| 1144 |
+
self.last_recovery_file = ''
|
| 1145 |
+
|
| 1146 |
+
# config
|
| 1147 |
+
self.checkpoint_dir = checkpoint_dir
|
| 1148 |
+
self.recovery_dir = recovery_dir
|
| 1149 |
+
self.save_prefix = checkpoint_prefix
|
| 1150 |
+
self.recovery_prefix = recovery_prefix
|
| 1151 |
+
self.extension = '.pth.tar'
|
| 1152 |
+
self.decreasing = decreasing # a lower metric is better if True
|
| 1153 |
+
self.cmp = operator.lt if decreasing else operator.gt # True if lhs better than rhs
|
| 1154 |
+
self.max_history = max_history
|
| 1155 |
+
self.unwrap_fn = unwrap_fn
|
| 1156 |
+
assert self.max_history >= 1
|
| 1157 |
+
|
| 1158 |
+
def my_save_checkpoint(self, epoch, metric=None):
|
| 1159 |
+
assert epoch >= 0
|
| 1160 |
+
tmp_save_path = os.path.join(self.checkpoint_dir, 'tmp' + self.extension)
|
| 1161 |
+
last_save_path = os.path.join(self.checkpoint_dir, 'last' + self.extension)
|
| 1162 |
+
self._save(tmp_save_path, epoch, metric)
|
| 1163 |
+
# if os.path.exists(last_save_path):
|
| 1164 |
+
# os.unlink(last_save_path) # required for Windows support.
|
| 1165 |
+
os.rename(tmp_save_path, last_save_path)
|
| 1166 |
+
worst_file = self.checkpoint_files[-1] if self.checkpoint_files else None
|
| 1167 |
+
if (len(self.checkpoint_files) < self.max_history
|
| 1168 |
+
or metric is None or self.cmp(metric, worst_file[1])):
|
| 1169 |
+
if len(self.checkpoint_files) >= self.max_history:
|
| 1170 |
+
self._cleanup_checkpoints(1)
|
| 1171 |
+
filename = '-'.join([self.save_prefix, str(epoch)]) + self.extension
|
| 1172 |
+
save_path = os.path.join(self.checkpoint_dir, filename)
|
| 1173 |
+
shutil.copy2(last_save_path, save_path)
|
| 1174 |
+
self.checkpoint_files.append((save_path, metric))
|
| 1175 |
+
self.checkpoint_files = sorted(
|
| 1176 |
+
self.checkpoint_files, key=lambda x: x[1],
|
| 1177 |
+
reverse=not self.decreasing) # sort in descending order if a lower metric is not better
|
| 1178 |
+
|
| 1179 |
+
checkpoints_str = "Current checkpoints:\n"
|
| 1180 |
+
for c in self.checkpoint_files:
|
| 1181 |
+
checkpoints_str += ' {}\n'.format(c)
|
| 1182 |
+
_logger.info(checkpoints_str)
|
| 1183 |
+
|
| 1184 |
+
if metric is not None and (self.best_metric is None or self.cmp(metric, self.best_metric)):
|
| 1185 |
+
self.best_epoch = epoch
|
| 1186 |
+
self.best_metric = metric
|
| 1187 |
+
best_save_path = os.path.join(self.checkpoint_dir, 'model_best' + self.extension)
|
| 1188 |
+
# if os.path.exists(best_save_path):
|
| 1189 |
+
# os.unlink(best_save_path)
|
| 1190 |
+
shutil.copy2(last_save_path, best_save_path)
|
| 1191 |
+
|
| 1192 |
+
return (None, None) if self.best_metric is None else (self.best_metric, self.best_epoch)
|
| 1193 |
+
|
| 1194 |
+
def save_checkpoint(self, epoch, metric=None):
|
| 1195 |
+
assert epoch >= 0
|
| 1196 |
+
tmp_save_path = os.path.join(self.checkpoint_dir, 'tmp' + self.extension)
|
| 1197 |
+
last_save_path = os.path.join(self.checkpoint_dir, 'last' + self.extension)
|
| 1198 |
+
self._save(tmp_save_path, epoch, metric)
|
| 1199 |
+
if os.path.exists(last_save_path):
|
| 1200 |
+
os.unlink(last_save_path) # required for Windows support.
|
| 1201 |
+
os.rename(tmp_save_path, last_save_path)
|
| 1202 |
+
worst_file = self.checkpoint_files[-1] if self.checkpoint_files else None
|
| 1203 |
+
if (len(self.checkpoint_files) < self.max_history
|
| 1204 |
+
or metric is None or self.cmp(metric, worst_file[1])):
|
| 1205 |
+
if len(self.checkpoint_files) >= self.max_history:
|
| 1206 |
+
self._cleanup_checkpoints(1)
|
| 1207 |
+
filename = '-'.join([self.save_prefix, str(epoch)]) + self.extension
|
| 1208 |
+
save_path = os.path.join(self.checkpoint_dir, filename)
|
| 1209 |
+
os.link(last_save_path, save_path)
|
| 1210 |
+
self.checkpoint_files.append((save_path, metric))
|
| 1211 |
+
self.checkpoint_files = sorted(
|
| 1212 |
+
self.checkpoint_files, key=lambda x: x[1],
|
| 1213 |
+
reverse=not self.decreasing) # sort in descending order if a lower metric is not better
|
| 1214 |
+
|
| 1215 |
+
checkpoints_str = "Current checkpoints:\n"
|
| 1216 |
+
for c in self.checkpoint_files:
|
| 1217 |
+
checkpoints_str += ' {}\n'.format(c)
|
| 1218 |
+
_logger.info(checkpoints_str)
|
| 1219 |
+
|
| 1220 |
+
if metric is not None and (self.best_metric is None or self.cmp(metric, self.best_metric)):
|
| 1221 |
+
self.best_epoch = epoch
|
| 1222 |
+
self.best_metric = metric
|
| 1223 |
+
best_save_path = os.path.join(self.checkpoint_dir, 'model_best' + self.extension)
|
| 1224 |
+
if os.path.exists(best_save_path):
|
| 1225 |
+
os.unlink(best_save_path)
|
| 1226 |
+
os.link(last_save_path, best_save_path)
|
| 1227 |
+
|
| 1228 |
+
return (None, None) if self.best_metric is None else (self.best_metric, self.best_epoch)
|
| 1229 |
+
|
| 1230 |
+
def _save(self, save_path, epoch, metric=None):
|
| 1231 |
+
save_state = {
|
| 1232 |
+
'epoch': epoch,
|
| 1233 |
+
'arch': type(self.model).__name__.lower(),
|
| 1234 |
+
'state_dict': utils.model.get_state_dict(self.model, self.unwrap_fn),
|
| 1235 |
+
'optimizer': self.optimizer.state_dict(),
|
| 1236 |
+
'version': 2, # version < 2 increments epoch before save
|
| 1237 |
+
}
|
| 1238 |
+
if self.args is not None:
|
| 1239 |
+
save_state['arch'] = self.args.model
|
| 1240 |
+
save_state['args'] = self.args
|
| 1241 |
+
if self.amp_scaler is not None:
|
| 1242 |
+
save_state[self.amp_scaler.state_dict_key] = self.amp_scaler.state_dict()
|
| 1243 |
+
if self.model_ema is not None:
|
| 1244 |
+
save_state['state_dict_ema'] = utils.model.get_state_dict(self.model_ema, self.unwrap_fn)
|
| 1245 |
+
if metric is not None:
|
| 1246 |
+
save_state['metric'] = metric
|
| 1247 |
+
torch.save(save_state, save_path)
|
| 1248 |
+
|
| 1249 |
+
def _cleanup_checkpoints(self, trim=0):
|
| 1250 |
+
trim = min(len(self.checkpoint_files), trim)
|
| 1251 |
+
delete_index = self.max_history - trim
|
| 1252 |
+
if delete_index < 0 or len(self.checkpoint_files) <= delete_index:
|
| 1253 |
+
return
|
| 1254 |
+
to_delete = self.checkpoint_files[delete_index:]
|
| 1255 |
+
for d in to_delete:
|
| 1256 |
+
try:
|
| 1257 |
+
_logger.debug("Cleaning checkpoint: {}".format(d))
|
| 1258 |
+
os.remove(d[0])
|
| 1259 |
+
except Exception as e:
|
| 1260 |
+
_logger.error("Exception '{}' while deleting checkpoint".format(e))
|
| 1261 |
+
self.checkpoint_files = self.checkpoint_files[:delete_index]
|
| 1262 |
+
|
| 1263 |
+
def save_recovery(self, epoch, batch_idx=0):
|
| 1264 |
+
assert epoch >= 0
|
| 1265 |
+
filename = '-'.join([self.recovery_prefix, str(epoch), str(batch_idx)]) + self.extension
|
| 1266 |
+
save_path = os.path.join(self.recovery_dir, filename)
|
| 1267 |
+
self._save(save_path, epoch)
|
| 1268 |
+
if os.path.exists(self.last_recovery_file):
|
| 1269 |
+
try:
|
| 1270 |
+
_logger.debug("Cleaning recovery: {}".format(self.last_recovery_file))
|
| 1271 |
+
os.remove(self.last_recovery_file)
|
| 1272 |
+
except Exception as e:
|
| 1273 |
+
_logger.error("Exception '{}' while removing {}".format(e, self.last_recovery_file))
|
| 1274 |
+
self.last_recovery_file = self.curr_recovery_file
|
| 1275 |
+
self.curr_recovery_file = save_path
|
| 1276 |
+
|
| 1277 |
+
def find_recovery(self):
|
| 1278 |
+
recovery_path = os.path.join(self.recovery_dir, self.recovery_prefix)
|
| 1279 |
+
files = glob.glob(recovery_path + '*' + self.extension)
|
| 1280 |
+
files = sorted(files)
|
| 1281 |
+
return files[0] if len(files) else ''
|
| 1282 |
+
|
| 1283 |
+
|
| 1284 |
+
|
| 1285 |
+
if __name__ == '__main__':
|
| 1286 |
+
main()
|
gmnet/project/gmnet_tpami/reference/source/00README.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"sources" : [
|
| 3 |
+
{
|
| 4 |
+
"usage" : "toplevel",
|
| 5 |
+
"filename" : "iclr2026_conference.tex"
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"usage" : "ignore",
|
| 9 |
+
"filename" : "iclr2026_conference.bib"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"usage" : "ignore",
|
| 13 |
+
"filename" : "iclr2026_conference.bst"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"usage" : "ignore",
|
| 17 |
+
"filename" : "main.bib"
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"spec_version" : 1,
|
| 21 |
+
"texlive_version" : "2025",
|
| 22 |
+
"process" : {
|
| 23 |
+
"compiler" : "pdflatex"
|
| 24 |
+
}
|
| 25 |
+
}
|
gmnet/project/gmnet_tpami/reference/source/fancyhdr.sty
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% fancyhdr.sty version 3.2
|
| 2 |
+
% Fancy headers and footers for LaTeX.
|
| 3 |
+
% Piet van Oostrum,
|
| 4 |
+
% Dept of Computer and Information Sciences, University of Utrecht,
|
| 5 |
+
% Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
|
| 6 |
+
% Telephone: +31 30 2532180. Email: piet@cs.uu.nl
|
| 7 |
+
% ========================================================================
|
| 8 |
+
% LICENCE:
|
| 9 |
+
% This file may be distributed under the terms of the LaTeX Project Public
|
| 10 |
+
% License, as described in lppl.txt in the base LaTeX distribution.
|
| 11 |
+
% Either version 1 or, at your option, any later version.
|
| 12 |
+
% ========================================================================
|
| 13 |
+
% MODIFICATION HISTORY:
|
| 14 |
+
% Sep 16, 1994
|
| 15 |
+
% version 1.4: Correction for use with \reversemargin
|
| 16 |
+
% Sep 29, 1994:
|
| 17 |
+
% version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands
|
| 18 |
+
% Oct 4, 1994:
|
| 19 |
+
% version 1.6: Reset single spacing in headers/footers for use with
|
| 20 |
+
% setspace.sty or doublespace.sty
|
| 21 |
+
% Oct 4, 1994:
|
| 22 |
+
% version 1.7: changed \let\@mkboth\markboth to
|
| 23 |
+
% \def\@mkboth{\protect\markboth} to make it more robust
|
| 24 |
+
% Dec 5, 1994:
|
| 25 |
+
% version 1.8: corrections for amsbook/amsart: define \@chapapp and (more
|
| 26 |
+
% importantly) use the \chapter/sectionmark definitions from ps@headings if
|
| 27 |
+
% they exist (which should be true for all standard classes).
|
| 28 |
+
% May 31, 1995:
|
| 29 |
+
% version 1.9: The proposed \renewcommand{\headrulewidth}{\iffloatpage...
|
| 30 |
+
% construction in the doc did not work properly with the fancyplain style.
|
| 31 |
+
% June 1, 1995:
|
| 32 |
+
% version 1.91: The definition of \@mkboth wasn't restored on subsequent
|
| 33 |
+
% \pagestyle{fancy}'s.
|
| 34 |
+
% June 1, 1995:
|
| 35 |
+
% version 1.92: The sequence \pagestyle{fancyplain} \pagestyle{plain}
|
| 36 |
+
% \pagestyle{fancy} would erroneously select the plain version.
|
| 37 |
+
% June 1, 1995:
|
| 38 |
+
% version 1.93: \fancypagestyle command added.
|
| 39 |
+
% Dec 11, 1995:
|
| 40 |
+
% version 1.94: suggested by Conrad Hughes <chughes@maths.tcd.ie>
|
| 41 |
+
% CJCH, Dec 11, 1995: added \footruleskip to allow control over footrule
|
| 42 |
+
% position (old hardcoded value of .3\normalbaselineskip is far too high
|
| 43 |
+
% when used with very small footer fonts).
|
| 44 |
+
% Jan 31, 1996:
|
| 45 |
+
% version 1.95: call \@normalsize in the reset code if that is defined,
|
| 46 |
+
% otherwise \normalsize.
|
| 47 |
+
% this is to solve a problem with ucthesis.cls, as this doesn't
|
| 48 |
+
% define \@currsize. Unfortunately for latex209 calling \normalsize doesn't
|
| 49 |
+
% work as this is optimized to do very little, so there \@normalsize should
|
| 50 |
+
% be called. Hopefully this code works for all versions of LaTeX known to
|
| 51 |
+
% mankind.
|
| 52 |
+
% April 25, 1996:
|
| 53 |
+
% version 1.96: initialize \headwidth to a magic (negative) value to catch
|
| 54 |
+
% most common cases that people change it before calling \pagestyle{fancy}.
|
| 55 |
+
% Note it can't be initialized when reading in this file, because
|
| 56 |
+
% \textwidth could be changed afterwards. This is quite probable.
|
| 57 |
+
% We also switch to \MakeUppercase rather than \uppercase and introduce a
|
| 58 |
+
% \nouppercase command for use in headers. and footers.
|
| 59 |
+
% May 3, 1996:
|
| 60 |
+
% version 1.97: Two changes:
|
| 61 |
+
% 1. Undo the change in version 1.8 (using the pagestyle{headings} defaults
|
| 62 |
+
% for the chapter and section marks. The current version of amsbook and
|
| 63 |
+
% amsart classes don't seem to need them anymore. Moreover the standard
|
| 64 |
+
% latex classes don't use \markboth if twoside isn't selected, and this is
|
| 65 |
+
% confusing as \leftmark doesn't work as expected.
|
| 66 |
+
% 2. include a call to \ps@empty in ps@@fancy. This is to solve a problem
|
| 67 |
+
% in the amsbook and amsart classes, that make global changes to \topskip,
|
| 68 |
+
% which are reset in \ps@empty. Hopefully this doesn't break other things.
|
| 69 |
+
% May 7, 1996:
|
| 70 |
+
% version 1.98:
|
| 71 |
+
% Added % after the line \def\nouppercase
|
| 72 |
+
% May 7, 1996:
|
| 73 |
+
% version 1.99: This is the alpha version of fancyhdr 2.0
|
| 74 |
+
% Introduced the new commands \fancyhead, \fancyfoot, and \fancyhf.
|
| 75 |
+
% Changed \headrulewidth, \footrulewidth, \footruleskip to
|
| 76 |
+
% macros rather than length parameters, In this way they can be
|
| 77 |
+
% conditionalized and they don't consume length registers. There is no need
|
| 78 |
+
% to have them as length registers unless you want to do calculations with
|
| 79 |
+
% them, which is unlikely. Note that this may make some uses of them
|
| 80 |
+
% incompatible (i.e. if you have a file that uses \setlength or \xxxx=)
|
| 81 |
+
% May 10, 1996:
|
| 82 |
+
% version 1.99a:
|
| 83 |
+
% Added a few more % signs
|
| 84 |
+
% May 10, 1996:
|
| 85 |
+
% version 1.99b:
|
| 86 |
+
% Changed the syntax of \f@nfor to be resistent to catcode changes of :=
|
| 87 |
+
% Removed the [1] from the defs of \lhead etc. because the parameter is
|
| 88 |
+
% consumed by the \@[xy]lhead etc. macros.
|
| 89 |
+
% June 24, 1997:
|
| 90 |
+
% version 1.99c:
|
| 91 |
+
% corrected \nouppercase to also include the protected form of \MakeUppercase
|
| 92 |
+
% \global added to manipulation of \headwidth.
|
| 93 |
+
% \iffootnote command added.
|
| 94 |
+
% Some comments added about \@fancyhead and \@fancyfoot.
|
| 95 |
+
% Aug 24, 1998
|
| 96 |
+
% version 1.99d
|
| 97 |
+
% Changed the default \ps@empty to \ps@@empty in order to allow
|
| 98 |
+
% \fancypagestyle{empty} redefinition.
|
| 99 |
+
% Oct 11, 2000
|
| 100 |
+
% version 2.0
|
| 101 |
+
% Added LPPL license clause.
|
| 102 |
+
%
|
| 103 |
+
% A check for \headheight is added. An errormessage is given (once) if the
|
| 104 |
+
% header is too large. Empty headers don't generate the error even if
|
| 105 |
+
% \headheight is very small or even 0pt.
|
| 106 |
+
% Warning added for the use of 'E' option when twoside option is not used.
|
| 107 |
+
% In this case the 'E' fields will never be used.
|
| 108 |
+
%
|
| 109 |
+
% Mar 10, 2002
|
| 110 |
+
% version 2.1beta
|
| 111 |
+
% New command: \fancyhfoffset[place]{length}
|
| 112 |
+
% defines offsets to be applied to the header/footer to let it stick into
|
| 113 |
+
% the margins (if length > 0).
|
| 114 |
+
% place is like in fancyhead, except that only E,O,L,R can be used.
|
| 115 |
+
% This replaces the old calculation based on \headwidth and the marginpar
|
| 116 |
+
% area.
|
| 117 |
+
% \headwidth will be dynamically calculated in the headers/footers when
|
| 118 |
+
% this is used.
|
| 119 |
+
%
|
| 120 |
+
% Mar 26, 2002
|
| 121 |
+
% version 2.1beta2
|
| 122 |
+
% \fancyhfoffset now also takes h,f as possible letters in the argument to
|
| 123 |
+
% allow the header and footer widths to be different.
|
| 124 |
+
% New commands \fancyheadoffset and \fancyfootoffset added comparable to
|
| 125 |
+
% \fancyhead and \fancyfoot.
|
| 126 |
+
% Errormessages and warnings have been made more informative.
|
| 127 |
+
%
|
| 128 |
+
% Dec 9, 2002
|
| 129 |
+
% version 2.1
|
| 130 |
+
% The defaults for \footrulewidth, \plainheadrulewidth and
|
| 131 |
+
% \plainfootrulewidth are changed from \z@skip to 0pt. In this way when
|
| 132 |
+
% someone inadvertantly uses \setlength to change any of these, the value
|
| 133 |
+
% of \z@skip will not be changed, rather an errormessage will be given.
|
| 134 |
+
|
| 135 |
+
% March 3, 2004
|
| 136 |
+
% Release of version 3.0
|
| 137 |
+
|
| 138 |
+
% Oct 7, 2004
|
| 139 |
+
% version 3.1
|
| 140 |
+
% Added '\endlinechar=13' to \fancy@reset to prevent problems with
|
| 141 |
+
% includegraphics in header when verbatiminput is active.
|
| 142 |
+
|
| 143 |
+
% March 22, 2005
|
| 144 |
+
% version 3.2
|
| 145 |
+
% reset \everypar (the real one) in \fancy@reset because spanish.ldf does
|
| 146 |
+
% strange things with \everypar between << and >>.
|
| 147 |
+
|
| 148 |
+
\def\ifancy@mpty#1{\def\temp@a{#1}\ifx\temp@a\@empty}
|
| 149 |
+
|
| 150 |
+
\def\fancy@def#1#2{\ifancy@mpty{#2}\fancy@gbl\def#1{\leavevmode}\else
|
| 151 |
+
\fancy@gbl\def#1{#2\strut}\fi}
|
| 152 |
+
|
| 153 |
+
\let\fancy@gbl\global
|
| 154 |
+
|
| 155 |
+
\def\@fancyerrmsg#1{%
|
| 156 |
+
\ifx\PackageError\undefined
|
| 157 |
+
\errmessage{#1}\else
|
| 158 |
+
\PackageError{Fancyhdr}{#1}{}\fi}
|
| 159 |
+
\def\@fancywarning#1{%
|
| 160 |
+
\ifx\PackageWarning\undefined
|
| 161 |
+
\errmessage{#1}\else
|
| 162 |
+
\PackageWarning{Fancyhdr}{#1}{}\fi}
|
| 163 |
+
|
| 164 |
+
% Usage: \@forc \var{charstring}{command to be executed for each char}
|
| 165 |
+
% This is similar to LaTeX's \@tfor, but expands the charstring.
|
| 166 |
+
|
| 167 |
+
\def\@forc#1#2#3{\expandafter\f@rc\expandafter#1\expandafter{#2}{#3}}
|
| 168 |
+
\def\f@rc#1#2#3{\def\temp@ty{#2}\ifx\@empty\temp@ty\else
|
| 169 |
+
\f@@rc#1#2\f@@rc{#3}\fi}
|
| 170 |
+
\def\f@@rc#1#2#3\f@@rc#4{\def#1{#2}#4\f@rc#1{#3}{#4}}
|
| 171 |
+
|
| 172 |
+
% Usage: \f@nfor\name:=list\do{body}
|
| 173 |
+
% Like LaTeX's \@for but an empty list is treated as a list with an empty
|
| 174 |
+
% element
|
| 175 |
+
|
| 176 |
+
\newcommand{\f@nfor}[3]{\edef\@fortmp{#2}%
|
| 177 |
+
\expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}}
|
| 178 |
+
|
| 179 |
+
% Usage: \def@ult \cs{defaults}{argument}
|
| 180 |
+
% sets \cs to the characters from defaults appearing in argument
|
| 181 |
+
% or defaults if it would be empty. All characters are lowercased.
|
| 182 |
+
|
| 183 |
+
\newcommand\def@ult[3]{%
|
| 184 |
+
\edef\temp@a{\lowercase{\edef\noexpand\temp@a{#3}}}\temp@a
|
| 185 |
+
\def#1{}%
|
| 186 |
+
\@forc\tmpf@ra{#2}%
|
| 187 |
+
{\expandafter\if@in\tmpf@ra\temp@a{\edef#1{#1\tmpf@ra}}{}}%
|
| 188 |
+
\ifx\@empty#1\def#1{#2}\fi}
|
| 189 |
+
%
|
| 190 |
+
% \if@in <char><set><truecase><falsecase>
|
| 191 |
+
%
|
| 192 |
+
\newcommand{\if@in}[4]{%
|
| 193 |
+
\edef\temp@a{#2}\def\temp@b##1#1##2\temp@b{\def\temp@b{##1}}%
|
| 194 |
+
\expandafter\temp@b#2#1\temp@b\ifx\temp@a\temp@b #4\else #3\fi}
|
| 195 |
+
|
| 196 |
+
\newcommand{\fancyhead}{\@ifnextchar[{\f@ncyhf\fancyhead h}%
|
| 197 |
+
{\f@ncyhf\fancyhead h[]}}
|
| 198 |
+
\newcommand{\fancyfoot}{\@ifnextchar[{\f@ncyhf\fancyfoot f}%
|
| 199 |
+
{\f@ncyhf\fancyfoot f[]}}
|
| 200 |
+
\newcommand{\fancyhf}{\@ifnextchar[{\f@ncyhf\fancyhf{}}%
|
| 201 |
+
{\f@ncyhf\fancyhf{}[]}}
|
| 202 |
+
|
| 203 |
+
% New commands for offsets added
|
| 204 |
+
|
| 205 |
+
\newcommand{\fancyheadoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyheadoffset h}%
|
| 206 |
+
{\f@ncyhfoffs\fancyheadoffset h[]}}
|
| 207 |
+
\newcommand{\fancyfootoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyfootoffset f}%
|
| 208 |
+
{\f@ncyhfoffs\fancyfootoffset f[]}}
|
| 209 |
+
\newcommand{\fancyhfoffset}{\@ifnextchar[{\f@ncyhfoffs\fancyhfoffset{}}%
|
| 210 |
+
{\f@ncyhfoffs\fancyhfoffset{}[]}}
|
| 211 |
+
|
| 212 |
+
% The header and footer fields are stored in command sequences with
|
| 213 |
+
% names of the form: \f@ncy<x><y><z> with <x> for [eo], <y> from [lcr]
|
| 214 |
+
% and <z> from [hf].
|
| 215 |
+
|
| 216 |
+
\def\f@ncyhf#1#2[#3]#4{%
|
| 217 |
+
\def\temp@c{}%
|
| 218 |
+
\@forc\tmpf@ra{#3}%
|
| 219 |
+
{\expandafter\if@in\tmpf@ra{eolcrhf,EOLCRHF}%
|
| 220 |
+
{}{\edef\temp@c{\temp@c\tmpf@ra}}}%
|
| 221 |
+
\ifx\@empty\temp@c\else
|
| 222 |
+
\@fancyerrmsg{Illegal char `\temp@c' in \string#1 argument:
|
| 223 |
+
[#3]}%
|
| 224 |
+
\fi
|
| 225 |
+
\f@nfor\temp@c{#3}%
|
| 226 |
+
{\def@ult\f@@@eo{eo}\temp@c
|
| 227 |
+
\if@twoside\else
|
| 228 |
+
\if\f@@@eo e\@fancywarning
|
| 229 |
+
{\string#1's `E' option without twoside option is useless}\fi\fi
|
| 230 |
+
\def@ult\f@@@lcr{lcr}\temp@c
|
| 231 |
+
\def@ult\f@@@hf{hf}{#2\temp@c}%
|
| 232 |
+
\@forc\f@@eo\f@@@eo
|
| 233 |
+
{\@forc\f@@lcr\f@@@lcr
|
| 234 |
+
{\@forc\f@@hf\f@@@hf
|
| 235 |
+
{\expandafter\fancy@def\csname
|
| 236 |
+
f@ncy\f@@eo\f@@lcr\f@@hf\endcsname
|
| 237 |
+
{#4}}}}}}
|
| 238 |
+
|
| 239 |
+
\def\f@ncyhfoffs#1#2[#3]#4{%
|
| 240 |
+
\def\temp@c{}%
|
| 241 |
+
\@forc\tmpf@ra{#3}%
|
| 242 |
+
{\expandafter\if@in\tmpf@ra{eolrhf,EOLRHF}%
|
| 243 |
+
{}{\edef\temp@c{\temp@c\tmpf@ra}}}%
|
| 244 |
+
\ifx\@empty\temp@c\else
|
| 245 |
+
\@fancyerrmsg{Illegal char `\temp@c' in \string#1 argument:
|
| 246 |
+
[#3]}%
|
| 247 |
+
\fi
|
| 248 |
+
\f@nfor\temp@c{#3}%
|
| 249 |
+
{\def@ult\f@@@eo{eo}\temp@c
|
| 250 |
+
\if@twoside\else
|
| 251 |
+
\if\f@@@eo e\@fancywarning
|
| 252 |
+
{\string#1's `E' option without twoside option is useless}\fi\fi
|
| 253 |
+
\def@ult\f@@@lcr{lr}\temp@c
|
| 254 |
+
\def@ult\f@@@hf{hf}{#2\temp@c}%
|
| 255 |
+
\@forc\f@@eo\f@@@eo
|
| 256 |
+
{\@forc\f@@lcr\f@@@lcr
|
| 257 |
+
{\@forc\f@@hf\f@@@hf
|
| 258 |
+
{\expandafter\setlength\csname
|
| 259 |
+
f@ncyO@\f@@eo\f@@lcr\f@@hf\endcsname
|
| 260 |
+
{#4}}}}}%
|
| 261 |
+
\fancy@setoffs}
|
| 262 |
+
|
| 263 |
+
% Fancyheadings version 1 commands. These are more or less deprecated,
|
| 264 |
+
% but they continue to work.
|
| 265 |
+
|
| 266 |
+
\newcommand{\lhead}{\@ifnextchar[{\@xlhead}{\@ylhead}}
|
| 267 |
+
\def\@xlhead[#1]#2{\fancy@def\f@ncyelh{#1}\fancy@def\f@ncyolh{#2}}
|
| 268 |
+
\def\@ylhead#1{\fancy@def\f@ncyelh{#1}\fancy@def\f@ncyolh{#1}}
|
| 269 |
+
|
| 270 |
+
\newcommand{\chead}{\@ifnextchar[{\@xchead}{\@ychead}}
|
| 271 |
+
\def\@xchead[#1]#2{\fancy@def\f@ncyech{#1}\fancy@def\f@ncyoch{#2}}
|
| 272 |
+
\def\@ychead#1{\fancy@def\f@ncyech{#1}\fancy@def\f@ncyoch{#1}}
|
| 273 |
+
|
| 274 |
+
\newcommand{\rhead}{\@ifnextchar[{\@xrhead}{\@yrhead}}
|
| 275 |
+
\def\@xrhead[#1]#2{\fancy@def\f@ncyerh{#1}\fancy@def\f@ncyorh{#2}}
|
| 276 |
+
\def\@yrhead#1{\fancy@def\f@ncyerh{#1}\fancy@def\f@ncyorh{#1}}
|
| 277 |
+
|
| 278 |
+
\newcommand{\lfoot}{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
|
| 279 |
+
\def\@xlfoot[#1]#2{\fancy@def\f@ncyelf{#1}\fancy@def\f@ncyolf{#2}}
|
| 280 |
+
\def\@ylfoot#1{\fancy@def\f@ncyelf{#1}\fancy@def\f@ncyolf{#1}}
|
| 281 |
+
|
| 282 |
+
\newcommand{\cfoot}{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
|
| 283 |
+
\def\@xcfoot[#1]#2{\fancy@def\f@ncyecf{#1}\fancy@def\f@ncyocf{#2}}
|
| 284 |
+
\def\@ycfoot#1{\fancy@def\f@ncyecf{#1}\fancy@def\f@ncyocf{#1}}
|
| 285 |
+
|
| 286 |
+
\newcommand{\rfoot}{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
|
| 287 |
+
\def\@xrfoot[#1]#2{\fancy@def\f@ncyerf{#1}\fancy@def\f@ncyorf{#2}}
|
| 288 |
+
\def\@yrfoot#1{\fancy@def\f@ncyerf{#1}\fancy@def\f@ncyorf{#1}}
|
| 289 |
+
|
| 290 |
+
\newlength{\fancy@headwidth}
|
| 291 |
+
\let\headwidth\fancy@headwidth
|
| 292 |
+
\newlength{\f@ncyO@elh}
|
| 293 |
+
\newlength{\f@ncyO@erh}
|
| 294 |
+
\newlength{\f@ncyO@olh}
|
| 295 |
+
\newlength{\f@ncyO@orh}
|
| 296 |
+
\newlength{\f@ncyO@elf}
|
| 297 |
+
\newlength{\f@ncyO@erf}
|
| 298 |
+
\newlength{\f@ncyO@olf}
|
| 299 |
+
\newlength{\f@ncyO@orf}
|
| 300 |
+
\newcommand{\headrulewidth}{0.4pt}
|
| 301 |
+
\newcommand{\footrulewidth}{0pt}
|
| 302 |
+
\newcommand{\footruleskip}{.3\normalbaselineskip}
|
| 303 |
+
|
| 304 |
+
% Fancyplain stuff shouldn't be used anymore (rather
|
| 305 |
+
% \fancypagestyle{plain} should be used), but it must be present for
|
| 306 |
+
% compatibility reasons.
|
| 307 |
+
|
| 308 |
+
\newcommand{\plainheadrulewidth}{0pt}
|
| 309 |
+
\newcommand{\plainfootrulewidth}{0pt}
|
| 310 |
+
\newif\if@fancyplain \@fancyplainfalse
|
| 311 |
+
\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
|
| 312 |
+
|
| 313 |
+
\headwidth=-123456789sp %magic constant
|
| 314 |
+
|
| 315 |
+
% Command to reset various things in the headers:
|
| 316 |
+
% a.o. single spacing (taken from setspace.sty)
|
| 317 |
+
% and the catcode of ^^M (so that epsf files in the header work if a
|
| 318 |
+
% verbatim crosses a page boundary)
|
| 319 |
+
% It also defines a \nouppercase command that disables \uppercase and
|
| 320 |
+
% \Makeuppercase. It can only be used in the headers and footers.
|
| 321 |
+
\let\fnch@everypar\everypar% save real \everypar because of spanish.ldf
|
| 322 |
+
\def\fancy@reset{\fnch@everypar{}\restorecr\endlinechar=13
|
| 323 |
+
\def\baselinestretch{1}%
|
| 324 |
+
\def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax
|
| 325 |
+
\expandafter\let\csname MakeUppercase \endcsname\relax##1}}%
|
| 326 |
+
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
|
| 327 |
+
\ifx\@normalsize\undefined \normalsize % for ucthesis.cls
|
| 328 |
+
\else \@normalsize \fi
|
| 329 |
+
\else% NFSS (2.09) present
|
| 330 |
+
\@newbaseline%
|
| 331 |
+
\fi}
|
| 332 |
+
|
| 333 |
+
% Initialization of the head and foot text.
|
| 334 |
+
|
| 335 |
+
% The default values still contain \fancyplain for compatibility.
|
| 336 |
+
\fancyhf{} % clear all
|
| 337 |
+
% lefthead empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
|
| 338 |
+
% evenhead empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
|
| 339 |
+
\if@twoside
|
| 340 |
+
\fancyhead[el,or]{\fancyplain{}{\sl\rightmark}}
|
| 341 |
+
\fancyhead[er,ol]{\fancyplain{}{\sl\leftmark}}
|
| 342 |
+
\else
|
| 343 |
+
\fancyhead[l]{\fancyplain{}{\sl\rightmark}}
|
| 344 |
+
\fancyhead[r]{\fancyplain{}{\sl\leftmark}}
|
| 345 |
+
\fi
|
| 346 |
+
\fancyfoot[c]{\rm\thepage} % page number
|
| 347 |
+
|
| 348 |
+
% Use box 0 as a temp box and dimen 0 as temp dimen.
|
| 349 |
+
% This can be done, because this code will always
|
| 350 |
+
% be used inside another box, and therefore the changes are local.
|
| 351 |
+
|
| 352 |
+
\def\@fancyvbox#1#2{\setbox0\vbox{#2}\ifdim\ht0>#1\@fancywarning
|
| 353 |
+
{\string#1 is too small (\the#1): ^^J Make it at least \the\ht0.^^J
|
| 354 |
+
We now make it that large for the rest of the document.^^J
|
| 355 |
+
This may cause the page layout to be inconsistent, however\@gobble}%
|
| 356 |
+
\dimen0=#1\global\setlength{#1}{\ht0}\ht0=\dimen0\fi
|
| 357 |
+
\box0}
|
| 358 |
+
|
| 359 |
+
% Put together a header or footer given the left, center and
|
| 360 |
+
% right text, fillers at left and right and a rule.
|
| 361 |
+
% The \lap commands put the text into an hbox of zero size,
|
| 362 |
+
% so overlapping text does not generate an errormessage.
|
| 363 |
+
% These macros have 5 parameters:
|
| 364 |
+
% 1. LEFTSIDE BEARING % This determines at which side the header will stick
|
| 365 |
+
% out. When \fancyhfoffset is used this calculates \headwidth, otherwise
|
| 366 |
+
% it is \hss or \relax (after expansion).
|
| 367 |
+
% 2. \f@ncyolh, \f@ncyelh, \f@ncyolf or \f@ncyelf. This is the left component.
|
| 368 |
+
% 3. \f@ncyoch, \f@ncyech, \f@ncyocf or \f@ncyecf. This is the middle comp.
|
| 369 |
+
% 4. \f@ncyorh, \f@ncyerh, \f@ncyorf or \f@ncyerf. This is the right component.
|
| 370 |
+
% 5. RIGHTSIDE BEARING. This is always \relax or \hss (after expansion).
|
| 371 |
+
|
| 372 |
+
\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset
|
| 373 |
+
\@fancyvbox\headheight{\hbox
|
| 374 |
+
{\rlap{\parbox[b]{\headwidth}{\raggedright#2}}\hfill
|
| 375 |
+
\parbox[b]{\headwidth}{\centering#3}\hfill
|
| 376 |
+
\llap{\parbox[b]{\headwidth}{\raggedleft#4}}}\headrule}}#5}
|
| 377 |
+
|
| 378 |
+
\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset
|
| 379 |
+
\@fancyvbox\footskip{\footrule
|
| 380 |
+
\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2}}\hfill
|
| 381 |
+
\parbox[t]{\headwidth}{\centering#3}\hfill
|
| 382 |
+
\llap{\parbox[t]{\headwidth}{\raggedleft#4}}}}}#5}
|
| 383 |
+
|
| 384 |
+
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
|
| 385 |
+
\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
|
| 386 |
+
|
| 387 |
+
\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
|
| 388 |
+
\vskip-\footruleskip\vskip-\footrulewidth
|
| 389 |
+
\hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}
|
| 390 |
+
|
| 391 |
+
\def\ps@fancy{%
|
| 392 |
+
\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
|
| 393 |
+
%
|
| 394 |
+
% Define \MakeUppercase for old LaTeXen.
|
| 395 |
+
% Note: we used \def rather than \let, so that \let\uppercase\relax (from
|
| 396 |
+
% the version 1 documentation) will still work.
|
| 397 |
+
%
|
| 398 |
+
\@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}%
|
| 399 |
+
\@ifundefined{chapter}{\def\sectionmark##1{\markboth
|
| 400 |
+
{\MakeUppercase{\ifnum \c@secnumdepth>\z@
|
| 401 |
+
\thesection\hskip 1em\relax \fi ##1}}{}}%
|
| 402 |
+
\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
|
| 403 |
+
\thesubsection\hskip 1em\relax \fi ##1}}}%
|
| 404 |
+
{\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum \c@secnumdepth>\m@ne
|
| 405 |
+
\@chapapp\ \thechapter. \ \fi ##1}}{}}%
|
| 406 |
+
\def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c@secnumdepth >\z@
|
| 407 |
+
\thesection. \ \fi ##1}}}}%
|
| 408 |
+
%\csname ps@headings\endcsname % use \ps@headings defaults if they exist
|
| 409 |
+
\ps@@fancy
|
| 410 |
+
\gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
|
| 411 |
+
% Initialize \headwidth if the user didn't
|
| 412 |
+
%
|
| 413 |
+
\ifdim\headwidth<0sp
|
| 414 |
+
%
|
| 415 |
+
% This catches the case that \headwidth hasn't been initialized and the
|
| 416 |
+
% case that the user added something to \headwidth in the expectation that
|
| 417 |
+
% it was initialized to \textwidth. We compensate this now. This loses if
|
| 418 |
+
% the user intended to multiply it by a factor. But that case is more
|
| 419 |
+
% likely done by saying something like \headwidth=1.2\textwidth.
|
| 420 |
+
% The doc says you have to change \headwidth after the first call to
|
| 421 |
+
% \pagestyle{fancy}. This code is just to catch the most common cases were
|
| 422 |
+
% that requirement is violated.
|
| 423 |
+
%
|
| 424 |
+
\global\advance\headwidth123456789sp\global\advance\headwidth\textwidth
|
| 425 |
+
\fi}
|
| 426 |
+
\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
|
| 427 |
+
\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
|
| 428 |
+
\let\ps@@empty\ps@empty
|
| 429 |
+
\def\ps@@fancy{%
|
| 430 |
+
\ps@@empty % This is for amsbook/amsart, which do strange things with \topskip
|
| 431 |
+
\def\@mkboth{\protect\markboth}%
|
| 432 |
+
\def\@oddhead{\@fancyhead\fancy@Oolh\f@ncyolh\f@ncyoch\f@ncyorh\fancy@Oorh}%
|
| 433 |
+
\def\@oddfoot{\@fancyfoot\fancy@Oolf\f@ncyolf\f@ncyocf\f@ncyorf\fancy@Oorf}%
|
| 434 |
+
\def\@evenhead{\@fancyhead\fancy@Oelh\f@ncyelh\f@ncyech\f@ncyerh\fancy@Oerh}%
|
| 435 |
+
\def\@evenfoot{\@fancyfoot\fancy@Oelf\f@ncyelf\f@ncyecf\f@ncyerf\fancy@Oerf}%
|
| 436 |
+
}
|
| 437 |
+
% Default definitions for compatibility mode:
|
| 438 |
+
% These cause the header/footer to take the defined \headwidth as width
|
| 439 |
+
% And to shift in the direction of the marginpar area
|
| 440 |
+
|
| 441 |
+
\def\fancy@Oolh{\if@reversemargin\hss\else\relax\fi}
|
| 442 |
+
\def\fancy@Oorh{\if@reversemargin\relax\else\hss\fi}
|
| 443 |
+
\let\fancy@Oelh\fancy@Oorh
|
| 444 |
+
\let\fancy@Oerh\fancy@Oolh
|
| 445 |
+
|
| 446 |
+
\let\fancy@Oolf\fancy@Oolh
|
| 447 |
+
\let\fancy@Oorf\fancy@Oorh
|
| 448 |
+
\let\fancy@Oelf\fancy@Oelh
|
| 449 |
+
\let\fancy@Oerf\fancy@Oerh
|
| 450 |
+
|
| 451 |
+
% New definitions for the use of \fancyhfoffset
|
| 452 |
+
% These calculate the \headwidth from \textwidth and the specified offsets.
|
| 453 |
+
|
| 454 |
+
\def\fancy@offsolh{\headwidth=\textwidth\advance\headwidth\f@ncyO@olh
|
| 455 |
+
\advance\headwidth\f@ncyO@orh\hskip-\f@ncyO@olh}
|
| 456 |
+
\def\fancy@offselh{\headwidth=\textwidth\advance\headwidth\f@ncyO@elh
|
| 457 |
+
\advance\headwidth\f@ncyO@erh\hskip-\f@ncyO@elh}
|
| 458 |
+
|
| 459 |
+
\def\fancy@offsolf{\headwidth=\textwidth\advance\headwidth\f@ncyO@olf
|
| 460 |
+
\advance\headwidth\f@ncyO@orf\hskip-\f@ncyO@olf}
|
| 461 |
+
\def\fancy@offself{\headwidth=\textwidth\advance\headwidth\f@ncyO@elf
|
| 462 |
+
\advance\headwidth\f@ncyO@erf\hskip-\f@ncyO@elf}
|
| 463 |
+
|
| 464 |
+
\def\fancy@setoffs{%
|
| 465 |
+
% Just in case \let\headwidth\textwidth was used
|
| 466 |
+
\fancy@gbl\let\headwidth\fancy@headwidth
|
| 467 |
+
\fancy@gbl\let\fancy@Oolh\fancy@offsolh
|
| 468 |
+
\fancy@gbl\let\fancy@Oelh\fancy@offselh
|
| 469 |
+
\fancy@gbl\let\fancy@Oorh\hss
|
| 470 |
+
\fancy@gbl\let\fancy@Oerh\hss
|
| 471 |
+
\fancy@gbl\let\fancy@Oolf\fancy@offsolf
|
| 472 |
+
\fancy@gbl\let\fancy@Oelf\fancy@offself
|
| 473 |
+
\fancy@gbl\let\fancy@Oorf\hss
|
| 474 |
+
\fancy@gbl\let\fancy@Oerf\hss}
|
| 475 |
+
|
| 476 |
+
\newif\iffootnote
|
| 477 |
+
\let\latex@makecol\@makecol
|
| 478 |
+
\def\@makecol{\ifvoid\footins\footnotetrue\else\footnotefalse\fi
|
| 479 |
+
\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
|
| 480 |
+
\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
|
| 481 |
+
\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
|
| 482 |
+
\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}
|
| 483 |
+
|
| 484 |
+
\newcommand{\fancypagestyle}[2]{%
|
| 485 |
+
\@namedef{ps@#1}{\let\fancy@gbl\relax#2\relax\ps@fancy}}
|
gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.bib
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@incollection{Bengio+chapter2007,
|
| 2 |
+
author = {Bengio, Yoshua and LeCun, Yann},
|
| 3 |
+
booktitle = {Large Scale Kernel Machines},
|
| 4 |
+
publisher = {MIT Press},
|
| 5 |
+
title = {Scaling Learning Algorithms Towards {AI}},
|
| 6 |
+
year = {2007}
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
@article{Hinton06,
|
| 10 |
+
author = {Hinton, Geoffrey E. and Osindero, Simon and Teh, Yee Whye},
|
| 11 |
+
journal = {Neural Computation},
|
| 12 |
+
pages = {1527--1554},
|
| 13 |
+
title = {A Fast Learning Algorithm for Deep Belief Nets},
|
| 14 |
+
volume = {18},
|
| 15 |
+
year = {2006}
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
@book{goodfellow2016deep,
|
| 19 |
+
title={Deep learning},
|
| 20 |
+
author={Goodfellow, Ian and Bengio, Yoshua and Courville, Aaron and Bengio, Yoshua},
|
| 21 |
+
volume={1},
|
| 22 |
+
year={2016},
|
| 23 |
+
publisher={MIT Press}
|
| 24 |
+
}
|
gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.bst
ADDED
|
@@ -0,0 +1,1440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% File: `iclr2024.bst'
|
| 2 |
+
%% A copy of iclm2010.bst, which is a modification of `plainnl.bst' for use with natbib package
|
| 3 |
+
%%
|
| 4 |
+
%% Copyright 2010 Hal Daum\'e III
|
| 5 |
+
%% Modified by J. Fürnkranz
|
| 6 |
+
%% - Changed labels from (X and Y, 2000) to (X & Y, 2000)
|
| 7 |
+
%%
|
| 8 |
+
%% Copyright 1993-2007 Patrick W Daly
|
| 9 |
+
%% Max-Planck-Institut f\"ur Sonnensystemforschung
|
| 10 |
+
%% Max-Planck-Str. 2
|
| 11 |
+
%% D-37191 Katlenburg-Lindau
|
| 12 |
+
%% Germany
|
| 13 |
+
%% E-mail: daly@mps.mpg.de
|
| 14 |
+
%%
|
| 15 |
+
%% This program can be redistributed and/or modified under the terms
|
| 16 |
+
%% of the LaTeX Project Public License Distributed from CTAN
|
| 17 |
+
%% archives in directory macros/latex/base/lppl.txt; either
|
| 18 |
+
%% version 1 of the License, or any later version.
|
| 19 |
+
%%
|
| 20 |
+
% Version and source file information:
|
| 21 |
+
% \ProvidesFile{icml2010.mbs}[2007/11/26 1.93 (PWD)]
|
| 22 |
+
%
|
| 23 |
+
% BibTeX `plainnat' family
|
| 24 |
+
% version 0.99b for BibTeX versions 0.99a or later,
|
| 25 |
+
% for LaTeX versions 2.09 and 2e.
|
| 26 |
+
%
|
| 27 |
+
% For use with the `natbib.sty' package; emulates the corresponding
|
| 28 |
+
% member of the `plain' family, but with author-year citations.
|
| 29 |
+
%
|
| 30 |
+
% With version 6.0 of `natbib.sty', it may also be used for numerical
|
| 31 |
+
% citations, while retaining the commands \citeauthor, \citefullauthor,
|
| 32 |
+
% and \citeyear to print the corresponding information.
|
| 33 |
+
%
|
| 34 |
+
% For version 7.0 of `natbib.sty', the KEY field replaces missing
|
| 35 |
+
% authors/editors, and the date is left blank in \bibitem.
|
| 36 |
+
%
|
| 37 |
+
% Includes field EID for the sequence/citation number of electronic journals
|
| 38 |
+
% which is used instead of page numbers.
|
| 39 |
+
%
|
| 40 |
+
% Includes fields ISBN and ISSN.
|
| 41 |
+
%
|
| 42 |
+
% Includes field URL for Internet addresses.
|
| 43 |
+
%
|
| 44 |
+
% Includes field DOI for Digital Object Idenfifiers.
|
| 45 |
+
%
|
| 46 |
+
% Works best with the url.sty package of Donald Arseneau.
|
| 47 |
+
%
|
| 48 |
+
% Works with identical authors and year are further sorted by
|
| 49 |
+
% citation key, to preserve any natural sequence.
|
| 50 |
+
%
|
| 51 |
+
ENTRY
|
| 52 |
+
{ address
|
| 53 |
+
author
|
| 54 |
+
booktitle
|
| 55 |
+
chapter
|
| 56 |
+
doi
|
| 57 |
+
eid
|
| 58 |
+
edition
|
| 59 |
+
editor
|
| 60 |
+
howpublished
|
| 61 |
+
institution
|
| 62 |
+
isbn
|
| 63 |
+
issn
|
| 64 |
+
journal
|
| 65 |
+
key
|
| 66 |
+
month
|
| 67 |
+
note
|
| 68 |
+
number
|
| 69 |
+
organization
|
| 70 |
+
pages
|
| 71 |
+
publisher
|
| 72 |
+
school
|
| 73 |
+
series
|
| 74 |
+
title
|
| 75 |
+
type
|
| 76 |
+
url
|
| 77 |
+
volume
|
| 78 |
+
year
|
| 79 |
+
}
|
| 80 |
+
{}
|
| 81 |
+
{ label extra.label sort.label short.list }
|
| 82 |
+
|
| 83 |
+
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
|
| 84 |
+
|
| 85 |
+
FUNCTION {init.state.consts}
|
| 86 |
+
{ #0 'before.all :=
|
| 87 |
+
#1 'mid.sentence :=
|
| 88 |
+
#2 'after.sentence :=
|
| 89 |
+
#3 'after.block :=
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
STRINGS { s t }
|
| 93 |
+
|
| 94 |
+
FUNCTION {output.nonnull}
|
| 95 |
+
{ 's :=
|
| 96 |
+
output.state mid.sentence =
|
| 97 |
+
{ ", " * write$ }
|
| 98 |
+
{ output.state after.block =
|
| 99 |
+
{ add.period$ write$
|
| 100 |
+
newline$
|
| 101 |
+
"\newblock " write$
|
| 102 |
+
}
|
| 103 |
+
{ output.state before.all =
|
| 104 |
+
'write$
|
| 105 |
+
{ add.period$ " " * write$ }
|
| 106 |
+
if$
|
| 107 |
+
}
|
| 108 |
+
if$
|
| 109 |
+
mid.sentence 'output.state :=
|
| 110 |
+
}
|
| 111 |
+
if$
|
| 112 |
+
s
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
FUNCTION {output}
|
| 116 |
+
{ duplicate$ empty$
|
| 117 |
+
'pop$
|
| 118 |
+
'output.nonnull
|
| 119 |
+
if$
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
FUNCTION {output.check}
|
| 123 |
+
{ 't :=
|
| 124 |
+
duplicate$ empty$
|
| 125 |
+
{ pop$ "empty " t * " in " * cite$ * warning$ }
|
| 126 |
+
'output.nonnull
|
| 127 |
+
if$
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
FUNCTION {fin.entry}
|
| 131 |
+
{ add.period$
|
| 132 |
+
write$
|
| 133 |
+
newline$
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
FUNCTION {new.block}
|
| 137 |
+
{ output.state before.all =
|
| 138 |
+
'skip$
|
| 139 |
+
{ after.block 'output.state := }
|
| 140 |
+
if$
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
FUNCTION {new.sentence}
|
| 144 |
+
{ output.state after.block =
|
| 145 |
+
'skip$
|
| 146 |
+
{ output.state before.all =
|
| 147 |
+
'skip$
|
| 148 |
+
{ after.sentence 'output.state := }
|
| 149 |
+
if$
|
| 150 |
+
}
|
| 151 |
+
if$
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
FUNCTION {not}
|
| 155 |
+
{ { #0 }
|
| 156 |
+
{ #1 }
|
| 157 |
+
if$
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
FUNCTION {and}
|
| 161 |
+
{ 'skip$
|
| 162 |
+
{ pop$ #0 }
|
| 163 |
+
if$
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
FUNCTION {or}
|
| 167 |
+
{ { pop$ #1 }
|
| 168 |
+
'skip$
|
| 169 |
+
if$
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
FUNCTION {new.block.checka}
|
| 173 |
+
{ empty$
|
| 174 |
+
'skip$
|
| 175 |
+
'new.block
|
| 176 |
+
if$
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
FUNCTION {new.block.checkb}
|
| 180 |
+
{ empty$
|
| 181 |
+
swap$ empty$
|
| 182 |
+
and
|
| 183 |
+
'skip$
|
| 184 |
+
'new.block
|
| 185 |
+
if$
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
FUNCTION {new.sentence.checka}
|
| 189 |
+
{ empty$
|
| 190 |
+
'skip$
|
| 191 |
+
'new.sentence
|
| 192 |
+
if$
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
FUNCTION {new.sentence.checkb}
|
| 196 |
+
{ empty$
|
| 197 |
+
swap$ empty$
|
| 198 |
+
and
|
| 199 |
+
'skip$
|
| 200 |
+
'new.sentence
|
| 201 |
+
if$
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
FUNCTION {field.or.null}
|
| 205 |
+
{ duplicate$ empty$
|
| 206 |
+
{ pop$ "" }
|
| 207 |
+
'skip$
|
| 208 |
+
if$
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
FUNCTION {emphasize}
|
| 212 |
+
{ duplicate$ empty$
|
| 213 |
+
{ pop$ "" }
|
| 214 |
+
{ "\emph{" swap$ * "}" * }
|
| 215 |
+
if$
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
INTEGERS { nameptr namesleft numnames }
|
| 219 |
+
|
| 220 |
+
FUNCTION {format.names}
|
| 221 |
+
{ 's :=
|
| 222 |
+
#1 'nameptr :=
|
| 223 |
+
s num.names$ 'numnames :=
|
| 224 |
+
numnames 'namesleft :=
|
| 225 |
+
{ namesleft #0 > }
|
| 226 |
+
{ s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
|
| 227 |
+
nameptr #1 >
|
| 228 |
+
{ namesleft #1 >
|
| 229 |
+
{ ", " * t * }
|
| 230 |
+
{ numnames #2 >
|
| 231 |
+
{ "," * }
|
| 232 |
+
'skip$
|
| 233 |
+
if$
|
| 234 |
+
t "others" =
|
| 235 |
+
{ " et~al." * }
|
| 236 |
+
{ " and " * t * }
|
| 237 |
+
if$
|
| 238 |
+
}
|
| 239 |
+
if$
|
| 240 |
+
}
|
| 241 |
+
't
|
| 242 |
+
if$
|
| 243 |
+
nameptr #1 + 'nameptr :=
|
| 244 |
+
namesleft #1 - 'namesleft :=
|
| 245 |
+
}
|
| 246 |
+
while$
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
FUNCTION {format.key}
|
| 250 |
+
{ empty$
|
| 251 |
+
{ key field.or.null }
|
| 252 |
+
{ "" }
|
| 253 |
+
if$
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
FUNCTION {format.authors}
|
| 257 |
+
{ author empty$
|
| 258 |
+
{ "" }
|
| 259 |
+
{ author format.names }
|
| 260 |
+
if$
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
FUNCTION {format.editors}
|
| 264 |
+
{ editor empty$
|
| 265 |
+
{ "" }
|
| 266 |
+
{ editor format.names
|
| 267 |
+
editor num.names$ #1 >
|
| 268 |
+
{ " (eds.)" * }
|
| 269 |
+
{ " (ed.)" * }
|
| 270 |
+
if$
|
| 271 |
+
}
|
| 272 |
+
if$
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
FUNCTION {format.isbn}
|
| 276 |
+
{ isbn empty$
|
| 277 |
+
{ "" }
|
| 278 |
+
{ new.block "ISBN " isbn * }
|
| 279 |
+
if$
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
FUNCTION {format.issn}
|
| 283 |
+
{ issn empty$
|
| 284 |
+
{ "" }
|
| 285 |
+
{ new.block "ISSN " issn * }
|
| 286 |
+
if$
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
FUNCTION {format.url}
|
| 290 |
+
{ url empty$
|
| 291 |
+
{ "" }
|
| 292 |
+
{ new.block "URL \url{" url * "}" * }
|
| 293 |
+
if$
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
FUNCTION {format.doi}
|
| 297 |
+
{ doi empty$
|
| 298 |
+
{ "" }
|
| 299 |
+
{ new.block "\doi{" doi * "}" * }
|
| 300 |
+
if$
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
FUNCTION {format.title}
|
| 304 |
+
{ title empty$
|
| 305 |
+
{ "" }
|
| 306 |
+
{ title "t" change.case$ }
|
| 307 |
+
if$
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
FUNCTION {format.full.names}
|
| 311 |
+
{'s :=
|
| 312 |
+
#1 'nameptr :=
|
| 313 |
+
s num.names$ 'numnames :=
|
| 314 |
+
numnames 'namesleft :=
|
| 315 |
+
{ namesleft #0 > }
|
| 316 |
+
{ s nameptr
|
| 317 |
+
"{vv~}{ll}" format.name$ 't :=
|
| 318 |
+
nameptr #1 >
|
| 319 |
+
{
|
| 320 |
+
namesleft #1 >
|
| 321 |
+
{ ", " * t * }
|
| 322 |
+
{
|
| 323 |
+
numnames #2 >
|
| 324 |
+
{ "," * }
|
| 325 |
+
'skip$
|
| 326 |
+
if$
|
| 327 |
+
t "others" =
|
| 328 |
+
{ " et~al." * }
|
| 329 |
+
{ " and " * t * }
|
| 330 |
+
if$
|
| 331 |
+
}
|
| 332 |
+
if$
|
| 333 |
+
}
|
| 334 |
+
't
|
| 335 |
+
if$
|
| 336 |
+
nameptr #1 + 'nameptr :=
|
| 337 |
+
namesleft #1 - 'namesleft :=
|
| 338 |
+
}
|
| 339 |
+
while$
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
FUNCTION {author.editor.full}
|
| 343 |
+
{ author empty$
|
| 344 |
+
{ editor empty$
|
| 345 |
+
{ "" }
|
| 346 |
+
{ editor format.full.names }
|
| 347 |
+
if$
|
| 348 |
+
}
|
| 349 |
+
{ author format.full.names }
|
| 350 |
+
if$
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
FUNCTION {author.full}
|
| 354 |
+
{ author empty$
|
| 355 |
+
{ "" }
|
| 356 |
+
{ author format.full.names }
|
| 357 |
+
if$
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
FUNCTION {editor.full}
|
| 361 |
+
{ editor empty$
|
| 362 |
+
{ "" }
|
| 363 |
+
{ editor format.full.names }
|
| 364 |
+
if$
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
FUNCTION {make.full.names}
|
| 368 |
+
{ type$ "book" =
|
| 369 |
+
type$ "inbook" =
|
| 370 |
+
or
|
| 371 |
+
'author.editor.full
|
| 372 |
+
{ type$ "proceedings" =
|
| 373 |
+
'editor.full
|
| 374 |
+
'author.full
|
| 375 |
+
if$
|
| 376 |
+
}
|
| 377 |
+
if$
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
FUNCTION {output.bibitem}
|
| 381 |
+
{ newline$
|
| 382 |
+
"\bibitem[" write$
|
| 383 |
+
label write$
|
| 384 |
+
")" make.full.names duplicate$ short.list =
|
| 385 |
+
{ pop$ }
|
| 386 |
+
{ * }
|
| 387 |
+
if$
|
| 388 |
+
"]{" * write$
|
| 389 |
+
cite$ write$
|
| 390 |
+
"}" write$
|
| 391 |
+
newline$
|
| 392 |
+
""
|
| 393 |
+
before.all 'output.state :=
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
FUNCTION {n.dashify}
|
| 397 |
+
{ 't :=
|
| 398 |
+
""
|
| 399 |
+
{ t empty$ not }
|
| 400 |
+
{ t #1 #1 substring$ "-" =
|
| 401 |
+
{ t #1 #2 substring$ "--" = not
|
| 402 |
+
{ "--" *
|
| 403 |
+
t #2 global.max$ substring$ 't :=
|
| 404 |
+
}
|
| 405 |
+
{ { t #1 #1 substring$ "-" = }
|
| 406 |
+
{ "-" *
|
| 407 |
+
t #2 global.max$ substring$ 't :=
|
| 408 |
+
}
|
| 409 |
+
while$
|
| 410 |
+
}
|
| 411 |
+
if$
|
| 412 |
+
}
|
| 413 |
+
{ t #1 #1 substring$ *
|
| 414 |
+
t #2 global.max$ substring$ 't :=
|
| 415 |
+
}
|
| 416 |
+
if$
|
| 417 |
+
}
|
| 418 |
+
while$
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
FUNCTION {format.date}
|
| 422 |
+
{ year duplicate$ empty$
|
| 423 |
+
{ "empty year in " cite$ * warning$
|
| 424 |
+
pop$ "" }
|
| 425 |
+
'skip$
|
| 426 |
+
if$
|
| 427 |
+
month empty$
|
| 428 |
+
'skip$
|
| 429 |
+
{ month
|
| 430 |
+
" " * swap$ *
|
| 431 |
+
}
|
| 432 |
+
if$
|
| 433 |
+
extra.label *
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
FUNCTION {format.btitle}
|
| 437 |
+
{ title emphasize
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
FUNCTION {tie.or.space.connect}
|
| 441 |
+
{ duplicate$ text.length$ #3 <
|
| 442 |
+
{ "~" }
|
| 443 |
+
{ " " }
|
| 444 |
+
if$
|
| 445 |
+
swap$ * *
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
FUNCTION {either.or.check}
|
| 449 |
+
{ empty$
|
| 450 |
+
'pop$
|
| 451 |
+
{ "can't use both " swap$ * " fields in " * cite$ * warning$ }
|
| 452 |
+
if$
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
FUNCTION {format.bvolume}
|
| 456 |
+
{ volume empty$
|
| 457 |
+
{ "" }
|
| 458 |
+
{ "volume" volume tie.or.space.connect
|
| 459 |
+
series empty$
|
| 460 |
+
'skip$
|
| 461 |
+
{ " of " * series emphasize * }
|
| 462 |
+
if$
|
| 463 |
+
"volume and number" number either.or.check
|
| 464 |
+
}
|
| 465 |
+
if$
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
FUNCTION {format.number.series}
|
| 469 |
+
{ volume empty$
|
| 470 |
+
{ number empty$
|
| 471 |
+
{ series field.or.null }
|
| 472 |
+
{ output.state mid.sentence =
|
| 473 |
+
{ "number" }
|
| 474 |
+
{ "Number" }
|
| 475 |
+
if$
|
| 476 |
+
number tie.or.space.connect
|
| 477 |
+
series empty$
|
| 478 |
+
{ "there's a number but no series in " cite$ * warning$ }
|
| 479 |
+
{ " in " * series * }
|
| 480 |
+
if$
|
| 481 |
+
}
|
| 482 |
+
if$
|
| 483 |
+
}
|
| 484 |
+
{ "" }
|
| 485 |
+
if$
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
FUNCTION {format.edition}
|
| 489 |
+
{ edition empty$
|
| 490 |
+
{ "" }
|
| 491 |
+
{ output.state mid.sentence =
|
| 492 |
+
{ edition "l" change.case$ " edition" * }
|
| 493 |
+
{ edition "t" change.case$ " edition" * }
|
| 494 |
+
if$
|
| 495 |
+
}
|
| 496 |
+
if$
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
INTEGERS { multiresult }
|
| 500 |
+
|
| 501 |
+
FUNCTION {multi.page.check}
|
| 502 |
+
{ 't :=
|
| 503 |
+
#0 'multiresult :=
|
| 504 |
+
{ multiresult not
|
| 505 |
+
t empty$ not
|
| 506 |
+
and
|
| 507 |
+
}
|
| 508 |
+
{ t #1 #1 substring$
|
| 509 |
+
duplicate$ "-" =
|
| 510 |
+
swap$ duplicate$ "," =
|
| 511 |
+
swap$ "+" =
|
| 512 |
+
or or
|
| 513 |
+
{ #1 'multiresult := }
|
| 514 |
+
{ t #2 global.max$ substring$ 't := }
|
| 515 |
+
if$
|
| 516 |
+
}
|
| 517 |
+
while$
|
| 518 |
+
multiresult
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
FUNCTION {format.pages}
|
| 522 |
+
{ pages empty$
|
| 523 |
+
{ "" }
|
| 524 |
+
{ pages multi.page.check
|
| 525 |
+
{ "pp.\ " pages n.dashify tie.or.space.connect }
|
| 526 |
+
{ "pp.\ " pages tie.or.space.connect }
|
| 527 |
+
if$
|
| 528 |
+
}
|
| 529 |
+
if$
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
FUNCTION {format.eid}
|
| 533 |
+
{ eid empty$
|
| 534 |
+
{ "" }
|
| 535 |
+
{ "art." eid tie.or.space.connect }
|
| 536 |
+
if$
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
FUNCTION {format.vol.num.pages}
|
| 540 |
+
{ volume field.or.null
|
| 541 |
+
number empty$
|
| 542 |
+
'skip$
|
| 543 |
+
{ "\penalty0 (" number * ")" * *
|
| 544 |
+
volume empty$
|
| 545 |
+
{ "there's a number but no volume in " cite$ * warning$ }
|
| 546 |
+
'skip$
|
| 547 |
+
if$
|
| 548 |
+
}
|
| 549 |
+
if$
|
| 550 |
+
pages empty$
|
| 551 |
+
'skip$
|
| 552 |
+
{ duplicate$ empty$
|
| 553 |
+
{ pop$ format.pages }
|
| 554 |
+
{ ":\penalty0 " * pages n.dashify * }
|
| 555 |
+
if$
|
| 556 |
+
}
|
| 557 |
+
if$
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
FUNCTION {format.vol.num.eid}
|
| 561 |
+
{ volume field.or.null
|
| 562 |
+
number empty$
|
| 563 |
+
'skip$
|
| 564 |
+
{ "\penalty0 (" number * ")" * *
|
| 565 |
+
volume empty$
|
| 566 |
+
{ "there's a number but no volume in " cite$ * warning$ }
|
| 567 |
+
'skip$
|
| 568 |
+
if$
|
| 569 |
+
}
|
| 570 |
+
if$
|
| 571 |
+
eid empty$
|
| 572 |
+
'skip$
|
| 573 |
+
{ duplicate$ empty$
|
| 574 |
+
{ pop$ format.eid }
|
| 575 |
+
{ ":\penalty0 " * eid * }
|
| 576 |
+
if$
|
| 577 |
+
}
|
| 578 |
+
if$
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
FUNCTION {format.chapter.pages}
|
| 582 |
+
{ chapter empty$
|
| 583 |
+
'format.pages
|
| 584 |
+
{ type empty$
|
| 585 |
+
{ "chapter" }
|
| 586 |
+
{ type "l" change.case$ }
|
| 587 |
+
if$
|
| 588 |
+
chapter tie.or.space.connect
|
| 589 |
+
pages empty$
|
| 590 |
+
'skip$
|
| 591 |
+
{ ", " * format.pages * }
|
| 592 |
+
if$
|
| 593 |
+
}
|
| 594 |
+
if$
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
FUNCTION {format.in.ed.booktitle}
|
| 598 |
+
{ booktitle empty$
|
| 599 |
+
{ "" }
|
| 600 |
+
{ editor empty$
|
| 601 |
+
{ "In " booktitle emphasize * }
|
| 602 |
+
{ "In " format.editors * ", " * booktitle emphasize * }
|
| 603 |
+
if$
|
| 604 |
+
}
|
| 605 |
+
if$
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
FUNCTION {empty.misc.check}
|
| 609 |
+
{ author empty$ title empty$ howpublished empty$
|
| 610 |
+
month empty$ year empty$ note empty$
|
| 611 |
+
and and and and and
|
| 612 |
+
key empty$ not and
|
| 613 |
+
{ "all relevant fields are empty in " cite$ * warning$ }
|
| 614 |
+
'skip$
|
| 615 |
+
if$
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
FUNCTION {format.thesis.type}
|
| 619 |
+
{ type empty$
|
| 620 |
+
'skip$
|
| 621 |
+
{ pop$
|
| 622 |
+
type "t" change.case$
|
| 623 |
+
}
|
| 624 |
+
if$
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
FUNCTION {format.tr.number}
|
| 628 |
+
{ type empty$
|
| 629 |
+
{ "Technical Report" }
|
| 630 |
+
'type
|
| 631 |
+
if$
|
| 632 |
+
number empty$
|
| 633 |
+
{ "t" change.case$ }
|
| 634 |
+
{ number tie.or.space.connect }
|
| 635 |
+
if$
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
FUNCTION {format.article.crossref}
|
| 639 |
+
{ key empty$
|
| 640 |
+
{ journal empty$
|
| 641 |
+
{ "need key or journal for " cite$ * " to crossref " * crossref *
|
| 642 |
+
warning$
|
| 643 |
+
""
|
| 644 |
+
}
|
| 645 |
+
{ "In \emph{" journal * "}" * }
|
| 646 |
+
if$
|
| 647 |
+
}
|
| 648 |
+
{ "In " }
|
| 649 |
+
if$
|
| 650 |
+
" \citet{" * crossref * "}" *
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
FUNCTION {format.book.crossref}
|
| 654 |
+
{ volume empty$
|
| 655 |
+
{ "empty volume in " cite$ * "'s crossref of " * crossref * warning$
|
| 656 |
+
"In "
|
| 657 |
+
}
|
| 658 |
+
{ "Volume" volume tie.or.space.connect
|
| 659 |
+
" of " *
|
| 660 |
+
}
|
| 661 |
+
if$
|
| 662 |
+
editor empty$
|
| 663 |
+
editor field.or.null author field.or.null =
|
| 664 |
+
or
|
| 665 |
+
{ key empty$
|
| 666 |
+
{ series empty$
|
| 667 |
+
{ "need editor, key, or series for " cite$ * " to crossref " *
|
| 668 |
+
crossref * warning$
|
| 669 |
+
"" *
|
| 670 |
+
}
|
| 671 |
+
{ "\emph{" * series * "}" * }
|
| 672 |
+
if$
|
| 673 |
+
}
|
| 674 |
+
'skip$
|
| 675 |
+
if$
|
| 676 |
+
}
|
| 677 |
+
'skip$
|
| 678 |
+
if$
|
| 679 |
+
" \citet{" * crossref * "}" *
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
FUNCTION {format.incoll.inproc.crossref}
|
| 683 |
+
{ editor empty$
|
| 684 |
+
editor field.or.null author field.or.null =
|
| 685 |
+
or
|
| 686 |
+
{ key empty$
|
| 687 |
+
{ booktitle empty$
|
| 688 |
+
{ "need editor, key, or booktitle for " cite$ * " to crossref " *
|
| 689 |
+
crossref * warning$
|
| 690 |
+
""
|
| 691 |
+
}
|
| 692 |
+
{ "In \emph{" booktitle * "}" * }
|
| 693 |
+
if$
|
| 694 |
+
}
|
| 695 |
+
{ "In " }
|
| 696 |
+
if$
|
| 697 |
+
}
|
| 698 |
+
{ "In " }
|
| 699 |
+
if$
|
| 700 |
+
" \citet{" * crossref * "}" *
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
FUNCTION {article}
|
| 704 |
+
{ output.bibitem
|
| 705 |
+
format.authors "author" output.check
|
| 706 |
+
author format.key output
|
| 707 |
+
new.block
|
| 708 |
+
format.title "title" output.check
|
| 709 |
+
new.block
|
| 710 |
+
crossref missing$
|
| 711 |
+
{ journal emphasize "journal" output.check
|
| 712 |
+
eid empty$
|
| 713 |
+
{ format.vol.num.pages output }
|
| 714 |
+
{ format.vol.num.eid output }
|
| 715 |
+
if$
|
| 716 |
+
format.date "year" output.check
|
| 717 |
+
}
|
| 718 |
+
{ format.article.crossref output.nonnull
|
| 719 |
+
eid empty$
|
| 720 |
+
{ format.pages output }
|
| 721 |
+
{ format.eid output }
|
| 722 |
+
if$
|
| 723 |
+
}
|
| 724 |
+
if$
|
| 725 |
+
format.issn output
|
| 726 |
+
format.doi output
|
| 727 |
+
format.url output
|
| 728 |
+
new.block
|
| 729 |
+
note output
|
| 730 |
+
fin.entry
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
FUNCTION {book}
|
| 734 |
+
{ output.bibitem
|
| 735 |
+
author empty$
|
| 736 |
+
{ format.editors "author and editor" output.check
|
| 737 |
+
editor format.key output
|
| 738 |
+
}
|
| 739 |
+
{ format.authors output.nonnull
|
| 740 |
+
crossref missing$
|
| 741 |
+
{ "author and editor" editor either.or.check }
|
| 742 |
+
'skip$
|
| 743 |
+
if$
|
| 744 |
+
}
|
| 745 |
+
if$
|
| 746 |
+
new.block
|
| 747 |
+
format.btitle "title" output.check
|
| 748 |
+
crossref missing$
|
| 749 |
+
{ format.bvolume output
|
| 750 |
+
new.block
|
| 751 |
+
format.number.series output
|
| 752 |
+
new.sentence
|
| 753 |
+
publisher "publisher" output.check
|
| 754 |
+
address output
|
| 755 |
+
}
|
| 756 |
+
{ new.block
|
| 757 |
+
format.book.crossref output.nonnull
|
| 758 |
+
}
|
| 759 |
+
if$
|
| 760 |
+
format.edition output
|
| 761 |
+
format.date "year" output.check
|
| 762 |
+
format.isbn output
|
| 763 |
+
format.doi output
|
| 764 |
+
format.url output
|
| 765 |
+
new.block
|
| 766 |
+
note output
|
| 767 |
+
fin.entry
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
FUNCTION {booklet}
|
| 771 |
+
{ output.bibitem
|
| 772 |
+
format.authors output
|
| 773 |
+
author format.key output
|
| 774 |
+
new.block
|
| 775 |
+
format.title "title" output.check
|
| 776 |
+
howpublished address new.block.checkb
|
| 777 |
+
howpublished output
|
| 778 |
+
address output
|
| 779 |
+
format.date output
|
| 780 |
+
format.isbn output
|
| 781 |
+
format.doi output
|
| 782 |
+
format.url output
|
| 783 |
+
new.block
|
| 784 |
+
note output
|
| 785 |
+
fin.entry
|
| 786 |
+
}
|
| 787 |
+
|
| 788 |
+
FUNCTION {inbook}
|
| 789 |
+
{ output.bibitem
|
| 790 |
+
author empty$
|
| 791 |
+
{ format.editors "author and editor" output.check
|
| 792 |
+
editor format.key output
|
| 793 |
+
}
|
| 794 |
+
{ format.authors output.nonnull
|
| 795 |
+
crossref missing$
|
| 796 |
+
{ "author and editor" editor either.or.check }
|
| 797 |
+
'skip$
|
| 798 |
+
if$
|
| 799 |
+
}
|
| 800 |
+
if$
|
| 801 |
+
new.block
|
| 802 |
+
format.btitle "title" output.check
|
| 803 |
+
crossref missing$
|
| 804 |
+
{ format.bvolume output
|
| 805 |
+
format.chapter.pages "chapter and pages" output.check
|
| 806 |
+
new.block
|
| 807 |
+
format.number.series output
|
| 808 |
+
new.sentence
|
| 809 |
+
publisher "publisher" output.check
|
| 810 |
+
address output
|
| 811 |
+
}
|
| 812 |
+
{ format.chapter.pages "chapter and pages" output.check
|
| 813 |
+
new.block
|
| 814 |
+
format.book.crossref output.nonnull
|
| 815 |
+
}
|
| 816 |
+
if$
|
| 817 |
+
format.edition output
|
| 818 |
+
format.date "year" output.check
|
| 819 |
+
format.isbn output
|
| 820 |
+
format.doi output
|
| 821 |
+
format.url output
|
| 822 |
+
new.block
|
| 823 |
+
note output
|
| 824 |
+
fin.entry
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
FUNCTION {incollection}
|
| 828 |
+
{ output.bibitem
|
| 829 |
+
format.authors "author" output.check
|
| 830 |
+
author format.key output
|
| 831 |
+
new.block
|
| 832 |
+
format.title "title" output.check
|
| 833 |
+
new.block
|
| 834 |
+
crossref missing$
|
| 835 |
+
{ format.in.ed.booktitle "booktitle" output.check
|
| 836 |
+
format.bvolume output
|
| 837 |
+
format.number.series output
|
| 838 |
+
format.chapter.pages output
|
| 839 |
+
new.sentence
|
| 840 |
+
publisher "publisher" output.check
|
| 841 |
+
address output
|
| 842 |
+
format.edition output
|
| 843 |
+
format.date "year" output.check
|
| 844 |
+
}
|
| 845 |
+
{ format.incoll.inproc.crossref output.nonnull
|
| 846 |
+
format.chapter.pages output
|
| 847 |
+
}
|
| 848 |
+
if$
|
| 849 |
+
format.isbn output
|
| 850 |
+
format.doi output
|
| 851 |
+
format.url output
|
| 852 |
+
new.block
|
| 853 |
+
note output
|
| 854 |
+
fin.entry
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
FUNCTION {inproceedings}
|
| 858 |
+
{ output.bibitem
|
| 859 |
+
format.authors "author" output.check
|
| 860 |
+
author format.key output
|
| 861 |
+
new.block
|
| 862 |
+
format.title "title" output.check
|
| 863 |
+
new.block
|
| 864 |
+
crossref missing$
|
| 865 |
+
{ format.in.ed.booktitle "booktitle" output.check
|
| 866 |
+
format.bvolume output
|
| 867 |
+
format.number.series output
|
| 868 |
+
format.pages output
|
| 869 |
+
address empty$
|
| 870 |
+
{ organization publisher new.sentence.checkb
|
| 871 |
+
organization output
|
| 872 |
+
publisher output
|
| 873 |
+
format.date "year" output.check
|
| 874 |
+
}
|
| 875 |
+
{ address output.nonnull
|
| 876 |
+
format.date "year" output.check
|
| 877 |
+
new.sentence
|
| 878 |
+
organization output
|
| 879 |
+
publisher output
|
| 880 |
+
}
|
| 881 |
+
if$
|
| 882 |
+
}
|
| 883 |
+
{ format.incoll.inproc.crossref output.nonnull
|
| 884 |
+
format.pages output
|
| 885 |
+
}
|
| 886 |
+
if$
|
| 887 |
+
format.isbn output
|
| 888 |
+
format.doi output
|
| 889 |
+
format.url output
|
| 890 |
+
new.block
|
| 891 |
+
note output
|
| 892 |
+
fin.entry
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
FUNCTION {conference} { inproceedings }
|
| 896 |
+
|
| 897 |
+
FUNCTION {manual}
|
| 898 |
+
{ output.bibitem
|
| 899 |
+
format.authors output
|
| 900 |
+
author format.key output
|
| 901 |
+
new.block
|
| 902 |
+
format.btitle "title" output.check
|
| 903 |
+
organization address new.block.checkb
|
| 904 |
+
organization output
|
| 905 |
+
address output
|
| 906 |
+
format.edition output
|
| 907 |
+
format.date output
|
| 908 |
+
format.url output
|
| 909 |
+
new.block
|
| 910 |
+
note output
|
| 911 |
+
fin.entry
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
FUNCTION {mastersthesis}
|
| 915 |
+
{ output.bibitem
|
| 916 |
+
format.authors "author" output.check
|
| 917 |
+
author format.key output
|
| 918 |
+
new.block
|
| 919 |
+
format.title "title" output.check
|
| 920 |
+
new.block
|
| 921 |
+
"Master's thesis" format.thesis.type output.nonnull
|
| 922 |
+
school "school" output.check
|
| 923 |
+
address output
|
| 924 |
+
format.date "year" output.check
|
| 925 |
+
format.url output
|
| 926 |
+
new.block
|
| 927 |
+
note output
|
| 928 |
+
fin.entry
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
FUNCTION {misc}
|
| 932 |
+
{ output.bibitem
|
| 933 |
+
format.authors output
|
| 934 |
+
author format.key output
|
| 935 |
+
title howpublished new.block.checkb
|
| 936 |
+
format.title output
|
| 937 |
+
howpublished new.block.checka
|
| 938 |
+
howpublished output
|
| 939 |
+
format.date output
|
| 940 |
+
format.issn output
|
| 941 |
+
format.url output
|
| 942 |
+
new.block
|
| 943 |
+
note output
|
| 944 |
+
fin.entry
|
| 945 |
+
empty.misc.check
|
| 946 |
+
}
|
| 947 |
+
|
| 948 |
+
FUNCTION {phdthesis}
|
| 949 |
+
{ output.bibitem
|
| 950 |
+
format.authors "author" output.check
|
| 951 |
+
author format.key output
|
| 952 |
+
new.block
|
| 953 |
+
format.btitle "title" output.check
|
| 954 |
+
new.block
|
| 955 |
+
"PhD thesis" format.thesis.type output.nonnull
|
| 956 |
+
school "school" output.check
|
| 957 |
+
address output
|
| 958 |
+
format.date "year" output.check
|
| 959 |
+
format.url output
|
| 960 |
+
new.block
|
| 961 |
+
note output
|
| 962 |
+
fin.entry
|
| 963 |
+
}
|
| 964 |
+
|
| 965 |
+
FUNCTION {proceedings}
|
| 966 |
+
{ output.bibitem
|
| 967 |
+
format.editors output
|
| 968 |
+
editor format.key output
|
| 969 |
+
new.block
|
| 970 |
+
format.btitle "title" output.check
|
| 971 |
+
format.bvolume output
|
| 972 |
+
format.number.series output
|
| 973 |
+
address output
|
| 974 |
+
format.date "year" output.check
|
| 975 |
+
new.sentence
|
| 976 |
+
organization output
|
| 977 |
+
publisher output
|
| 978 |
+
format.isbn output
|
| 979 |
+
format.doi output
|
| 980 |
+
format.url output
|
| 981 |
+
new.block
|
| 982 |
+
note output
|
| 983 |
+
fin.entry
|
| 984 |
+
}
|
| 985 |
+
|
| 986 |
+
FUNCTION {techreport}
|
| 987 |
+
{ output.bibitem
|
| 988 |
+
format.authors "author" output.check
|
| 989 |
+
author format.key output
|
| 990 |
+
new.block
|
| 991 |
+
format.title "title" output.check
|
| 992 |
+
new.block
|
| 993 |
+
format.tr.number output.nonnull
|
| 994 |
+
institution "institution" output.check
|
| 995 |
+
address output
|
| 996 |
+
format.date "year" output.check
|
| 997 |
+
format.url output
|
| 998 |
+
new.block
|
| 999 |
+
note output
|
| 1000 |
+
fin.entry
|
| 1001 |
+
}
|
| 1002 |
+
|
| 1003 |
+
FUNCTION {unpublished}
|
| 1004 |
+
{ output.bibitem
|
| 1005 |
+
format.authors "author" output.check
|
| 1006 |
+
author format.key output
|
| 1007 |
+
new.block
|
| 1008 |
+
format.title "title" output.check
|
| 1009 |
+
new.block
|
| 1010 |
+
note "note" output.check
|
| 1011 |
+
format.date output
|
| 1012 |
+
format.url output
|
| 1013 |
+
fin.entry
|
| 1014 |
+
}
|
| 1015 |
+
|
| 1016 |
+
FUNCTION {default.type} { misc }
|
| 1017 |
+
|
| 1018 |
+
|
| 1019 |
+
MACRO {jan} {"January"}
|
| 1020 |
+
|
| 1021 |
+
MACRO {feb} {"February"}
|
| 1022 |
+
|
| 1023 |
+
MACRO {mar} {"March"}
|
| 1024 |
+
|
| 1025 |
+
MACRO {apr} {"April"}
|
| 1026 |
+
|
| 1027 |
+
MACRO {may} {"May"}
|
| 1028 |
+
|
| 1029 |
+
MACRO {jun} {"June"}
|
| 1030 |
+
|
| 1031 |
+
MACRO {jul} {"July"}
|
| 1032 |
+
|
| 1033 |
+
MACRO {aug} {"August"}
|
| 1034 |
+
|
| 1035 |
+
MACRO {sep} {"September"}
|
| 1036 |
+
|
| 1037 |
+
MACRO {oct} {"October"}
|
| 1038 |
+
|
| 1039 |
+
MACRO {nov} {"November"}
|
| 1040 |
+
|
| 1041 |
+
MACRO {dec} {"December"}
|
| 1042 |
+
|
| 1043 |
+
|
| 1044 |
+
|
| 1045 |
+
MACRO {acmcs} {"ACM Computing Surveys"}
|
| 1046 |
+
|
| 1047 |
+
MACRO {acta} {"Acta Informatica"}
|
| 1048 |
+
|
| 1049 |
+
MACRO {cacm} {"Communications of the ACM"}
|
| 1050 |
+
|
| 1051 |
+
MACRO {ibmjrd} {"IBM Journal of Research and Development"}
|
| 1052 |
+
|
| 1053 |
+
MACRO {ibmsj} {"IBM Systems Journal"}
|
| 1054 |
+
|
| 1055 |
+
MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
|
| 1056 |
+
|
| 1057 |
+
MACRO {ieeetc} {"IEEE Transactions on Computers"}
|
| 1058 |
+
|
| 1059 |
+
MACRO {ieeetcad}
|
| 1060 |
+
{"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
|
| 1061 |
+
|
| 1062 |
+
MACRO {ipl} {"Information Processing Letters"}
|
| 1063 |
+
|
| 1064 |
+
MACRO {jacm} {"Journal of the ACM"}
|
| 1065 |
+
|
| 1066 |
+
MACRO {jcss} {"Journal of Computer and System Sciences"}
|
| 1067 |
+
|
| 1068 |
+
MACRO {scp} {"Science of Computer Programming"}
|
| 1069 |
+
|
| 1070 |
+
MACRO {sicomp} {"SIAM Journal on Computing"}
|
| 1071 |
+
|
| 1072 |
+
MACRO {tocs} {"ACM Transactions on Computer Systems"}
|
| 1073 |
+
|
| 1074 |
+
MACRO {tods} {"ACM Transactions on Database Systems"}
|
| 1075 |
+
|
| 1076 |
+
MACRO {tog} {"ACM Transactions on Graphics"}
|
| 1077 |
+
|
| 1078 |
+
MACRO {toms} {"ACM Transactions on Mathematical Software"}
|
| 1079 |
+
|
| 1080 |
+
MACRO {toois} {"ACM Transactions on Office Information Systems"}
|
| 1081 |
+
|
| 1082 |
+
MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
|
| 1083 |
+
|
| 1084 |
+
MACRO {tcs} {"Theoretical Computer Science"}
|
| 1085 |
+
|
| 1086 |
+
|
| 1087 |
+
READ
|
| 1088 |
+
|
| 1089 |
+
FUNCTION {sortify}
|
| 1090 |
+
{ purify$
|
| 1091 |
+
"l" change.case$
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
INTEGERS { len }
|
| 1095 |
+
|
| 1096 |
+
FUNCTION {chop.word}
|
| 1097 |
+
{ 's :=
|
| 1098 |
+
'len :=
|
| 1099 |
+
s #1 len substring$ =
|
| 1100 |
+
{ s len #1 + global.max$ substring$ }
|
| 1101 |
+
's
|
| 1102 |
+
if$
|
| 1103 |
+
}
|
| 1104 |
+
|
| 1105 |
+
FUNCTION {format.lab.names}
|
| 1106 |
+
{ 's :=
|
| 1107 |
+
s #1 "{vv~}{ll}" format.name$
|
| 1108 |
+
s num.names$ duplicate$
|
| 1109 |
+
#2 >
|
| 1110 |
+
{ pop$ " et~al." * }
|
| 1111 |
+
{ #2 <
|
| 1112 |
+
'skip$
|
| 1113 |
+
{ s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
|
| 1114 |
+
{ " et~al." * }
|
| 1115 |
+
{ " \& " * s #2 "{vv~}{ll}" format.name$ * }
|
| 1116 |
+
if$
|
| 1117 |
+
}
|
| 1118 |
+
if$
|
| 1119 |
+
}
|
| 1120 |
+
if$
|
| 1121 |
+
}
|
| 1122 |
+
|
| 1123 |
+
FUNCTION {author.key.label}
|
| 1124 |
+
{ author empty$
|
| 1125 |
+
{ key empty$
|
| 1126 |
+
{ cite$ #1 #3 substring$ }
|
| 1127 |
+
'key
|
| 1128 |
+
if$
|
| 1129 |
+
}
|
| 1130 |
+
{ author format.lab.names }
|
| 1131 |
+
if$
|
| 1132 |
+
}
|
| 1133 |
+
|
| 1134 |
+
FUNCTION {author.editor.key.label}
|
| 1135 |
+
{ author empty$
|
| 1136 |
+
{ editor empty$
|
| 1137 |
+
{ key empty$
|
| 1138 |
+
{ cite$ #1 #3 substring$ }
|
| 1139 |
+
'key
|
| 1140 |
+
if$
|
| 1141 |
+
}
|
| 1142 |
+
{ editor format.lab.names }
|
| 1143 |
+
if$
|
| 1144 |
+
}
|
| 1145 |
+
{ author format.lab.names }
|
| 1146 |
+
if$
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
FUNCTION {author.key.organization.label}
|
| 1150 |
+
{ author empty$
|
| 1151 |
+
{ key empty$
|
| 1152 |
+
{ organization empty$
|
| 1153 |
+
{ cite$ #1 #3 substring$ }
|
| 1154 |
+
{ "The " #4 organization chop.word #3 text.prefix$ }
|
| 1155 |
+
if$
|
| 1156 |
+
}
|
| 1157 |
+
'key
|
| 1158 |
+
if$
|
| 1159 |
+
}
|
| 1160 |
+
{ author format.lab.names }
|
| 1161 |
+
if$
|
| 1162 |
+
}
|
| 1163 |
+
|
| 1164 |
+
FUNCTION {editor.key.organization.label}
|
| 1165 |
+
{ editor empty$
|
| 1166 |
+
{ key empty$
|
| 1167 |
+
{ organization empty$
|
| 1168 |
+
{ cite$ #1 #3 substring$ }
|
| 1169 |
+
{ "The " #4 organization chop.word #3 text.prefix$ }
|
| 1170 |
+
if$
|
| 1171 |
+
}
|
| 1172 |
+
'key
|
| 1173 |
+
if$
|
| 1174 |
+
}
|
| 1175 |
+
{ editor format.lab.names }
|
| 1176 |
+
if$
|
| 1177 |
+
}
|
| 1178 |
+
|
| 1179 |
+
FUNCTION {calc.short.authors}
|
| 1180 |
+
{ type$ "book" =
|
| 1181 |
+
type$ "inbook" =
|
| 1182 |
+
or
|
| 1183 |
+
'author.editor.key.label
|
| 1184 |
+
{ type$ "proceedings" =
|
| 1185 |
+
'editor.key.organization.label
|
| 1186 |
+
{ type$ "manual" =
|
| 1187 |
+
'author.key.organization.label
|
| 1188 |
+
'author.key.label
|
| 1189 |
+
if$
|
| 1190 |
+
}
|
| 1191 |
+
if$
|
| 1192 |
+
}
|
| 1193 |
+
if$
|
| 1194 |
+
'short.list :=
|
| 1195 |
+
}
|
| 1196 |
+
|
| 1197 |
+
FUNCTION {calc.label}
|
| 1198 |
+
{ calc.short.authors
|
| 1199 |
+
short.list
|
| 1200 |
+
"("
|
| 1201 |
+
*
|
| 1202 |
+
year duplicate$ empty$
|
| 1203 |
+
short.list key field.or.null = or
|
| 1204 |
+
{ pop$ "" }
|
| 1205 |
+
'skip$
|
| 1206 |
+
if$
|
| 1207 |
+
*
|
| 1208 |
+
'label :=
|
| 1209 |
+
}
|
| 1210 |
+
|
| 1211 |
+
FUNCTION {sort.format.names}
|
| 1212 |
+
{ 's :=
|
| 1213 |
+
#1 'nameptr :=
|
| 1214 |
+
""
|
| 1215 |
+
s num.names$ 'numnames :=
|
| 1216 |
+
numnames 'namesleft :=
|
| 1217 |
+
{ namesleft #0 > }
|
| 1218 |
+
{
|
| 1219 |
+
s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
|
| 1220 |
+
nameptr #1 >
|
| 1221 |
+
{
|
| 1222 |
+
" " *
|
| 1223 |
+
namesleft #1 = t "others" = and
|
| 1224 |
+
{ "zzzzz" * }
|
| 1225 |
+
{ numnames #2 > nameptr #2 = and
|
| 1226 |
+
{ "zz" * year field.or.null * " " * }
|
| 1227 |
+
'skip$
|
| 1228 |
+
if$
|
| 1229 |
+
t sortify *
|
| 1230 |
+
}
|
| 1231 |
+
if$
|
| 1232 |
+
}
|
| 1233 |
+
{ t sortify * }
|
| 1234 |
+
if$
|
| 1235 |
+
nameptr #1 + 'nameptr :=
|
| 1236 |
+
namesleft #1 - 'namesleft :=
|
| 1237 |
+
}
|
| 1238 |
+
while$
|
| 1239 |
+
}
|
| 1240 |
+
|
| 1241 |
+
FUNCTION {sort.format.title}
|
| 1242 |
+
{ 't :=
|
| 1243 |
+
"A " #2
|
| 1244 |
+
"An " #3
|
| 1245 |
+
"The " #4 t chop.word
|
| 1246 |
+
chop.word
|
| 1247 |
+
chop.word
|
| 1248 |
+
sortify
|
| 1249 |
+
#1 global.max$ substring$
|
| 1250 |
+
}
|
| 1251 |
+
|
| 1252 |
+
FUNCTION {author.sort}
|
| 1253 |
+
{ author empty$
|
| 1254 |
+
{ key empty$
|
| 1255 |
+
{ "to sort, need author or key in " cite$ * warning$
|
| 1256 |
+
""
|
| 1257 |
+
}
|
| 1258 |
+
{ key sortify }
|
| 1259 |
+
if$
|
| 1260 |
+
}
|
| 1261 |
+
{ author sort.format.names }
|
| 1262 |
+
if$
|
| 1263 |
+
}
|
| 1264 |
+
|
| 1265 |
+
FUNCTION {author.editor.sort}
|
| 1266 |
+
{ author empty$
|
| 1267 |
+
{ editor empty$
|
| 1268 |
+
{ key empty$
|
| 1269 |
+
{ "to sort, need author, editor, or key in " cite$ * warning$
|
| 1270 |
+
""
|
| 1271 |
+
}
|
| 1272 |
+
{ key sortify }
|
| 1273 |
+
if$
|
| 1274 |
+
}
|
| 1275 |
+
{ editor sort.format.names }
|
| 1276 |
+
if$
|
| 1277 |
+
}
|
| 1278 |
+
{ author sort.format.names }
|
| 1279 |
+
if$
|
| 1280 |
+
}
|
| 1281 |
+
|
| 1282 |
+
FUNCTION {author.organization.sort}
|
| 1283 |
+
{ author empty$
|
| 1284 |
+
{ organization empty$
|
| 1285 |
+
{ key empty$
|
| 1286 |
+
{ "to sort, need author, organization, or key in " cite$ * warning$
|
| 1287 |
+
""
|
| 1288 |
+
}
|
| 1289 |
+
{ key sortify }
|
| 1290 |
+
if$
|
| 1291 |
+
}
|
| 1292 |
+
{ "The " #4 organization chop.word sortify }
|
| 1293 |
+
if$
|
| 1294 |
+
}
|
| 1295 |
+
{ author sort.format.names }
|
| 1296 |
+
if$
|
| 1297 |
+
}
|
| 1298 |
+
|
| 1299 |
+
FUNCTION {editor.organization.sort}
|
| 1300 |
+
{ editor empty$
|
| 1301 |
+
{ organization empty$
|
| 1302 |
+
{ key empty$
|
| 1303 |
+
{ "to sort, need editor, organization, or key in " cite$ * warning$
|
| 1304 |
+
""
|
| 1305 |
+
}
|
| 1306 |
+
{ key sortify }
|
| 1307 |
+
if$
|
| 1308 |
+
}
|
| 1309 |
+
{ "The " #4 organization chop.word sortify }
|
| 1310 |
+
if$
|
| 1311 |
+
}
|
| 1312 |
+
{ editor sort.format.names }
|
| 1313 |
+
if$
|
| 1314 |
+
}
|
| 1315 |
+
|
| 1316 |
+
|
| 1317 |
+
FUNCTION {presort}
|
| 1318 |
+
{ calc.label
|
| 1319 |
+
label sortify
|
| 1320 |
+
" "
|
| 1321 |
+
*
|
| 1322 |
+
type$ "book" =
|
| 1323 |
+
type$ "inbook" =
|
| 1324 |
+
or
|
| 1325 |
+
'author.editor.sort
|
| 1326 |
+
{ type$ "proceedings" =
|
| 1327 |
+
'editor.organization.sort
|
| 1328 |
+
{ type$ "manual" =
|
| 1329 |
+
'author.organization.sort
|
| 1330 |
+
'author.sort
|
| 1331 |
+
if$
|
| 1332 |
+
}
|
| 1333 |
+
if$
|
| 1334 |
+
}
|
| 1335 |
+
if$
|
| 1336 |
+
" "
|
| 1337 |
+
*
|
| 1338 |
+
year field.or.null sortify
|
| 1339 |
+
*
|
| 1340 |
+
" "
|
| 1341 |
+
*
|
| 1342 |
+
cite$
|
| 1343 |
+
*
|
| 1344 |
+
#1 entry.max$ substring$
|
| 1345 |
+
'sort.label :=
|
| 1346 |
+
sort.label *
|
| 1347 |
+
#1 entry.max$ substring$
|
| 1348 |
+
'sort.key$ :=
|
| 1349 |
+
}
|
| 1350 |
+
|
| 1351 |
+
ITERATE {presort}
|
| 1352 |
+
|
| 1353 |
+
SORT
|
| 1354 |
+
|
| 1355 |
+
STRINGS { longest.label last.label next.extra }
|
| 1356 |
+
|
| 1357 |
+
INTEGERS { longest.label.width last.extra.num number.label }
|
| 1358 |
+
|
| 1359 |
+
FUNCTION {initialize.longest.label}
|
| 1360 |
+
{ "" 'longest.label :=
|
| 1361 |
+
#0 int.to.chr$ 'last.label :=
|
| 1362 |
+
"" 'next.extra :=
|
| 1363 |
+
#0 'longest.label.width :=
|
| 1364 |
+
#0 'last.extra.num :=
|
| 1365 |
+
#0 'number.label :=
|
| 1366 |
+
}
|
| 1367 |
+
|
| 1368 |
+
FUNCTION {forward.pass}
|
| 1369 |
+
{ last.label label =
|
| 1370 |
+
{ last.extra.num #1 + 'last.extra.num :=
|
| 1371 |
+
last.extra.num int.to.chr$ 'extra.label :=
|
| 1372 |
+
}
|
| 1373 |
+
{ "a" chr.to.int$ 'last.extra.num :=
|
| 1374 |
+
"" 'extra.label :=
|
| 1375 |
+
label 'last.label :=
|
| 1376 |
+
}
|
| 1377 |
+
if$
|
| 1378 |
+
number.label #1 + 'number.label :=
|
| 1379 |
+
}
|
| 1380 |
+
|
| 1381 |
+
FUNCTION {reverse.pass}
|
| 1382 |
+
{ next.extra "b" =
|
| 1383 |
+
{ "a" 'extra.label := }
|
| 1384 |
+
'skip$
|
| 1385 |
+
if$
|
| 1386 |
+
extra.label 'next.extra :=
|
| 1387 |
+
extra.label
|
| 1388 |
+
duplicate$ empty$
|
| 1389 |
+
'skip$
|
| 1390 |
+
{ "{\natexlab{" swap$ * "}}" * }
|
| 1391 |
+
if$
|
| 1392 |
+
'extra.label :=
|
| 1393 |
+
label extra.label * 'label :=
|
| 1394 |
+
}
|
| 1395 |
+
|
| 1396 |
+
EXECUTE {initialize.longest.label}
|
| 1397 |
+
|
| 1398 |
+
ITERATE {forward.pass}
|
| 1399 |
+
|
| 1400 |
+
REVERSE {reverse.pass}
|
| 1401 |
+
|
| 1402 |
+
FUNCTION {bib.sort.order}
|
| 1403 |
+
{ sort.label 'sort.key$ :=
|
| 1404 |
+
}
|
| 1405 |
+
|
| 1406 |
+
ITERATE {bib.sort.order}
|
| 1407 |
+
|
| 1408 |
+
SORT
|
| 1409 |
+
|
| 1410 |
+
FUNCTION {begin.bib}
|
| 1411 |
+
{ preamble$ empty$
|
| 1412 |
+
'skip$
|
| 1413 |
+
{ preamble$ write$ newline$ }
|
| 1414 |
+
if$
|
| 1415 |
+
"\begin{thebibliography}{" number.label int.to.str$ * "}" *
|
| 1416 |
+
write$ newline$
|
| 1417 |
+
"\providecommand{\natexlab}[1]{#1}"
|
| 1418 |
+
write$ newline$
|
| 1419 |
+
"\providecommand{\url}[1]{\texttt{#1}}"
|
| 1420 |
+
write$ newline$
|
| 1421 |
+
"\expandafter\ifx\csname urlstyle\endcsname\relax"
|
| 1422 |
+
write$ newline$
|
| 1423 |
+
" \providecommand{\doi}[1]{doi: #1}\else"
|
| 1424 |
+
write$ newline$
|
| 1425 |
+
" \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
|
| 1426 |
+
write$ newline$
|
| 1427 |
+
}
|
| 1428 |
+
|
| 1429 |
+
EXECUTE {begin.bib}
|
| 1430 |
+
|
| 1431 |
+
EXECUTE {init.state.consts}
|
| 1432 |
+
|
| 1433 |
+
ITERATE {call.type$}
|
| 1434 |
+
|
| 1435 |
+
FUNCTION {end.bib}
|
| 1436 |
+
{ newline$
|
| 1437 |
+
"\end{thebibliography}" write$ newline$
|
| 1438 |
+
}
|
| 1439 |
+
|
| 1440 |
+
EXECUTE {end.bib}
|
gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.sty
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%%%% ICLR Macros (LaTex)
|
| 2 |
+
%%%% Adapted by Hugo Larochelle from the NIPS stylefile Macros
|
| 3 |
+
%%%% Style File
|
| 4 |
+
%%%% Dec 12, 1990 Rev Aug 14, 1991; Sept, 1995; April, 1997; April, 1999; October 2014
|
| 5 |
+
|
| 6 |
+
% This file can be used with Latex2e whether running in main mode, or
|
| 7 |
+
% 2.09 compatibility mode.
|
| 8 |
+
%
|
| 9 |
+
% If using main mode, you need to include the commands
|
| 10 |
+
% \documentclass{article}
|
| 11 |
+
% \usepackage{iclr14submit_e,times}
|
| 12 |
+
%
|
| 13 |
+
|
| 14 |
+
% Change the overall width of the page. If these parameters are
|
| 15 |
+
% changed, they will require corresponding changes in the
|
| 16 |
+
% maketitle section.
|
| 17 |
+
%
|
| 18 |
+
\usepackage{eso-pic} % used by \AddToShipoutPicture
|
| 19 |
+
\RequirePackage{fancyhdr}
|
| 20 |
+
\RequirePackage{natbib}
|
| 21 |
+
|
| 22 |
+
% modification to natbib citations
|
| 23 |
+
\setcitestyle{authoryear,round,citesep={;},aysep={,},yysep={;}}
|
| 24 |
+
|
| 25 |
+
\renewcommand{\topfraction}{0.95} % let figure take up nearly whole page
|
| 26 |
+
\renewcommand{\textfraction}{0.05} % let figure take up nearly whole page
|
| 27 |
+
|
| 28 |
+
% Define iclrfinal, set to true if iclrfinalcopy is defined
|
| 29 |
+
\newif\ificlrfinal
|
| 30 |
+
\iclrfinalfalse
|
| 31 |
+
\def\iclrfinalcopy{\iclrfinaltrue}
|
| 32 |
+
\font\iclrtenhv = phvb at 8pt
|
| 33 |
+
|
| 34 |
+
% Specify the dimensions of each page
|
| 35 |
+
|
| 36 |
+
\setlength{\paperheight}{11in}
|
| 37 |
+
\setlength{\paperwidth}{8.5in}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
\oddsidemargin .5in % Note \oddsidemargin = \evensidemargin
|
| 41 |
+
\evensidemargin .5in
|
| 42 |
+
\marginparwidth 0.07 true in
|
| 43 |
+
%\marginparwidth 0.75 true in
|
| 44 |
+
%\topmargin 0 true pt % Nominal distance from top of page to top of
|
| 45 |
+
%\topmargin 0.125in
|
| 46 |
+
\topmargin -0.625in
|
| 47 |
+
\addtolength{\headsep}{0.25in}
|
| 48 |
+
\textheight 9.0 true in % Height of text (including footnotes & figures)
|
| 49 |
+
\textwidth 5.5 true in % Width of text line.
|
| 50 |
+
\widowpenalty=10000
|
| 51 |
+
\clubpenalty=10000
|
| 52 |
+
|
| 53 |
+
% \thispagestyle{empty} \pagestyle{empty}
|
| 54 |
+
\flushbottom \sloppy
|
| 55 |
+
|
| 56 |
+
% We're never going to need a table of contents, so just flush it to
|
| 57 |
+
% save space --- suggested by drstrip@sandia-2
|
| 58 |
+
\def\addcontentsline#1#2#3{}
|
| 59 |
+
|
| 60 |
+
% Title stuff, taken from deproc.
|
| 61 |
+
\def\maketitle{\par
|
| 62 |
+
\begingroup
|
| 63 |
+
\def\thefootnote{\fnsymbol{footnote}}
|
| 64 |
+
\def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}} % for perfect author
|
| 65 |
+
% name centering
|
| 66 |
+
% The footnote-mark was overlapping the footnote-text,
|
| 67 |
+
% added the following to fix this problem (MK)
|
| 68 |
+
\long\def\@makefntext##1{\parindent 1em\noindent
|
| 69 |
+
\hbox to1.8em{\hss $\m@th ^{\@thefnmark}$}##1}
|
| 70 |
+
\@maketitle \@thanks
|
| 71 |
+
\endgroup
|
| 72 |
+
\setcounter{footnote}{0}
|
| 73 |
+
\let\maketitle\relax \let\@maketitle\relax
|
| 74 |
+
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax}
|
| 75 |
+
|
| 76 |
+
% The toptitlebar has been raised to top-justify the first page
|
| 77 |
+
|
| 78 |
+
\usepackage{fancyhdr}
|
| 79 |
+
\pagestyle{fancy}
|
| 80 |
+
\fancyhead{}
|
| 81 |
+
|
| 82 |
+
% Title (includes both anonimized and non-anonimized versions)
|
| 83 |
+
\def\@maketitle{\vbox{\hsize\textwidth
|
| 84 |
+
%\linewidth\hsize \vskip 0.1in \toptitlebar \centering
|
| 85 |
+
{\LARGE\sc \@title\par}
|
| 86 |
+
%\bottomtitlebar % \vskip 0.1in % minus
|
| 87 |
+
\ificlrfinal
|
| 88 |
+
\lhead{Published as a conference paper at ICLR 2026}
|
| 89 |
+
\def\And{\end{tabular}\hfil\linebreak[0]\hfil
|
| 90 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}\ignorespaces}%
|
| 91 |
+
\def\AND{\end{tabular}\hfil\linebreak[4]\hfil
|
| 92 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}\ignorespaces}%
|
| 93 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}\@author\end{tabular}%
|
| 94 |
+
\else
|
| 95 |
+
\lhead{Under review as a conference paper at ICLR 2026}
|
| 96 |
+
\def\And{\end{tabular}\hfil\linebreak[0]\hfil
|
| 97 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}\ignorespaces}%
|
| 98 |
+
\def\AND{\end{tabular}\hfil\linebreak[4]\hfil
|
| 99 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}\ignorespaces}%
|
| 100 |
+
\begin{tabular}[t]{l}\bf\rule{\z@}{24pt}Anonymous authors\\Paper under double-blind review\end{tabular}%
|
| 101 |
+
\fi
|
| 102 |
+
\vskip 0.3in minus 0.1in}}
|
| 103 |
+
|
| 104 |
+
\renewenvironment{abstract}{\vskip.075in\centerline{\large\sc
|
| 105 |
+
Abstract}\vspace{0.5ex}\begin{quote}}{\par\end{quote}\vskip 1ex}
|
| 106 |
+
|
| 107 |
+
% sections with less space
|
| 108 |
+
\def\section{\@startsection {section}{1}{\z@}{-2.0ex plus
|
| 109 |
+
-0.5ex minus -.2ex}{1.5ex plus 0.3ex
|
| 110 |
+
minus0.2ex}{\large\sc\raggedright}}
|
| 111 |
+
|
| 112 |
+
\def\subsection{\@startsection{subsection}{2}{\z@}{-1.8ex plus
|
| 113 |
+
-0.5ex minus -.2ex}{0.8ex plus .2ex}{\normalsize\sc\raggedright}}
|
| 114 |
+
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-1.5ex
|
| 115 |
+
plus -0.5ex minus -.2ex}{0.5ex plus
|
| 116 |
+
.2ex}{\normalsize\sc\raggedright}}
|
| 117 |
+
\def\paragraph{\@startsection{paragraph}{4}{\z@}{1.5ex plus
|
| 118 |
+
0.5ex minus .2ex}{-1em}{\normalsize\bf}}
|
| 119 |
+
\def\subparagraph{\@startsection{subparagraph}{5}{\z@}{1.5ex plus
|
| 120 |
+
0.5ex minus .2ex}{-1em}{\normalsize\sc}}
|
| 121 |
+
\def\subsubsubsection{\vskip
|
| 122 |
+
5pt{\noindent\normalsize\rm\raggedright}}
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
% Footnotes
|
| 126 |
+
\footnotesep 6.65pt %
|
| 127 |
+
\skip\footins 9pt plus 4pt minus 2pt
|
| 128 |
+
\def\footnoterule{\kern-3pt \hrule width 12pc \kern 2.6pt }
|
| 129 |
+
\setcounter{footnote}{0}
|
| 130 |
+
|
| 131 |
+
% Lists and paragraphs
|
| 132 |
+
\parindent 0pt
|
| 133 |
+
\topsep 4pt plus 1pt minus 2pt
|
| 134 |
+
\partopsep 1pt plus 0.5pt minus 0.5pt
|
| 135 |
+
\itemsep 2pt plus 1pt minus 0.5pt
|
| 136 |
+
\parsep 2pt plus 1pt minus 0.5pt
|
| 137 |
+
\parskip .5pc
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
%\leftmargin2em
|
| 141 |
+
\leftmargin3pc
|
| 142 |
+
\leftmargini\leftmargin \leftmarginii 2em
|
| 143 |
+
\leftmarginiii 1.5em \leftmarginiv 1.0em \leftmarginv .5em
|
| 144 |
+
|
| 145 |
+
%\labelsep \labelsep 5pt
|
| 146 |
+
|
| 147 |
+
\def\@listi{\leftmargin\leftmargini}
|
| 148 |
+
\def\@listii{\leftmargin\leftmarginii
|
| 149 |
+
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
|
| 150 |
+
\topsep 2pt plus 1pt minus 0.5pt
|
| 151 |
+
\parsep 1pt plus 0.5pt minus 0.5pt
|
| 152 |
+
\itemsep \parsep}
|
| 153 |
+
\def\@listiii{\leftmargin\leftmarginiii
|
| 154 |
+
\labelwidth\leftmarginiii\advance\labelwidth-\labelsep
|
| 155 |
+
\topsep 1pt plus 0.5pt minus 0.5pt
|
| 156 |
+
\parsep \z@ \partopsep 0.5pt plus 0pt minus 0.5pt
|
| 157 |
+
\itemsep \topsep}
|
| 158 |
+
\def\@listiv{\leftmargin\leftmarginiv
|
| 159 |
+
\labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
|
| 160 |
+
\def\@listv{\leftmargin\leftmarginv
|
| 161 |
+
\labelwidth\leftmarginv\advance\labelwidth-\labelsep}
|
| 162 |
+
\def\@listvi{\leftmargin\leftmarginvi
|
| 163 |
+
\labelwidth\leftmarginvi\advance\labelwidth-\labelsep}
|
| 164 |
+
|
| 165 |
+
\abovedisplayskip 7pt plus2pt minus5pt%
|
| 166 |
+
\belowdisplayskip \abovedisplayskip
|
| 167 |
+
\abovedisplayshortskip 0pt plus3pt%
|
| 168 |
+
\belowdisplayshortskip 4pt plus3pt minus3pt%
|
| 169 |
+
|
| 170 |
+
% Less leading in most fonts (due to the narrow columns)
|
| 171 |
+
% The choices were between 1-pt and 1.5-pt leading
|
| 172 |
+
%\def\@normalsize{\@setsize\normalsize{11pt}\xpt\@xpt} % got rid of @ (MK)
|
| 173 |
+
\def\normalsize{\@setsize\normalsize{11pt}\xpt\@xpt}
|
| 174 |
+
\def\small{\@setsize\small{10pt}\ixpt\@ixpt}
|
| 175 |
+
\def\footnotesize{\@setsize\footnotesize{10pt}\ixpt\@ixpt}
|
| 176 |
+
\def\scriptsize{\@setsize\scriptsize{8pt}\viipt\@viipt}
|
| 177 |
+
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
|
| 178 |
+
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
|
| 179 |
+
\def\Large{\@setsize\Large{16pt}\xivpt\@xivpt}
|
| 180 |
+
\def\LARGE{\@setsize\LARGE{20pt}\xviipt\@xviipt}
|
| 181 |
+
\def\huge{\@setsize\huge{23pt}\xxpt\@xxpt}
|
| 182 |
+
\def\Huge{\@setsize\Huge{28pt}\xxvpt\@xxvpt}
|
| 183 |
+
|
| 184 |
+
\def\toptitlebar{\hrule height4pt\vskip .25in\vskip-\parskip}
|
| 185 |
+
|
| 186 |
+
\def\bottomtitlebar{\vskip .29in\vskip-\parskip\hrule height1pt\vskip
|
| 187 |
+
.09in} %
|
| 188 |
+
%Reduced second vskip to compensate for adding the strut in \@author
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
%% % Vertical Ruler
|
| 193 |
+
%% % This code is, largely, from the CVPR 2010 conference style file
|
| 194 |
+
%% % ----- define vruler
|
| 195 |
+
\makeatletter
|
| 196 |
+
\newbox\iclrrulerbox
|
| 197 |
+
\newcount\iclrrulercount
|
| 198 |
+
\newdimen\iclrruleroffset
|
| 199 |
+
\newdimen\cv@lineheight
|
| 200 |
+
\newdimen\cv@boxheight
|
| 201 |
+
\newbox\cv@tmpbox
|
| 202 |
+
\newcount\cv@refno
|
| 203 |
+
\newcount\cv@tot
|
| 204 |
+
% NUMBER with left flushed zeros \fillzeros[<WIDTH>]<NUMBER>
|
| 205 |
+
\newcount\cv@tmpc@ \newcount\cv@tmpc
|
| 206 |
+
\def\fillzeros[#1]#2{\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi
|
| 207 |
+
\cv@tmpc=1 %
|
| 208 |
+
\loop\ifnum\cv@tmpc@<10 \else \divide\cv@tmpc@ by 10 \advance\cv@tmpc by 1 \fi
|
| 209 |
+
\ifnum\cv@tmpc@=10\relax\cv@tmpc@=11\relax\fi \ifnum\cv@tmpc@>10 \repeat
|
| 210 |
+
\ifnum#2<0\advance\cv@tmpc1\relax-\fi
|
| 211 |
+
\loop\ifnum\cv@tmpc<#1\relax0\advance\cv@tmpc1\relax\fi \ifnum\cv@tmpc<#1 \repeat
|
| 212 |
+
\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi \relax\the\cv@tmpc@}%
|
| 213 |
+
% \makevruler[<SCALE>][<INITIAL_COUNT>][<STEP>][<DIGITS>][<HEIGHT>]
|
| 214 |
+
\def\makevruler[#1][#2][#3][#4][#5]{\begingroup\offinterlineskip
|
| 215 |
+
\textheight=#5\vbadness=10000\vfuzz=120ex\overfullrule=0pt%
|
| 216 |
+
\global\setbox\iclrrulerbox=\vbox to \textheight{%
|
| 217 |
+
{\parskip=0pt\hfuzz=150em\cv@boxheight=\textheight
|
| 218 |
+
\cv@lineheight=#1\global\iclrrulercount=#2%
|
| 219 |
+
\cv@tot\cv@boxheight\divide\cv@tot\cv@lineheight\advance\cv@tot2%
|
| 220 |
+
\cv@refno1\vskip-\cv@lineheight\vskip1ex%
|
| 221 |
+
\loop\setbox\cv@tmpbox=\hbox to0cm{{\iclrtenhv\hfil\fillzeros[#4]\iclrrulercount}}%
|
| 222 |
+
\ht\cv@tmpbox\cv@lineheight\dp\cv@tmpbox0pt\box\cv@tmpbox\break
|
| 223 |
+
\advance\cv@refno1\global\advance\iclrrulercount#3\relax
|
| 224 |
+
\ifnum\cv@refno<\cv@tot\repeat}}\endgroup}%
|
| 225 |
+
\makeatother
|
| 226 |
+
% ----- end of vruler
|
| 227 |
+
|
| 228 |
+
% \makevruler[<SCALE>][<INITIAL_COUNT>][<STEP>][<DIGITS>][<HEIGHT>]
|
| 229 |
+
\def\iclrruler#1{\makevruler[12pt][#1][1][3][0.993\textheight]\usebox{\iclrrulerbox}}
|
| 230 |
+
\AddToShipoutPicture{%
|
| 231 |
+
\ificlrfinal\else
|
| 232 |
+
\iclrruleroffset=\textheight
|
| 233 |
+
\advance\iclrruleroffset by -3.7pt
|
| 234 |
+
\color[rgb]{.7,.7,.7}
|
| 235 |
+
\AtTextUpperLeft{%
|
| 236 |
+
\put(\LenToUnit{-35pt},\LenToUnit{-\iclrruleroffset}){%left ruler
|
| 237 |
+
\iclrruler{\iclrrulercount}}
|
| 238 |
+
}
|
| 239 |
+
\fi
|
| 240 |
+
}
|
| 241 |
+
% %% To add a vertical bar on the side
|
| 242 |
+
% \AddToShipoutPicture{
|
| 243 |
+
% \AtTextLowerLeft{
|
| 244 |
+
% \hspace*{-1.8cm}
|
| 245 |
+
% \colorbox[rgb]{0.7,0.7,0.7}{\small \parbox[b][\textheight]{0.1cm}{}}}
|
| 246 |
+
% }
|
gmnet/project/gmnet_tpami/reference/source/iclr2026_conference.tex
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
\documentclass{article} % For LaTeX2e
|
| 3 |
+
\usepackage{iclr2026_conference,times}
|
| 4 |
+
|
| 5 |
+
% Optional math commands from https://github.com/goodfeli/dlbook_notation.
|
| 6 |
+
\input{math_commands.tex}
|
| 7 |
+
\usepackage{booktabs}
|
| 8 |
+
\usepackage{multirow}
|
| 9 |
+
\usepackage{hyperref}
|
| 10 |
+
\usepackage{url}
|
| 11 |
+
\usepackage{graphicx}
|
| 12 |
+
\usepackage{wrapfig}
|
| 13 |
+
\usepackage{algorithm}
|
| 14 |
+
\usepackage{algorithmic}
|
| 15 |
+
\usepackage{subcaption}
|
| 16 |
+
\newtheorem{theorem}{Theorem}
|
| 17 |
+
%\newtheorem{theorem}{Preliminary}
|
| 18 |
+
\newtheorem{definition}{Preliminary}
|
| 19 |
+
\newtheorem{lemma}[theorem]{Lemma}
|
| 20 |
+
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule, \cmidrule
|
| 21 |
+
\usepackage{soul}
|
| 22 |
+
\usepackage[table]{xcolor} % for \rowcolor
|
| 23 |
+
|
| 24 |
+
\title{GmNet: Revisiting Gating Mechanisms From A Frequency View}
|
| 25 |
+
|
| 26 |
+
% Authors must not appear in the submitted version. They should be hidden
|
| 27 |
+
% as long as the \iclrfinalcopy macro remains commented out below.
|
| 28 |
+
% Non-anonymous submissions will be rejected without review.
|
| 29 |
+
\iclrfinalcopy
|
| 30 |
+
|
| 31 |
+
% \author{Antiquus S.~Hippocampus, Natalia Cerebro \& Amelie P. Amygdale \\
|
| 32 |
+
% Department of Computer Science\\
|
| 33 |
+
% Cranberry-Lemon University\\
|
| 34 |
+
% Pittsburgh, PA 15213, USA \\
|
| 35 |
+
% \texttt{\{hippo,brain,jen\}@cs.cranberry-lemon.edu} \\
|
| 36 |
+
% \And
|
| 37 |
+
% Ji Q. Ren \& Yevgeny LeNet \\
|
| 38 |
+
% Department of Computational Neuroscience \\
|
| 39 |
+
% University of the Witwatersrand \\
|
| 40 |
+
% Joburg, South Africa \\
|
| 41 |
+
% \texttt{\{robot,net\}@wits.ac.za} \\
|
| 42 |
+
% \AND
|
| 43 |
+
% Coauthor \\
|
| 44 |
+
% Affiliation \\
|
| 45 |
+
% Address \\
|
| 46 |
+
% \texttt{email}
|
| 47 |
+
% }
|
| 48 |
+
\input{sec/author}
|
| 49 |
+
% The \author macro works with any number of authors. There are two commands
|
| 50 |
+
% used to separate the names and addresses of multiple authors: \And and \AND.
|
| 51 |
+
%
|
| 52 |
+
% Using \And between authors leaves it to \LaTeX{} to determine where to break
|
| 53 |
+
% the lines. Using \AND forces a linebreak at that point. So, if \LaTeX{}
|
| 54 |
+
% puts 3 of 4 authors names on the first line, and the last on the second
|
| 55 |
+
% line, try using \AND instead of \And before the third author name.
|
| 56 |
+
|
| 57 |
+
\newcommand{\fix}{\marginpar{FIX}}
|
| 58 |
+
\newcommand{\new}{\marginpar{NEW}}
|
| 59 |
+
|
| 60 |
+
%\iclrfinalcopy % Uncomment for camera-ready version, but NOT for submission.
|
| 61 |
+
\begin{document}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
\maketitle
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
\input{sec/0_abstract}
|
| 68 |
+
\input{sec/1_intro}
|
| 69 |
+
\input{sec/2_relatedwork}
|
| 70 |
+
\input{sec/3_analysis}
|
| 71 |
+
\input{sec/3_method}
|
| 72 |
+
\input{sec/4_experiments}
|
| 73 |
+
\input{sec/rebuttal_addon}
|
| 74 |
+
\input{sec/5_conclusion}
|
| 75 |
+
\input{sec/6_statements}
|
| 76 |
+
|
| 77 |
+
\bibliography{main}
|
| 78 |
+
\bibliographystyle{iclr2026_conference}
|
| 79 |
+
|
| 80 |
+
\appendix
|
| 81 |
+
\section{Appendix}
|
| 82 |
+
\input{sec/X_suppl}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
\end{document}
|
gmnet/project/gmnet_tpami/reference/source/imgs/acc_latency3.pdf
ADDED
|
Binary file (22.9 kB). View file
|
|
|
gmnet/project/gmnet_tpami/reference/source/imgs/variants.pdf
ADDED
|
Binary file (29.7 kB). View file
|
|
|
gmnet/project/gmnet_tpami/reference/source/main.bib
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@String(PAMI = {IEEE Trans. Pattern Anal. Mach. Intell.})
|
| 2 |
+
@String(IJCV = {Int. J. Comput. Vis.})
|
| 3 |
+
@String(CVPR= {IEEE Conf. Comput. Vis. Pattern Recog.})
|
| 4 |
+
@String(ICCV= {Int. Conf. Comput. Vis.})
|
| 5 |
+
@String(ECCV= {Eur. Conf. Comput. Vis.})
|
| 6 |
+
@String(NIPS= {Adv. Neural Inform. Process. Syst.})
|
| 7 |
+
@String(ICPR = {Int. Conf. Pattern Recog.})
|
| 8 |
+
@String(BMVC= {Brit. Mach. Vis. Conf.})
|
| 9 |
+
@String(TOG= {ACM Trans. Graph.})
|
| 10 |
+
@String(TIP = {IEEE Trans. Image Process.})
|
| 11 |
+
@String(TVCG = {IEEE Trans. Vis. Comput. Graph.})
|
| 12 |
+
@String(TMM = {IEEE Trans. Multimedia})
|
| 13 |
+
@String(ACMMM= {ACM Int. Conf. Multimedia})
|
| 14 |
+
@String(ICME = {Int. Conf. Multimedia and Expo})
|
| 15 |
+
@String(ICASSP= {ICASSP})
|
| 16 |
+
@String(ICIP = {IEEE Int. Conf. Image Process.})
|
| 17 |
+
@String(ACCV = {ACCV})
|
| 18 |
+
@String(ICLR = {Int. Conf. Learn. Represent.})
|
| 19 |
+
@String(IJCAI = {IJCAI})
|
| 20 |
+
@String(PR = {Pattern Recognition})
|
| 21 |
+
@String(AAAI = {AAAI})
|
| 22 |
+
@String(CVPRW= {IEEE Conf. Comput. Vis. Pattern Recog. Worksh.})
|
| 23 |
+
@String(CSVT = {IEEE Trans. Circuit Syst. Video Technol.})
|
| 24 |
+
|
| 25 |
+
@String(SPL = {IEEE Sign. Process. Letters})
|
| 26 |
+
@String(VR = {Vis. Res.})
|
| 27 |
+
@String(JOV = {J. Vis.})
|
| 28 |
+
@String(TVC = {The Vis. Comput.})
|
| 29 |
+
@String(JCST = {J. Comput. Sci. Tech.})
|
| 30 |
+
@String(CGF = {Comput. Graph. Forum})
|
| 31 |
+
@String(CVM = {Computational Visual Media})
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@String(PAMI = {IEEE TPAMI})
|
| 35 |
+
@String(IJCV = {IJCV})
|
| 36 |
+
@String(CVPR = {CVPR})
|
| 37 |
+
@String(ICCV = {ICCV})
|
| 38 |
+
@String(ECCV = {ECCV})
|
| 39 |
+
@String(NIPS = {NeurIPS})
|
| 40 |
+
@String(ICPR = {ICPR})
|
| 41 |
+
@String(BMVC = {BMVC})
|
| 42 |
+
@String(TOG = {ACM TOG})
|
| 43 |
+
@String(TIP = {IEEE TIP})
|
| 44 |
+
@String(TVCG = {IEEE TVCG})
|
| 45 |
+
@String(TCSVT = {IEEE TCSVT})
|
| 46 |
+
@String(TMM = {IEEE TMM})
|
| 47 |
+
@String(ACMMM = {ACM MM})
|
| 48 |
+
@String(ICME = {ICME})
|
| 49 |
+
@String(ICASSP= {ICASSP})
|
| 50 |
+
@String(ICIP = {ICIP})
|
| 51 |
+
@String(ACCV = {ACCV})
|
| 52 |
+
@String(ICLR = {ICLR})
|
| 53 |
+
@String(IJCAI = {IJCAI})
|
| 54 |
+
@String(PR = {PR})
|
| 55 |
+
@String(AAAI = {AAAI})
|
| 56 |
+
@String(CVPRW= {CVPRW})
|
| 57 |
+
@String(CSVT = {IEEE TCSVT})
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
@misc{Authors14,
|
| 62 |
+
author = {FirstName LastName},
|
| 63 |
+
title = {The frobnicatable foo filter},
|
| 64 |
+
note = {Face and Gesture submission ID 324. Supplied as supplemental material {\tt fg324.pdf}},
|
| 65 |
+
year = 2014
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
@misc{Authors14b,
|
| 69 |
+
author = {FirstName LastName},
|
| 70 |
+
title = {Frobnication tutorial},
|
| 71 |
+
note = {Supplied as supplemental material {\tt tr.pdf}},
|
| 72 |
+
year = 2014
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
@article{Alpher02,
|
| 76 |
+
author = {FirstName Alpher},
|
| 77 |
+
title = {Frobnication},
|
| 78 |
+
journal = PAMI,
|
| 79 |
+
volume = 12,
|
| 80 |
+
number = 1,
|
| 81 |
+
pages = {234--778},
|
| 82 |
+
year = 2002
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
@article{Alpher03,
|
| 86 |
+
author = {FirstName Alpher and FirstName Fotheringham-Smythe},
|
| 87 |
+
title = {Frobnication revisited},
|
| 88 |
+
journal = {Journal of Foo},
|
| 89 |
+
volume = 13,
|
| 90 |
+
number = 1,
|
| 91 |
+
pages = {234--778},
|
| 92 |
+
year = 2003
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
@article{Alpher04,
|
| 96 |
+
author = {FirstName Alpher and FirstName Fotheringham-Smythe and FirstName Gamow},
|
| 97 |
+
title = {Can a machine frobnicate?},
|
| 98 |
+
journal = {Journal of Foo},
|
| 99 |
+
volume = 14,
|
| 100 |
+
number = 1,
|
| 101 |
+
pages = {234--778},
|
| 102 |
+
year = 2004
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
@inproceedings{Alpher05,
|
| 106 |
+
author = {FirstName Alpher and FirstName Gamow},
|
| 107 |
+
title = {Can a computer frobnicate?},
|
| 108 |
+
booktitle = CVPR,
|
| 109 |
+
pages = {234--778},
|
| 110 |
+
year = 2005
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
@inproceedings{wang2020high,
|
| 114 |
+
title={High-frequency component helps explain the generalization of convolutional neural networks},
|
| 115 |
+
author={Wang, Haohan and Wu, Xindi and Huang, Zeyi and Xing, Eric P},
|
| 116 |
+
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
|
| 117 |
+
pages={8684--8694},
|
| 118 |
+
year={2020}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
@inproceedings{bai2022improving,
|
| 122 |
+
title={Improving vision transformers by revisiting high-frequency components},
|
| 123 |
+
author={Bai, Jiawang and Yuan, Li and Xia, Shu-Tao and Yan, Shuicheng and Li, Zhifeng and Liu, Wei},
|
| 124 |
+
booktitle={European Conference on Computer Vision},
|
| 125 |
+
pages={1--18},
|
| 126 |
+
year={2022},
|
| 127 |
+
organization={Springer}
|
| 128 |
+
}
|
| 129 |
+
@inproceedings{rahaman2019spectral,
|
| 130 |
+
title={On the spectral bias of neural networks},
|
| 131 |
+
author={Rahaman, Nasim and Baratin, Aristide and Arpit, Devansh and Draxler, Felix and Lin, Min and Hamprecht, Fred and Bengio, Yoshua and Courville, Aaron},
|
| 132 |
+
booktitle={International conference on machine learning},
|
| 133 |
+
pages={5301--5310},
|
| 134 |
+
year={2019},
|
| 135 |
+
organization={PMLR}
|
| 136 |
+
}
|
| 137 |
+
@article{tang2022defects,
|
| 138 |
+
title={Defects of convolutional decoder networks in frequency representation},
|
| 139 |
+
author={Tang, Ling and Shen, Wen and Zhou, Zhanpeng and Chen, Yuefeng and Zhang, Quanshi},
|
| 140 |
+
journal={arXiv preprint arXiv:2210.09020},
|
| 141 |
+
year={2022}
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
@inproceedings{wang2023neural,
|
| 146 |
+
title={What do neural networks learn in image classification? a frequency shortcut perspective},
|
| 147 |
+
author={Wang, Shunxin and Veldhuis, Raymond and Brune, Christoph and Strisciuglio, Nicola},
|
| 148 |
+
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
|
| 149 |
+
pages={1433--1442},
|
| 150 |
+
year={2023}
|
| 151 |
+
}
|
| 152 |
+
@inproceedings{qin2021fcanet,
|
| 153 |
+
title={Fcanet: Frequency channel attention networks},
|
| 154 |
+
author={Qin, Zequn and Zhang, Pengyi and Wu, Fei and Li, Xi},
|
| 155 |
+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
|
| 156 |
+
pages={783--792},
|
| 157 |
+
year={2021}
|
| 158 |
+
}
|
| 159 |
+
@article{patro2023spectformer,
|
| 160 |
+
title={SpectFormer: Frequency and Attention is what you need in a Vision Transformer},
|
| 161 |
+
author={Patro, Badri N and Namboodiri, Vinay P and Agneeswaran, Vijay Srinivas},
|
| 162 |
+
journal={arXiv preprint arXiv:2304.06446},
|
| 163 |
+
year={2023}
|
| 164 |
+
}
|
| 165 |
+
@article{yin2019fourier,
|
| 166 |
+
title={A fourier perspective on model robustness in computer vision},
|
| 167 |
+
author={Yin, Dong and Gontijo Lopes, Raphael and Shlens, Jon and Cubuk, Ekin Dogus and Gilmer, Justin},
|
| 168 |
+
journal={Advances in Neural Information Processing Systems},
|
| 169 |
+
volume={32},
|
| 170 |
+
year={2019}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
@inproceedings{he2016deep,
|
| 174 |
+
title={Deep residual learning for image recognition},
|
| 175 |
+
author={He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian},
|
| 176 |
+
booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
|
| 177 |
+
pages={770--778},
|
| 178 |
+
year={2016}
|
| 179 |
+
}
|
| 180 |
+
@article{paszke2019pytorch,
|
| 181 |
+
title={Pytorch: An imperative style, high-performance deep learning library},
|
| 182 |
+
author={Paszke, Adam and Gross, Sam and Massa, Francisco and Lerer, Adam and Bradbury, James and Chanan, Gregory and Killeen, Trevor and Lin, Zeming and Gimelshein, Natalia and Antiga, Luca and others},
|
| 183 |
+
journal={Advances in neural information processing systems},
|
| 184 |
+
volume={32},
|
| 185 |
+
year={2019}
|
| 186 |
+
}
|
| 187 |
+
@inproceedings{vasu2023fastvit,
|
| 188 |
+
title={FastViT: A fast hybrid vision transformer using structural reparameterization},
|
| 189 |
+
author={Vasu, Pavan Kumar Anasosalu and Gabriel, James and Zhu, Jeff and Tuzel, Oncel and Ranjan, Anurag},
|
| 190 |
+
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
|
| 191 |
+
pages={5785--5795},
|
| 192 |
+
year={2023}
|
| 193 |
+
}
|
| 194 |
+
@article{muller2019does,
|
| 195 |
+
title={When does label smoothing help?},
|
| 196 |
+
author={M{\"u}ller, Rafael and Kornblith, Simon and Hinton, Geoffrey E},
|
| 197 |
+
journal={Advances in neural information processing systems},
|
| 198 |
+
volume={32},
|
| 199 |
+
year={2019}
|
| 200 |
+
}
|
| 201 |
+
@inproceedings{huang2016deep,
|
| 202 |
+
title={Deep networks with stochastic depth},
|
| 203 |
+
author={Huang, Gao and Sun, Yu and Liu, Zhuang and Sedra, Daniel and Weinberger, Kilian Q},
|
| 204 |
+
booktitle={Computer Vision--ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11--14, 2016, Proceedings, Part IV 14},
|
| 205 |
+
pages={646--661},
|
| 206 |
+
year={2016},
|
| 207 |
+
organization={Springer}
|
| 208 |
+
}
|
| 209 |
+
@inproceedings{ding2024unireplknet,
|
| 210 |
+
title={Unireplknet: A universal perception large-kernel convnet for audio video point cloud time-series and image recognition},
|
| 211 |
+
author={Ding, Xiaohan and Zhang, Yiyuan and Ge, Yixiao and Zhao, Sijie and Song, Lin and Yue, Xiangyu and Shan, Ying},
|
| 212 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 213 |
+
pages={5513--5524},
|
| 214 |
+
year={2024}
|
| 215 |
+
}
|
| 216 |
+
@article{wang2025lsnet,
|
| 217 |
+
title={LSNet: See Large, Focus Small},
|
| 218 |
+
author={Wang, Ao and Chen, Hui and Lin, Zijia and Han, Jungong and Ding, Guiguang},
|
| 219 |
+
journal={arXiv preprint arXiv:2503.23135},
|
| 220 |
+
year={2025}
|
| 221 |
+
}
|
| 222 |
+
@inproceedings{qin2024mobilenetv4,
|
| 223 |
+
title={MobileNetV4: universal models for the mobile ecosystem},
|
| 224 |
+
author={Qin, Danfeng and Leichner, Chas and Delakis, Manolis and Fornoni, Marco and Luo, Shixin and Yang, Fan and Wang, Weijun and Banbury, Colby and Ye, Chengxi and Akin, Berkin and others},
|
| 225 |
+
booktitle={European Conference on Computer Vision},
|
| 226 |
+
pages={78--96},
|
| 227 |
+
year={2024},
|
| 228 |
+
organization={Springer}
|
| 229 |
+
}
|
| 230 |
+
@inproceedings{shaker2023swiftformer,
|
| 231 |
+
title={Swiftformer: Efficient additive attention for transformer-based real-time mobile vision applications},
|
| 232 |
+
author={Shaker, Abdelrahman and Maaz, Muhammad and Rasheed, Hanoona and Khan, Salman and Yang, Ming-Hsuan and Khan, Fahad Shahbaz},
|
| 233 |
+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
|
| 234 |
+
pages={17425--17436},
|
| 235 |
+
year={2023}
|
| 236 |
+
}
|
| 237 |
+
@inproceedings{yun2019cutmix,
|
| 238 |
+
title={Cutmix: Regularization strategy to train strong classifiers with localizable features},
|
| 239 |
+
author={Yun, Sangdoo and Han, Dongyoon and Oh, Seong Joon and Chun, Sanghyuk and Choe, Junsuk and Yoo, Youngjoon},
|
| 240 |
+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
|
| 241 |
+
pages={6023--6032},
|
| 242 |
+
year={2019}
|
| 243 |
+
}
|
| 244 |
+
@inproceedings{graham2021levit,
|
| 245 |
+
title={Levit: a vision transformer in convnet's clothing for faster inference},
|
| 246 |
+
author={Graham, Benjamin and El-Nouby, Alaaeldin and Touvron, Hugo and Stock, Pierre and Joulin, Armand and J{\'e}gou, Herv{\'e} and Douze, Matthijs},
|
| 247 |
+
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
|
| 248 |
+
pages={12259--12269},
|
| 249 |
+
year={2021}
|
| 250 |
+
}
|
| 251 |
+
@article{chung2014empirical,
|
| 252 |
+
title={Empirical evaluation of gated recurrent neural networks on sequence modeling},
|
| 253 |
+
author={Chung, Junyoung and Gulcehre, Caglar and Cho, KyungHyun and Bengio, Yoshua},
|
| 254 |
+
journal={arXiv preprint arXiv:1412.3555},
|
| 255 |
+
year={2014}
|
| 256 |
+
}
|
| 257 |
+
@inproceedings{han2020ghostnet,
|
| 258 |
+
title={Ghostnet: More features from cheap operations},
|
| 259 |
+
author={Han, Kai and Wang, Yunhe and Tian, Qi and Guo, Jianyuan and Xu, Chunjing and Xu, Chang},
|
| 260 |
+
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
|
| 261 |
+
pages={1580--1589},
|
| 262 |
+
year={2020}
|
| 263 |
+
}
|
| 264 |
+
@inproceedings{dauphin2017language,
|
| 265 |
+
title={Language modeling with gated convolutional networks},
|
| 266 |
+
author={Dauphin, Yann N and Fan, Angela and Auli, Michael and Grangier, David},
|
| 267 |
+
booktitle={International conference on machine learning},
|
| 268 |
+
pages={933--941},
|
| 269 |
+
year={2017},
|
| 270 |
+
organization={PMLR}
|
| 271 |
+
}
|
| 272 |
+
@article{graves2005framewise,
|
| 273 |
+
title={Framewise phoneme classification with bidirectional LSTM and other neural network architectures},
|
| 274 |
+
author={Graves, Alex and Schmidhuber, J{\"u}rgen},
|
| 275 |
+
journal={Neural networks},
|
| 276 |
+
volume={18},
|
| 277 |
+
number={5-6},
|
| 278 |
+
pages={602--610},
|
| 279 |
+
year={2005},
|
| 280 |
+
publisher={Elsevier}
|
| 281 |
+
}
|
| 282 |
+
@article{gers2000learning,
|
| 283 |
+
title={Learning to forget: Continual prediction with LSTM},
|
| 284 |
+
author={Gers, Felix A and Schmidhuber, J{\"u}rgen and Cummins, Fred},
|
| 285 |
+
journal={Neural computation},
|
| 286 |
+
volume={12},
|
| 287 |
+
number={10},
|
| 288 |
+
pages={2451--2471},
|
| 289 |
+
year={2000},
|
| 290 |
+
publisher={MIT press}
|
| 291 |
+
}
|
| 292 |
+
@article{yang2022focal,
|
| 293 |
+
title={Focal modulation networks},
|
| 294 |
+
author={Yang, Jianwei and Li, Chunyuan and Dai, Xiyang and Gao, Jianfeng},
|
| 295 |
+
journal={Advances in Neural Information Processing Systems},
|
| 296 |
+
volume={35},
|
| 297 |
+
pages={4203--4217},
|
| 298 |
+
year={2022}
|
| 299 |
+
}
|
| 300 |
+
@article{lin2024revisiting,
|
| 301 |
+
title={Revisiting visual model robustness: a frequency long-tailed distribution view},
|
| 302 |
+
author={Lin, Zhiyu and Gao, Yifei and Yang, Yunfan and Sang, Jitao},
|
| 303 |
+
journal={Advances in Neural Information Processing Systems},
|
| 304 |
+
volume={36},
|
| 305 |
+
year={2024}
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
@article{xu2019frequency,
|
| 309 |
+
title={Frequency principle: Fourier analysis sheds light on deep neural networks},
|
| 310 |
+
author={Xu, Zhi-Qin John and Zhang, Yaoyu and Luo, Tao and Xiao, Yanyang and Ma, Zheng},
|
| 311 |
+
journal={arXiv preprint arXiv:1901.06523},
|
| 312 |
+
year={2019}
|
| 313 |
+
}
|
| 314 |
+
@article{tancik2020fourier,
|
| 315 |
+
title={Fourier features let networks learn high frequency functions in low dimensional domains},
|
| 316 |
+
author={Tancik, Matthew and Srinivasan, Pratul and Mildenhall, Ben and Fridovich-Keil, Sara and Raghavan, Nithin and Singhal, Utkarsh and Ramamoorthi, Ravi and Barron, Jonathan and Ng, Ren},
|
| 317 |
+
journal={Advances in neural information processing systems},
|
| 318 |
+
volume={33},
|
| 319 |
+
pages={7537--7547},
|
| 320 |
+
year={2020}
|
| 321 |
+
}
|
| 322 |
+
@article{gu2023mamba,
|
| 323 |
+
title={Mamba: Linear-time sequence modeling with selective state spaces},
|
| 324 |
+
author={Gu, Albert and Dao, Tri},
|
| 325 |
+
journal={arXiv preprint arXiv:2312.00752},
|
| 326 |
+
year={2023}
|
| 327 |
+
}
|
| 328 |
+
@article{liu2021pay,
|
| 329 |
+
title={Pay attention to mlps},
|
| 330 |
+
author={Liu, Hanxiao and Dai, Zihang and So, David and Le, Quoc V},
|
| 331 |
+
journal={Advances in neural information processing systems},
|
| 332 |
+
volume={34},
|
| 333 |
+
pages={9204--9215},
|
| 334 |
+
year={2021}
|
| 335 |
+
}
|
| 336 |
+
@article{ma2024efficient,
|
| 337 |
+
title={Efficient Modulation for Vision Networks},
|
| 338 |
+
author={Ma, Xu and Dai, Xiyang and Yang, Jianwei and Xiao, Bin and Chen, Yinpeng and Fu, Yun and Yuan, Lu},
|
| 339 |
+
journal={arXiv preprint arXiv:2403.19963},
|
| 340 |
+
year={2024}
|
| 341 |
+
}
|
| 342 |
+
@inproceedings{ma2024rewrite,
|
| 343 |
+
title={Rewrite the Stars},
|
| 344 |
+
author={Ma, Xu and Dai, Xiyang and Bai, Yue and Wang, Yizhou and Fu, Yun},
|
| 345 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 346 |
+
pages={5694--5703},
|
| 347 |
+
year={2024}
|
| 348 |
+
}
|
| 349 |
+
@inproceedings{vasu2023mobileone,
|
| 350 |
+
title={Mobileone: An improved one millisecond mobile backbone},
|
| 351 |
+
author={Vasu, Pavan Kumar Anasosalu and Gabriel, James and Zhu, Jeff and Tuzel, Oncel and Ranjan, Anurag},
|
| 352 |
+
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
|
| 353 |
+
pages={7907--7917},
|
| 354 |
+
year={2023}
|
| 355 |
+
}
|
| 356 |
+
@inproceedings{wang2024repvit,
|
| 357 |
+
title={Repvit: Revisiting mobile cnn from vit perspective},
|
| 358 |
+
author={Wang, Ao and Chen, Hui and Lin, Zijia and Han, Jungong and Ding, Guiguang},
|
| 359 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 360 |
+
pages={15909--15920},
|
| 361 |
+
year={2024}
|
| 362 |
+
}
|
| 363 |
+
@inproceedings{li2023rethinking,
|
| 364 |
+
title={Rethinking vision transformers for mobilenet size and speed},
|
| 365 |
+
author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian},
|
| 366 |
+
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
|
| 367 |
+
pages={16889--16900},
|
| 368 |
+
year={2023}
|
| 369 |
+
}
|
| 370 |
+
@article{li2022efficientformer,
|
| 371 |
+
title={Efficientformer: Vision transformers at mobilenet speed},
|
| 372 |
+
author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Ju and Evangelidis, Georgios and Tulyakov, Sergey and Wang, Yanzhi and Ren, Jian},
|
| 373 |
+
journal={Advances in Neural Information Processing Systems},
|
| 374 |
+
volume={35},
|
| 375 |
+
pages={12934--12949},
|
| 376 |
+
year={2022}
|
| 377 |
+
}
|
| 378 |
+
@inproceedings{pan2022edgevits,
|
| 379 |
+
title={Edgevits: Competing light-weight cnns on mobile devices with vision transformers},
|
| 380 |
+
author={Pan, Junting and Bulat, Adrian and Tan, Fuwen and Zhu, Xiatian and Dudziak, Lukasz and Li, Hongsheng and Tzimiropoulos, Georgios and Martinez, Brais},
|
| 381 |
+
booktitle={European Conference on Computer Vision},
|
| 382 |
+
pages={294--311},
|
| 383 |
+
year={2022},
|
| 384 |
+
organization={Springer}
|
| 385 |
+
}
|
| 386 |
+
@inproceedings{sandler2018mobilenetv2,
|
| 387 |
+
title={Mobilenetv2: Inverted residuals and linear bottlenecks},
|
| 388 |
+
author={Sandler, Mark and Howard, Andrew and Zhu, Menglong and Zhmoginov, Andrey and Chen, Liang-Chieh},
|
| 389 |
+
booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
|
| 390 |
+
pages={4510--4520},
|
| 391 |
+
year={2018}
|
| 392 |
+
}
|
| 393 |
+
@article{vaswani2017attention,
|
| 394 |
+
title={Attention is all you need},
|
| 395 |
+
author={Vaswani, A},
|
| 396 |
+
journal={Advances in Neural Information Processing Systems},
|
| 397 |
+
year={2017}
|
| 398 |
+
}
|
| 399 |
+
@article{shazeer2020glu,
|
| 400 |
+
title={Glu variants improve transformer},
|
| 401 |
+
author={Shazeer, Noam},
|
| 402 |
+
journal={arXiv preprint arXiv:2002.05202},
|
| 403 |
+
year={2020}
|
| 404 |
+
}
|
| 405 |
+
@article{hendrycks2016gaussian,
|
| 406 |
+
title={Gaussian error linear units (gelus)},
|
| 407 |
+
author={Hendrycks, Dan and Gimpel, Kevin},
|
| 408 |
+
journal={arXiv preprint arXiv:1606.08415},
|
| 409 |
+
year={2016}
|
| 410 |
+
}
|
| 411 |
+
@inproceedings{chen2023run,
|
| 412 |
+
title={Run, don't walk: chasing higher FLOPS for faster neural networks},
|
| 413 |
+
author={Chen, Jierun and Kao, Shiu-hong and He, Hao and Zhuo, Weipeng and Wen, Song and Lee, Chul-Ho and Chan, S-H Gary},
|
| 414 |
+
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
|
| 415 |
+
pages={12021--12031},
|
| 416 |
+
year={2023}
|
| 417 |
+
}
|
| 418 |
+
@inproceedings{ma2018shufflenet,
|
| 419 |
+
title={Shufflenet v2: Practical guidelines for efficient cnn architecture design},
|
| 420 |
+
author={Ma, Ningning and Zhang, Xiangyu and Zheng, Hai-Tao and Sun, Jian},
|
| 421 |
+
booktitle={Proceedings of the European conference on computer vision (ECCV)},
|
| 422 |
+
pages={116--131},
|
| 423 |
+
year={2018}
|
| 424 |
+
}
|
| 425 |
+
@article{loshchilov2017decoupled,
|
| 426 |
+
title={Decoupled weight decay regularization},
|
| 427 |
+
author={Loshchilov, I},
|
| 428 |
+
journal={arXiv preprint arXiv:1711.05101},
|
| 429 |
+
year={2017}
|
| 430 |
+
}
|
| 431 |
+
@article{de2024griffin,
|
| 432 |
+
title={Griffin: Mixing gated linear recurrences with local attention for efficient language models},
|
| 433 |
+
author={De, Soham and Smith, Samuel L and Fernando, Anushan and Botev, Aleksandar and Cristian-Muraru, George and Gu, Albert and Haroun, Ruba and Berrada, Leonard and Chen, Yutian and Srinivasan, Srivatsan and others},
|
| 434 |
+
journal={arXiv preprint arXiv:2402.19427},
|
| 435 |
+
year={2024}
|
| 436 |
+
}
|
| 437 |
+
@article{dosovitskiy2020image,
|
| 438 |
+
title={An image is worth 16x16 words: Transformers for image recognition at scale},
|
| 439 |
+
author={Dosovitskiy, Alexey},
|
| 440 |
+
journal={arXiv preprint arXiv:2010.11929},
|
| 441 |
+
year={2020}
|
| 442 |
+
}
|
| 443 |
+
@article{dubey2024llama,
|
| 444 |
+
title={The llama 3 herd of models},
|
| 445 |
+
author={Dubey, Abhimanyu and Jauhri, Abhinav and Pandey, Abhinav and Kadian, Abhishek and Al-Dahle, Ahmad and Letman, Aiesha and Mathur, Akhil and Schelten, Alan and Yang, Amy and Fan, Angela and others},
|
| 446 |
+
journal={arXiv preprint arXiv:2407.21783},
|
| 447 |
+
year={2024}
|
| 448 |
+
}
|
| 449 |
+
@article{hochreiter1997long,
|
| 450 |
+
title={Long Short-term Memory},
|
| 451 |
+
author={Hochreiter, S},
|
| 452 |
+
journal={Neural Computation MIT-Press},
|
| 453 |
+
year={1997}
|
| 454 |
+
}`
|
gmnet/project/gmnet_tpami/reference/source/math_commands.tex
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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8 |
+
\newcommand{\figright}{{\em (Right)}}
|
| 9 |
+
\newcommand{\figtop}{{\em (Top)}}
|
| 10 |
+
\newcommand{\figbottom}{{\em (Bottom)}}
|
| 11 |
+
\newcommand{\captiona}{{\em (a)}}
|
| 12 |
+
\newcommand{\captionb}{{\em (b)}}
|
| 13 |
+
\newcommand{\captionc}{{\em (c)}}
|
| 14 |
+
\newcommand{\captiond}{{\em (d)}}
|
| 15 |
+
|
| 16 |
+
% Highlight a newly defined term
|
| 17 |
+
\newcommand{\newterm}[1]{{\bf #1}}
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
% Figure reference, lower-case.
|
| 21 |
+
\def\figref#1{figure~\ref{#1}}
|
| 22 |
+
% Figure reference, capital. For start of sentence
|
| 23 |
+
\def\Figref#1{Figure~\ref{#1}}
|
| 24 |
+
\def\twofigref#1#2{figures \ref{#1} and \ref{#2}}
|
| 25 |
+
\def\quadfigref#1#2#3#4{figures \ref{#1}, \ref{#2}, \ref{#3} and \ref{#4}}
|
| 26 |
+
% Section reference, lower-case.
|
| 27 |
+
\def\secref#1{section~\ref{#1}}
|
| 28 |
+
% Section reference, capital.
|
| 29 |
+
\def\Secref#1{Section~\ref{#1}}
|
| 30 |
+
% Reference to two sections.
|
| 31 |
+
\def\twosecrefs#1#2{sections \ref{#1} and \ref{#2}}
|
| 32 |
+
% Reference to three sections.
|
| 33 |
+
\def\secrefs#1#2#3{sections \ref{#1}, \ref{#2} and \ref{#3}}
|
| 34 |
+
% Reference to an equation, lower-case.
|
| 35 |
+
\def\eqref#1{equation~\ref{#1}}
|
| 36 |
+
% Reference to an equation, upper case
|
| 37 |
+
\def\Eqref#1{Equation~\ref{#1}}
|
| 38 |
+
% A raw reference to an equation---avoid using if possible
|
| 39 |
+
\def\plaineqref#1{\ref{#1}}
|
| 40 |
+
% Reference to a chapter, lower-case.
|
| 41 |
+
\def\chapref#1{chapter~\ref{#1}}
|
| 42 |
+
% Reference to an equation, upper case.
|
| 43 |
+
\def\Chapref#1{Chapter~\ref{#1}}
|
| 44 |
+
% Reference to a range of chapters
|
| 45 |
+
\def\rangechapref#1#2{chapters\ref{#1}--\ref{#2}}
|
| 46 |
+
% Reference to an algorithm, lower-case.
|
| 47 |
+
\def\algref#1{algorithm~\ref{#1}}
|
| 48 |
+
% Reference to an algorithm, upper case.
|
| 49 |
+
\def\Algref#1{Algorithm~\ref{#1}}
|
| 50 |
+
\def\twoalgref#1#2{algorithms \ref{#1} and \ref{#2}}
|
| 51 |
+
\def\Twoalgref#1#2{Algorithms \ref{#1} and \ref{#2}}
|
| 52 |
+
% Reference to a part, lower case
|
| 53 |
+
\def\partref#1{part~\ref{#1}}
|
| 54 |
+
% Reference to a part, upper case
|
| 55 |
+
\def\Partref#1{Part~\ref{#1}}
|
| 56 |
+
\def\twopartref#1#2{parts \ref{#1} and \ref{#2}}
|
| 57 |
+
|
| 58 |
+
\def\ceil#1{\lceil #1 \rceil}
|
| 59 |
+
\def\floor#1{\lfloor #1 \rfloor}
|
| 60 |
+
\def\1{\bm{1}}
|
| 61 |
+
\newcommand{\train}{\mathcal{D}}
|
| 62 |
+
\newcommand{\valid}{\mathcal{D_{\mathrm{valid}}}}
|
| 63 |
+
\newcommand{\test}{\mathcal{D_{\mathrm{test}}}}
|
| 64 |
+
|
| 65 |
+
\def\eps{{\epsilon}}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
% Random variables
|
| 69 |
+
\def\reta{{\textnormal{$\eta$}}}
|
| 70 |
+
\def\ra{{\textnormal{a}}}
|
| 71 |
+
\def\rb{{\textnormal{b}}}
|
| 72 |
+
\def\rc{{\textnormal{c}}}
|
| 73 |
+
\def\rd{{\textnormal{d}}}
|
| 74 |
+
\def\re{{\textnormal{e}}}
|
| 75 |
+
\def\rf{{\textnormal{f}}}
|
| 76 |
+
\def\rg{{\textnormal{g}}}
|
| 77 |
+
\def\rh{{\textnormal{h}}}
|
| 78 |
+
\def\ri{{\textnormal{i}}}
|
| 79 |
+
\def\rj{{\textnormal{j}}}
|
| 80 |
+
\def\rk{{\textnormal{k}}}
|
| 81 |
+
\def\rl{{\textnormal{l}}}
|
| 82 |
+
% rm is already a command, just don't name any random variables m
|
| 83 |
+
\def\rn{{\textnormal{n}}}
|
| 84 |
+
\def\ro{{\textnormal{o}}}
|
| 85 |
+
\def\rp{{\textnormal{p}}}
|
| 86 |
+
\def\rq{{\textnormal{q}}}
|
| 87 |
+
\def\rr{{\textnormal{r}}}
|
| 88 |
+
\def\rs{{\textnormal{s}}}
|
| 89 |
+
\def\rt{{\textnormal{t}}}
|
| 90 |
+
\def\ru{{\textnormal{u}}}
|
| 91 |
+
\def\rv{{\textnormal{v}}}
|
| 92 |
+
\def\rw{{\textnormal{w}}}
|
| 93 |
+
\def\rx{{\textnormal{x}}}
|
| 94 |
+
\def\ry{{\textnormal{y}}}
|
| 95 |
+
\def\rz{{\textnormal{z}}}
|
| 96 |
+
|
| 97 |
+
% Random vectors
|
| 98 |
+
\def\rvepsilon{{\mathbf{\epsilon}}}
|
| 99 |
+
\def\rvtheta{{\mathbf{\theta}}}
|
| 100 |
+
\def\rva{{\mathbf{a}}}
|
| 101 |
+
\def\rvb{{\mathbf{b}}}
|
| 102 |
+
\def\rvc{{\mathbf{c}}}
|
| 103 |
+
\def\rvd{{\mathbf{d}}}
|
| 104 |
+
\def\rve{{\mathbf{e}}}
|
| 105 |
+
\def\rvf{{\mathbf{f}}}
|
| 106 |
+
\def\rvg{{\mathbf{g}}}
|
| 107 |
+
\def\rvh{{\mathbf{h}}}
|
| 108 |
+
\def\rvu{{\mathbf{i}}}
|
| 109 |
+
\def\rvj{{\mathbf{j}}}
|
| 110 |
+
\def\rvk{{\mathbf{k}}}
|
| 111 |
+
\def\rvl{{\mathbf{l}}}
|
| 112 |
+
\def\rvm{{\mathbf{m}}}
|
| 113 |
+
\def\rvn{{\mathbf{n}}}
|
| 114 |
+
\def\rvo{{\mathbf{o}}}
|
| 115 |
+
\def\rvp{{\mathbf{p}}}
|
| 116 |
+
\def\rvq{{\mathbf{q}}}
|
| 117 |
+
\def\rvr{{\mathbf{r}}}
|
| 118 |
+
\def\rvs{{\mathbf{s}}}
|
| 119 |
+
\def\rvt{{\mathbf{t}}}
|
| 120 |
+
\def\rvu{{\mathbf{u}}}
|
| 121 |
+
\def\rvv{{\mathbf{v}}}
|
| 122 |
+
\def\rvw{{\mathbf{w}}}
|
| 123 |
+
\def\rvx{{\mathbf{x}}}
|
| 124 |
+
\def\rvy{{\mathbf{y}}}
|
| 125 |
+
\def\rvz{{\mathbf{z}}}
|
| 126 |
+
|
| 127 |
+
% Elements of random vectors
|
| 128 |
+
\def\erva{{\textnormal{a}}}
|
| 129 |
+
\def\ervb{{\textnormal{b}}}
|
| 130 |
+
\def\ervc{{\textnormal{c}}}
|
| 131 |
+
\def\ervd{{\textnormal{d}}}
|
| 132 |
+
\def\erve{{\textnormal{e}}}
|
| 133 |
+
\def\ervf{{\textnormal{f}}}
|
| 134 |
+
\def\ervg{{\textnormal{g}}}
|
| 135 |
+
\def\ervh{{\textnormal{h}}}
|
| 136 |
+
\def\ervi{{\textnormal{i}}}
|
| 137 |
+
\def\ervj{{\textnormal{j}}}
|
| 138 |
+
\def\ervk{{\textnormal{k}}}
|
| 139 |
+
\def\ervl{{\textnormal{l}}}
|
| 140 |
+
\def\ervm{{\textnormal{m}}}
|
| 141 |
+
\def\ervn{{\textnormal{n}}}
|
| 142 |
+
\def\ervo{{\textnormal{o}}}
|
| 143 |
+
\def\ervp{{\textnormal{p}}}
|
| 144 |
+
\def\ervq{{\textnormal{q}}}
|
| 145 |
+
\def\ervr{{\textnormal{r}}}
|
| 146 |
+
\def\ervs{{\textnormal{s}}}
|
| 147 |
+
\def\ervt{{\textnormal{t}}}
|
| 148 |
+
\def\ervu{{\textnormal{u}}}
|
| 149 |
+
\def\ervv{{\textnormal{v}}}
|
| 150 |
+
\def\ervw{{\textnormal{w}}}
|
| 151 |
+
\def\ervx{{\textnormal{x}}}
|
| 152 |
+
\def\ervy{{\textnormal{y}}}
|
| 153 |
+
\def\ervz{{\textnormal{z}}}
|
| 154 |
+
|
| 155 |
+
% Random matrices
|
| 156 |
+
\def\rmA{{\mathbf{A}}}
|
| 157 |
+
\def\rmB{{\mathbf{B}}}
|
| 158 |
+
\def\rmC{{\mathbf{C}}}
|
| 159 |
+
\def\rmD{{\mathbf{D}}}
|
| 160 |
+
\def\rmE{{\mathbf{E}}}
|
| 161 |
+
\def\rmF{{\mathbf{F}}}
|
| 162 |
+
\def\rmG{{\mathbf{G}}}
|
| 163 |
+
\def\rmH{{\mathbf{H}}}
|
| 164 |
+
\def\rmI{{\mathbf{I}}}
|
| 165 |
+
\def\rmJ{{\mathbf{J}}}
|
| 166 |
+
\def\rmK{{\mathbf{K}}}
|
| 167 |
+
\def\rmL{{\mathbf{L}}}
|
| 168 |
+
\def\rmM{{\mathbf{M}}}
|
| 169 |
+
\def\rmN{{\mathbf{N}}}
|
| 170 |
+
\def\rmO{{\mathbf{O}}}
|
| 171 |
+
\def\rmP{{\mathbf{P}}}
|
| 172 |
+
\def\rmQ{{\mathbf{Q}}}
|
| 173 |
+
\def\rmR{{\mathbf{R}}}
|
| 174 |
+
\def\rmS{{\mathbf{S}}}
|
| 175 |
+
\def\rmT{{\mathbf{T}}}
|
| 176 |
+
\def\rmU{{\mathbf{U}}}
|
| 177 |
+
\def\rmV{{\mathbf{V}}}
|
| 178 |
+
\def\rmW{{\mathbf{W}}}
|
| 179 |
+
\def\rmX{{\mathbf{X}}}
|
| 180 |
+
\def\rmY{{\mathbf{Y}}}
|
| 181 |
+
\def\rmZ{{\mathbf{Z}}}
|
| 182 |
+
|
| 183 |
+
% Elements of random matrices
|
| 184 |
+
\def\ermA{{\textnormal{A}}}
|
| 185 |
+
\def\ermB{{\textnormal{B}}}
|
| 186 |
+
\def\ermC{{\textnormal{C}}}
|
| 187 |
+
\def\ermD{{\textnormal{D}}}
|
| 188 |
+
\def\ermE{{\textnormal{E}}}
|
| 189 |
+
\def\ermF{{\textnormal{F}}}
|
| 190 |
+
\def\ermG{{\textnormal{G}}}
|
| 191 |
+
\def\ermH{{\textnormal{H}}}
|
| 192 |
+
\def\ermI{{\textnormal{I}}}
|
| 193 |
+
\def\ermJ{{\textnormal{J}}}
|
| 194 |
+
\def\ermK{{\textnormal{K}}}
|
| 195 |
+
\def\ermL{{\textnormal{L}}}
|
| 196 |
+
\def\ermM{{\textnormal{M}}}
|
| 197 |
+
\def\ermN{{\textnormal{N}}}
|
| 198 |
+
\def\ermO{{\textnormal{O}}}
|
| 199 |
+
\def\ermP{{\textnormal{P}}}
|
| 200 |
+
\def\ermQ{{\textnormal{Q}}}
|
| 201 |
+
\def\ermR{{\textnormal{R}}}
|
| 202 |
+
\def\ermS{{\textnormal{S}}}
|
| 203 |
+
\def\ermT{{\textnormal{T}}}
|
| 204 |
+
\def\ermU{{\textnormal{U}}}
|
| 205 |
+
\def\ermV{{\textnormal{V}}}
|
| 206 |
+
\def\ermW{{\textnormal{W}}}
|
| 207 |
+
\def\ermX{{\textnormal{X}}}
|
| 208 |
+
\def\ermY{{\textnormal{Y}}}
|
| 209 |
+
\def\ermZ{{\textnormal{Z}}}
|
| 210 |
+
|
| 211 |
+
% Vectors
|
| 212 |
+
\def\vzero{{\bm{0}}}
|
| 213 |
+
\def\vone{{\bm{1}}}
|
| 214 |
+
\def\vmu{{\bm{\mu}}}
|
| 215 |
+
\def\vtheta{{\bm{\theta}}}
|
| 216 |
+
\def\va{{\bm{a}}}
|
| 217 |
+
\def\vb{{\bm{b}}}
|
| 218 |
+
\def\vc{{\bm{c}}}
|
| 219 |
+
\def\vd{{\bm{d}}}
|
| 220 |
+
\def\ve{{\bm{e}}}
|
| 221 |
+
\def\vf{{\bm{f}}}
|
| 222 |
+
\def\vg{{\bm{g}}}
|
| 223 |
+
\def\vh{{\bm{h}}}
|
| 224 |
+
\def\vi{{\bm{i}}}
|
| 225 |
+
\def\vj{{\bm{j}}}
|
| 226 |
+
\def\vk{{\bm{k}}}
|
| 227 |
+
\def\vl{{\bm{l}}}
|
| 228 |
+
\def\vm{{\bm{m}}}
|
| 229 |
+
\def\vn{{\bm{n}}}
|
| 230 |
+
\def\vo{{\bm{o}}}
|
| 231 |
+
\def\vp{{\bm{p}}}
|
| 232 |
+
\def\vq{{\bm{q}}}
|
| 233 |
+
\def\vr{{\bm{r}}}
|
| 234 |
+
\def\vs{{\bm{s}}}
|
| 235 |
+
\def\vt{{\bm{t}}}
|
| 236 |
+
\def\vu{{\bm{u}}}
|
| 237 |
+
\def\vv{{\bm{v}}}
|
| 238 |
+
\def\vw{{\bm{w}}}
|
| 239 |
+
\def\vx{{\bm{x}}}
|
| 240 |
+
\def\vy{{\bm{y}}}
|
| 241 |
+
\def\vz{{\bm{z}}}
|
| 242 |
+
|
| 243 |
+
% Elements of vectors
|
| 244 |
+
\def\evalpha{{\alpha}}
|
| 245 |
+
\def\evbeta{{\beta}}
|
| 246 |
+
\def\evepsilon{{\epsilon}}
|
| 247 |
+
\def\evlambda{{\lambda}}
|
| 248 |
+
\def\evomega{{\omega}}
|
| 249 |
+
\def\evmu{{\mu}}
|
| 250 |
+
\def\evpsi{{\psi}}
|
| 251 |
+
\def\evsigma{{\sigma}}
|
| 252 |
+
\def\evtheta{{\theta}}
|
| 253 |
+
\def\eva{{a}}
|
| 254 |
+
\def\evb{{b}}
|
| 255 |
+
\def\evc{{c}}
|
| 256 |
+
\def\evd{{d}}
|
| 257 |
+
\def\eve{{e}}
|
| 258 |
+
\def\evf{{f}}
|
| 259 |
+
\def\evg{{g}}
|
| 260 |
+
\def\evh{{h}}
|
| 261 |
+
\def\evi{{i}}
|
| 262 |
+
\def\evj{{j}}
|
| 263 |
+
\def\evk{{k}}
|
| 264 |
+
\def\evl{{l}}
|
| 265 |
+
\def\evm{{m}}
|
| 266 |
+
\def\evn{{n}}
|
| 267 |
+
\def\evo{{o}}
|
| 268 |
+
\def\evp{{p}}
|
| 269 |
+
\def\evq{{q}}
|
| 270 |
+
\def\evr{{r}}
|
| 271 |
+
\def\evs{{s}}
|
| 272 |
+
\def\evt{{t}}
|
| 273 |
+
\def\evu{{u}}
|
| 274 |
+
\def\evv{{v}}
|
| 275 |
+
\def\evw{{w}}
|
| 276 |
+
\def\evx{{x}}
|
| 277 |
+
\def\evy{{y}}
|
| 278 |
+
\def\evz{{z}}
|
| 279 |
+
|
| 280 |
+
% Matrix
|
| 281 |
+
\def\mA{{\bm{A}}}
|
| 282 |
+
\def\mB{{\bm{B}}}
|
| 283 |
+
\def\mC{{\bm{C}}}
|
| 284 |
+
\def\mD{{\bm{D}}}
|
| 285 |
+
\def\mE{{\bm{E}}}
|
| 286 |
+
\def\mF{{\bm{F}}}
|
| 287 |
+
\def\mG{{\bm{G}}}
|
| 288 |
+
\def\mH{{\bm{H}}}
|
| 289 |
+
\def\mI{{\bm{I}}}
|
| 290 |
+
\def\mJ{{\bm{J}}}
|
| 291 |
+
\def\mK{{\bm{K}}}
|
| 292 |
+
\def\mL{{\bm{L}}}
|
| 293 |
+
\def\mM{{\bm{M}}}
|
| 294 |
+
\def\mN{{\bm{N}}}
|
| 295 |
+
\def\mO{{\bm{O}}}
|
| 296 |
+
\def\mP{{\bm{P}}}
|
| 297 |
+
\def\mQ{{\bm{Q}}}
|
| 298 |
+
\def\mR{{\bm{R}}}
|
| 299 |
+
\def\mS{{\bm{S}}}
|
| 300 |
+
\def\mT{{\bm{T}}}
|
| 301 |
+
\def\mU{{\bm{U}}}
|
| 302 |
+
\def\mV{{\bm{V}}}
|
| 303 |
+
\def\mW{{\bm{W}}}
|
| 304 |
+
\def\mX{{\bm{X}}}
|
| 305 |
+
\def\mY{{\bm{Y}}}
|
| 306 |
+
\def\mZ{{\bm{Z}}}
|
| 307 |
+
\def\mBeta{{\bm{\beta}}}
|
| 308 |
+
\def\mPhi{{\bm{\Phi}}}
|
| 309 |
+
\def\mLambda{{\bm{\Lambda}}}
|
| 310 |
+
\def\mSigma{{\bm{\Sigma}}}
|
| 311 |
+
|
| 312 |
+
% Tensor
|
| 313 |
+
\DeclareMathAlphabet{\mathsfit}{\encodingdefault}{\sfdefault}{m}{sl}
|
| 314 |
+
\SetMathAlphabet{\mathsfit}{bold}{\encodingdefault}{\sfdefault}{bx}{n}
|
| 315 |
+
\newcommand{\tens}[1]{\bm{\mathsfit{#1}}}
|
| 316 |
+
\def\tA{{\tens{A}}}
|
| 317 |
+
\def\tB{{\tens{B}}}
|
| 318 |
+
\def\tC{{\tens{C}}}
|
| 319 |
+
\def\tD{{\tens{D}}}
|
| 320 |
+
\def\tE{{\tens{E}}}
|
| 321 |
+
\def\tF{{\tens{F}}}
|
| 322 |
+
\def\tG{{\tens{G}}}
|
| 323 |
+
\def\tH{{\tens{H}}}
|
| 324 |
+
\def\tI{{\tens{I}}}
|
| 325 |
+
\def\tJ{{\tens{J}}}
|
| 326 |
+
\def\tK{{\tens{K}}}
|
| 327 |
+
\def\tL{{\tens{L}}}
|
| 328 |
+
\def\tM{{\tens{M}}}
|
| 329 |
+
\def\tN{{\tens{N}}}
|
| 330 |
+
\def\tO{{\tens{O}}}
|
| 331 |
+
\def\tP{{\tens{P}}}
|
| 332 |
+
\def\tQ{{\tens{Q}}}
|
| 333 |
+
\def\tR{{\tens{R}}}
|
| 334 |
+
\def\tS{{\tens{S}}}
|
| 335 |
+
\def\tT{{\tens{T}}}
|
| 336 |
+
\def\tU{{\tens{U}}}
|
| 337 |
+
\def\tV{{\tens{V}}}
|
| 338 |
+
\def\tW{{\tens{W}}}
|
| 339 |
+
\def\tX{{\tens{X}}}
|
| 340 |
+
\def\tY{{\tens{Y}}}
|
| 341 |
+
\def\tZ{{\tens{Z}}}
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
% Graph
|
| 345 |
+
\def\gA{{\mathcal{A}}}
|
| 346 |
+
\def\gB{{\mathcal{B}}}
|
| 347 |
+
\def\gC{{\mathcal{C}}}
|
| 348 |
+
\def\gD{{\mathcal{D}}}
|
| 349 |
+
\def\gE{{\mathcal{E}}}
|
| 350 |
+
\def\gF{{\mathcal{F}}}
|
| 351 |
+
\def\gG{{\mathcal{G}}}
|
| 352 |
+
\def\gH{{\mathcal{H}}}
|
| 353 |
+
\def\gI{{\mathcal{I}}}
|
| 354 |
+
\def\gJ{{\mathcal{J}}}
|
| 355 |
+
\def\gK{{\mathcal{K}}}
|
| 356 |
+
\def\gL{{\mathcal{L}}}
|
| 357 |
+
\def\gM{{\mathcal{M}}}
|
| 358 |
+
\def\gN{{\mathcal{N}}}
|
| 359 |
+
\def\gO{{\mathcal{O}}}
|
| 360 |
+
\def\gP{{\mathcal{P}}}
|
| 361 |
+
\def\gQ{{\mathcal{Q}}}
|
| 362 |
+
\def\gR{{\mathcal{R}}}
|
| 363 |
+
\def\gS{{\mathcal{S}}}
|
| 364 |
+
\def\gT{{\mathcal{T}}}
|
| 365 |
+
\def\gU{{\mathcal{U}}}
|
| 366 |
+
\def\gV{{\mathcal{V}}}
|
| 367 |
+
\def\gW{{\mathcal{W}}}
|
| 368 |
+
\def\gX{{\mathcal{X}}}
|
| 369 |
+
\def\gY{{\mathcal{Y}}}
|
| 370 |
+
\def\gZ{{\mathcal{Z}}}
|
| 371 |
+
|
| 372 |
+
% Sets
|
| 373 |
+
\def\sA{{\mathbb{A}}}
|
| 374 |
+
\def\sB{{\mathbb{B}}}
|
| 375 |
+
\def\sC{{\mathbb{C}}}
|
| 376 |
+
\def\sD{{\mathbb{D}}}
|
| 377 |
+
% Don't use a set called E, because this would be the same as our symbol
|
| 378 |
+
% for expectation.
|
| 379 |
+
\def\sF{{\mathbb{F}}}
|
| 380 |
+
\def\sG{{\mathbb{G}}}
|
| 381 |
+
\def\sH{{\mathbb{H}}}
|
| 382 |
+
\def\sI{{\mathbb{I}}}
|
| 383 |
+
\def\sJ{{\mathbb{J}}}
|
| 384 |
+
\def\sK{{\mathbb{K}}}
|
| 385 |
+
\def\sL{{\mathbb{L}}}
|
| 386 |
+
\def\sM{{\mathbb{M}}}
|
| 387 |
+
\def\sN{{\mathbb{N}}}
|
| 388 |
+
\def\sO{{\mathbb{O}}}
|
| 389 |
+
\def\sP{{\mathbb{P}}}
|
| 390 |
+
\def\sQ{{\mathbb{Q}}}
|
| 391 |
+
\def\sR{{\mathbb{R}}}
|
| 392 |
+
\def\sS{{\mathbb{S}}}
|
| 393 |
+
\def\sT{{\mathbb{T}}}
|
| 394 |
+
\def\sU{{\mathbb{U}}}
|
| 395 |
+
\def\sV{{\mathbb{V}}}
|
| 396 |
+
\def\sW{{\mathbb{W}}}
|
| 397 |
+
\def\sX{{\mathbb{X}}}
|
| 398 |
+
\def\sY{{\mathbb{Y}}}
|
| 399 |
+
\def\sZ{{\mathbb{Z}}}
|
| 400 |
+
|
| 401 |
+
% Entries of a matrix
|
| 402 |
+
\def\emLambda{{\Lambda}}
|
| 403 |
+
\def\emA{{A}}
|
| 404 |
+
\def\emB{{B}}
|
| 405 |
+
\def\emC{{C}}
|
| 406 |
+
\def\emD{{D}}
|
| 407 |
+
\def\emE{{E}}
|
| 408 |
+
\def\emF{{F}}
|
| 409 |
+
\def\emG{{G}}
|
| 410 |
+
\def\emH{{H}}
|
| 411 |
+
\def\emI{{I}}
|
| 412 |
+
\def\emJ{{J}}
|
| 413 |
+
\def\emK{{K}}
|
| 414 |
+
\def\emL{{L}}
|
| 415 |
+
\def\emM{{M}}
|
| 416 |
+
\def\emN{{N}}
|
| 417 |
+
\def\emO{{O}}
|
| 418 |
+
\def\emP{{P}}
|
| 419 |
+
\def\emQ{{Q}}
|
| 420 |
+
\def\emR{{R}}
|
| 421 |
+
\def\emS{{S}}
|
| 422 |
+
\def\emT{{T}}
|
| 423 |
+
\def\emU{{U}}
|
| 424 |
+
\def\emV{{V}}
|
| 425 |
+
\def\emW{{W}}
|
| 426 |
+
\def\emX{{X}}
|
| 427 |
+
\def\emY{{Y}}
|
| 428 |
+
\def\emZ{{Z}}
|
| 429 |
+
\def\emSigma{{\Sigma}}
|
| 430 |
+
|
| 431 |
+
% entries of a tensor
|
| 432 |
+
% Same font as tensor, without \bm wrapper
|
| 433 |
+
\newcommand{\etens}[1]{\mathsfit{#1}}
|
| 434 |
+
\def\etLambda{{\etens{\Lambda}}}
|
| 435 |
+
\def\etA{{\etens{A}}}
|
| 436 |
+
\def\etB{{\etens{B}}}
|
| 437 |
+
\def\etC{{\etens{C}}}
|
| 438 |
+
\def\etD{{\etens{D}}}
|
| 439 |
+
\def\etE{{\etens{E}}}
|
| 440 |
+
\def\etF{{\etens{F}}}
|
| 441 |
+
\def\etG{{\etens{G}}}
|
| 442 |
+
\def\etH{{\etens{H}}}
|
| 443 |
+
\def\etI{{\etens{I}}}
|
| 444 |
+
\def\etJ{{\etens{J}}}
|
| 445 |
+
\def\etK{{\etens{K}}}
|
| 446 |
+
\def\etL{{\etens{L}}}
|
| 447 |
+
\def\etM{{\etens{M}}}
|
| 448 |
+
\def\etN{{\etens{N}}}
|
| 449 |
+
\def\etO{{\etens{O}}}
|
| 450 |
+
\def\etP{{\etens{P}}}
|
| 451 |
+
\def\etQ{{\etens{Q}}}
|
| 452 |
+
\def\etR{{\etens{R}}}
|
| 453 |
+
\def\etS{{\etens{S}}}
|
| 454 |
+
\def\etT{{\etens{T}}}
|
| 455 |
+
\def\etU{{\etens{U}}}
|
| 456 |
+
\def\etV{{\etens{V}}}
|
| 457 |
+
\def\etW{{\etens{W}}}
|
| 458 |
+
\def\etX{{\etens{X}}}
|
| 459 |
+
\def\etY{{\etens{Y}}}
|
| 460 |
+
\def\etZ{{\etens{Z}}}
|
| 461 |
+
|
| 462 |
+
% The true underlying data generating distribution
|
| 463 |
+
\newcommand{\pdata}{p_{\rm{data}}}
|
| 464 |
+
% The empirical distribution defined by the training set
|
| 465 |
+
\newcommand{\ptrain}{\hat{p}_{\rm{data}}}
|
| 466 |
+
\newcommand{\Ptrain}{\hat{P}_{\rm{data}}}
|
| 467 |
+
% The model distribution
|
| 468 |
+
\newcommand{\pmodel}{p_{\rm{model}}}
|
| 469 |
+
\newcommand{\Pmodel}{P_{\rm{model}}}
|
| 470 |
+
\newcommand{\ptildemodel}{\tilde{p}_{\rm{model}}}
|
| 471 |
+
% Stochastic autoencoder distributions
|
| 472 |
+
\newcommand{\pencode}{p_{\rm{encoder}}}
|
| 473 |
+
\newcommand{\pdecode}{p_{\rm{decoder}}}
|
| 474 |
+
\newcommand{\precons}{p_{\rm{reconstruct}}}
|
| 475 |
+
|
| 476 |
+
\newcommand{\laplace}{\mathrm{Laplace}} % Laplace distribution
|
| 477 |
+
|
| 478 |
+
\newcommand{\E}{\mathbb{E}}
|
| 479 |
+
\newcommand{\Ls}{\mathcal{L}}
|
| 480 |
+
\newcommand{\R}{\mathbb{R}}
|
| 481 |
+
\newcommand{\emp}{\tilde{p}}
|
| 482 |
+
\newcommand{\lr}{\alpha}
|
| 483 |
+
\newcommand{\reg}{\lambda}
|
| 484 |
+
\newcommand{\rect}{\mathrm{rectifier}}
|
| 485 |
+
\newcommand{\softmax}{\mathrm{softmax}}
|
| 486 |
+
\newcommand{\sigmoid}{\sigma}
|
| 487 |
+
\newcommand{\softplus}{\zeta}
|
| 488 |
+
\newcommand{\KL}{D_{\mathrm{KL}}}
|
| 489 |
+
\newcommand{\Var}{\mathrm{Var}}
|
| 490 |
+
\newcommand{\standarderror}{\mathrm{SE}}
|
| 491 |
+
\newcommand{\Cov}{\mathrm{Cov}}
|
| 492 |
+
% Wolfram Mathworld says $L^2$ is for function spaces and $\ell^2$ is for vectors
|
| 493 |
+
% But then they seem to use $L^2$ for vectors throughout the site, and so does
|
| 494 |
+
% wikipedia.
|
| 495 |
+
\newcommand{\normlzero}{L^0}
|
| 496 |
+
\newcommand{\normlone}{L^1}
|
| 497 |
+
\newcommand{\normltwo}{L^2}
|
| 498 |
+
\newcommand{\normlp}{L^p}
|
| 499 |
+
\newcommand{\normmax}{L^\infty}
|
| 500 |
+
|
| 501 |
+
\newcommand{\parents}{Pa} % See usage in notation.tex. Chosen to match Daphne's book.
|
| 502 |
+
|
| 503 |
+
\DeclareMathOperator*{\argmax}{arg\,max}
|
| 504 |
+
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%%
|
| 2 |
+
%% This is file `natbib.sty',
|
| 3 |
+
%% generated with the docstrip utility.
|
| 4 |
+
%%
|
| 5 |
+
%% The original source files were:
|
| 6 |
+
%%
|
| 7 |
+
%% natbib.dtx (with options: `package,all')
|
| 8 |
+
%% =============================================
|
| 9 |
+
%% IMPORTANT NOTICE:
|
| 10 |
+
%%
|
| 11 |
+
%% This program can be redistributed and/or modified under the terms
|
| 12 |
+
%% of the LaTeX Project Public License Distributed from CTAN
|
| 13 |
+
%% archives in directory macros/latex/base/lppl.txt; either
|
| 14 |
+
%% version 1 of the License, or any later version.
|
| 15 |
+
%%
|
| 16 |
+
%% This is a generated file.
|
| 17 |
+
%% It may not be distributed without the original source file natbib.dtx.
|
| 18 |
+
%%
|
| 19 |
+
%% Full documentation can be obtained by LaTeXing that original file.
|
| 20 |
+
%% Only a few abbreviated comments remain here to describe the usage.
|
| 21 |
+
%% =============================================
|
| 22 |
+
%% Copyright 1993-2009 Patrick W Daly
|
| 23 |
+
%% Max-Planck-Institut f\"ur Sonnensystemforschung
|
| 24 |
+
%% Max-Planck-Str. 2
|
| 25 |
+
%% D-37191 Katlenburg-Lindau
|
| 26 |
+
%% Germany
|
| 27 |
+
%% E-mail: daly@mps.mpg.de
|
| 28 |
+
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
|
| 29 |
+
\ProvidesPackage{natbib}
|
| 30 |
+
[2009/07/16 8.31 (PWD, AO)]
|
| 31 |
+
|
| 32 |
+
% This package reimplements the LaTeX \cite command to be used for various
|
| 33 |
+
% citation styles, both author-year and numerical. It accepts BibTeX
|
| 34 |
+
% output intended for many other packages, and therefore acts as a
|
| 35 |
+
% general, all-purpose citation-style interface.
|
| 36 |
+
%
|
| 37 |
+
% With standard numerical .bst files, only numerical citations are
|
| 38 |
+
% possible. With an author-year .bst file, both numerical and
|
| 39 |
+
% author-year citations are possible.
|
| 40 |
+
%
|
| 41 |
+
% If author-year citations are selected, \bibitem must have one of the
|
| 42 |
+
% following forms:
|
| 43 |
+
% \bibitem[Jones et al.(1990)]{key}...
|
| 44 |
+
% \bibitem[Jones et al.(1990)Jones, Baker, and Williams]{key}...
|
| 45 |
+
% \bibitem[Jones et al., 1990]{key}...
|
| 46 |
+
% \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
|
| 47 |
+
% et al.}{1990}]{key}...
|
| 48 |
+
% \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
|
| 49 |
+
% \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
|
| 50 |
+
% \bibitem[\protect\citename{Jones et al., }1990]{key}...
|
| 51 |
+
% \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
|
| 52 |
+
%
|
| 53 |
+
% This is either to be made up manually, or to be generated by an
|
| 54 |
+
% appropriate .bst file with BibTeX.
|
| 55 |
+
% Author-year mode || Numerical mode
|
| 56 |
+
% Then, \citet{key} ==>> Jones et al. (1990) || Jones et al. [21]
|
| 57 |
+
% \citep{key} ==>> (Jones et al., 1990) || [21]
|
| 58 |
+
% Multiple citations as normal:
|
| 59 |
+
% \citep{key1,key2} ==>> (Jones et al., 1990; Smith, 1989) || [21,24]
|
| 60 |
+
% or (Jones et al., 1990, 1991) || [21,24]
|
| 61 |
+
% or (Jones et al., 1990a,b) || [21,24]
|
| 62 |
+
% \cite{key} is the equivalent of \citet{key} in author-year mode
|
| 63 |
+
% and of \citep{key} in numerical mode
|
| 64 |
+
% Full author lists may be forced with \citet* or \citep*, e.g.
|
| 65 |
+
% \citep*{key} ==>> (Jones, Baker, and Williams, 1990)
|
| 66 |
+
% Optional notes as:
|
| 67 |
+
% \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2)
|
| 68 |
+
% \citep[e.g.,][]{key} ==>> (e.g., Jones et al., 1990)
|
| 69 |
+
% \citep[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)
|
| 70 |
+
% (Note: in standard LaTeX, only one note is allowed, after the ref.
|
| 71 |
+
% Here, one note is like the standard, two make pre- and post-notes.)
|
| 72 |
+
% \citealt{key} ==>> Jones et al. 1990
|
| 73 |
+
% \citealt*{key} ==>> Jones, Baker, and Williams 1990
|
| 74 |
+
% \citealp{key} ==>> Jones et al., 1990
|
| 75 |
+
% \citealp*{key} ==>> Jones, Baker, and Williams, 1990
|
| 76 |
+
% Additional citation possibilities (both author-year and numerical modes)
|
| 77 |
+
% \citeauthor{key} ==>> Jones et al.
|
| 78 |
+
% \citeauthor*{key} ==>> Jones, Baker, and Williams
|
| 79 |
+
% \citeyear{key} ==>> 1990
|
| 80 |
+
% \citeyearpar{key} ==>> (1990)
|
| 81 |
+
% \citetext{priv. comm.} ==>> (priv. comm.)
|
| 82 |
+
% \citenum{key} ==>> 11 [non-superscripted]
|
| 83 |
+
% Note: full author lists depends on whether the bib style supports them;
|
| 84 |
+
% if not, the abbreviated list is printed even when full requested.
|
| 85 |
+
%
|
| 86 |
+
% For names like della Robbia at the start of a sentence, use
|
| 87 |
+
% \Citet{dRob98} ==>> Della Robbia (1998)
|
| 88 |
+
% \Citep{dRob98} ==>> (Della Robbia, 1998)
|
| 89 |
+
% \Citeauthor{dRob98} ==>> Della Robbia
|
| 90 |
+
%
|
| 91 |
+
%
|
| 92 |
+
% Citation aliasing is achieved with
|
| 93 |
+
% \defcitealias{key}{text}
|
| 94 |
+
% \citetalias{key} ==>> text
|
| 95 |
+
% \citepalias{key} ==>> (text)
|
| 96 |
+
%
|
| 97 |
+
% Defining the citation mode and punctual (citation style)
|
| 98 |
+
% \setcitestyle{<comma-separated list of keywords, same
|
| 99 |
+
% as the package options>}
|
| 100 |
+
% Example: \setcitestyle{square,semicolon}
|
| 101 |
+
% Alternatively:
|
| 102 |
+
% Use \bibpunct with 6 mandatory arguments:
|
| 103 |
+
% 1. opening bracket for citation
|
| 104 |
+
% 2. closing bracket
|
| 105 |
+
% 3. citation separator (for multiple citations in one \cite)
|
| 106 |
+
% 4. the letter n for numerical styles, s for superscripts
|
| 107 |
+
% else anything for author-year
|
| 108 |
+
% 5. punctuation between authors and date
|
| 109 |
+
% 6. punctuation between years (or numbers) when common authors missing
|
| 110 |
+
% One optional argument is the character coming before post-notes. It
|
| 111 |
+
% appears in square braces before all other arguments. May be left off.
|
| 112 |
+
% Example (and default) \bibpunct[, ]{(}{)}{;}{a}{,}{,}
|
| 113 |
+
%
|
| 114 |
+
% To make this automatic for a given bib style, named newbib, say, make
|
| 115 |
+
% a local configuration file, natbib.cfg, with the definition
|
| 116 |
+
% \newcommand{\bibstyle@newbib}{\bibpunct...}
|
| 117 |
+
% Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to
|
| 118 |
+
% be called on THE NEXT LATEX RUN (via the aux file).
|
| 119 |
+
%
|
| 120 |
+
% Such preprogrammed definitions may be invoked anywhere in the text
|
| 121 |
+
% by calling \citestyle{newbib}. This is only useful if the style specified
|
| 122 |
+
% differs from that in \bibliographystyle.
|
| 123 |
+
%
|
| 124 |
+
% With \citeindextrue and \citeindexfalse, one can control whether the
|
| 125 |
+
% \cite commands make an automatic entry of the citation in the .idx
|
| 126 |
+
% indexing file. For this, \makeindex must also be given in the preamble.
|
| 127 |
+
%
|
| 128 |
+
% Package Options: (for selecting punctuation)
|
| 129 |
+
% round - round parentheses are used (default)
|
| 130 |
+
% square - square brackets are used [option]
|
| 131 |
+
% curly - curly braces are used {option}
|
| 132 |
+
% angle - angle brackets are used <option>
|
| 133 |
+
% semicolon - multiple citations separated by semi-colon (default)
|
| 134 |
+
% colon - same as semicolon, an earlier confusion
|
| 135 |
+
% comma - separated by comma
|
| 136 |
+
% authoryear - selects author-year citations (default)
|
| 137 |
+
% numbers- selects numerical citations
|
| 138 |
+
% super - numerical citations as superscripts
|
| 139 |
+
% sort - sorts multiple citations according to order in ref. list
|
| 140 |
+
% sort&compress - like sort, but also compresses numerical citations
|
| 141 |
+
% compress - compresses without sorting
|
| 142 |
+
% longnamesfirst - makes first citation full author list
|
| 143 |
+
% sectionbib - puts bibliography in a \section* instead of \chapter*
|
| 144 |
+
% merge - allows the citation key to have a * prefix,
|
| 145 |
+
% signifying to merge its reference with that of the previous citation.
|
| 146 |
+
% elide - if references are merged, repeated portions of later ones may be removed.
|
| 147 |
+
% mcite - recognizes and ignores the * prefix for merging.
|
| 148 |
+
% Punctuation so selected dominates over any predefined ones.
|
| 149 |
+
% Package options are called as, e.g.
|
| 150 |
+
% \usepackage[square,comma]{natbib}
|
| 151 |
+
% LaTeX the source file natbib.dtx to obtain more details
|
| 152 |
+
% or the file natnotes.tex for a brief reference sheet.
|
| 153 |
+
%-----------------------------------------------------------
|
| 154 |
+
\providecommand\@ifxundefined[1]{%
|
| 155 |
+
\ifx#1\@undefined\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
|
| 156 |
+
}%
|
| 157 |
+
\providecommand\@ifnum[1]{%
|
| 158 |
+
\ifnum#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
|
| 159 |
+
}%
|
| 160 |
+
\providecommand\@ifx[1]{%
|
| 161 |
+
\ifx#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
|
| 162 |
+
}%
|
| 163 |
+
\providecommand\appdef[2]{%
|
| 164 |
+
\toks@\expandafter{#1}\@temptokena{#2}%
|
| 165 |
+
\edef#1{\the\toks@\the\@temptokena}%
|
| 166 |
+
}%
|
| 167 |
+
\@ifclassloaded{agu2001}{\PackageError{natbib}
|
| 168 |
+
{The agu2001 class already includes natbib coding,\MessageBreak
|
| 169 |
+
so you should not add it explicitly}
|
| 170 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 171 |
+
the command \protect\usepackage{natbib} from the document}
|
| 172 |
+
\endinput}{}
|
| 173 |
+
\@ifclassloaded{agutex}{\PackageError{natbib}
|
| 174 |
+
{The AGUTeX class already includes natbib coding,\MessageBreak
|
| 175 |
+
so you should not add it explicitly}
|
| 176 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 177 |
+
the command \protect\usepackage{natbib} from the document}
|
| 178 |
+
\endinput}{}
|
| 179 |
+
\@ifclassloaded{aguplus}{\PackageError{natbib}
|
| 180 |
+
{The aguplus class already includes natbib coding,\MessageBreak
|
| 181 |
+
so you should not add it explicitly}
|
| 182 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 183 |
+
the command \protect\usepackage{natbib} from the document}
|
| 184 |
+
\endinput}{}
|
| 185 |
+
\@ifclassloaded{nlinproc}{\PackageError{natbib}
|
| 186 |
+
{The nlinproc class already includes natbib coding,\MessageBreak
|
| 187 |
+
so you should not add it explicitly}
|
| 188 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 189 |
+
the command \protect\usepackage{natbib} from the document}
|
| 190 |
+
\endinput}{}
|
| 191 |
+
\@ifclassloaded{egs}{\PackageError{natbib}
|
| 192 |
+
{The egs class already includes natbib coding,\MessageBreak
|
| 193 |
+
so you should not add it explicitly}
|
| 194 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 195 |
+
the command \protect\usepackage{natbib} from the document}
|
| 196 |
+
\endinput}{}
|
| 197 |
+
\@ifclassloaded{egu}{\PackageError{natbib}
|
| 198 |
+
{The egu class already includes natbib coding,\MessageBreak
|
| 199 |
+
so you should not add it explicitly}
|
| 200 |
+
{Type <Return> for now, but then later remove\MessageBreak
|
| 201 |
+
the command \protect\usepackage{natbib} from the document}
|
| 202 |
+
\endinput}{}
|
| 203 |
+
% Define citation punctuation for some author-year styles
|
| 204 |
+
% One may add and delete at this point
|
| 205 |
+
% Or put additions into local configuration file natbib.cfg
|
| 206 |
+
\newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
|
| 207 |
+
\newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
|
| 208 |
+
\newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union
|
| 209 |
+
\newcommand\bibstyle@copernicus{\bibpunct{(}{)}{;}{a}{,}{,}}%Copernicus Publications
|
| 210 |
+
\let\bibstyle@egu=\bibstyle@copernicus
|
| 211 |
+
\let\bibstyle@egs=\bibstyle@copernicus
|
| 212 |
+
\newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
|
| 213 |
+
\newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
|
| 214 |
+
\newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
|
| 215 |
+
\newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics
|
| 216 |
+
\newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci
|
| 217 |
+
\newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae
|
| 218 |
+
\newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.
|
| 219 |
+
% Define citation punctuation for some numerical styles
|
| 220 |
+
\newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
|
| 221 |
+
\gdef\bibnumfmt##1{##1.}}
|
| 222 |
+
\newcommand\bibstyle@esa{\bibpunct{(Ref.~}{)}{,}{n}{}{}%
|
| 223 |
+
\gdef\bibnumfmt##1{##1.\hspace{1em}}}
|
| 224 |
+
\newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%
|
| 225 |
+
\gdef\bibnumfmt##1{##1.}}
|
| 226 |
+
% The standard LaTeX styles
|
| 227 |
+
\newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{,}}
|
| 228 |
+
\let\bibstyle@alpha=\bibstyle@plain
|
| 229 |
+
\let\bibstyle@abbrv=\bibstyle@plain
|
| 230 |
+
\let\bibstyle@unsrt=\bibstyle@plain
|
| 231 |
+
% The author-year modifications of the standard styles
|
| 232 |
+
\newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}
|
| 233 |
+
\let\bibstyle@abbrvnat=\bibstyle@plainnat
|
| 234 |
+
\let\bibstyle@unsrtnat=\bibstyle@plainnat
|
| 235 |
+
\newif\ifNAT@numbers \NAT@numbersfalse
|
| 236 |
+
\newif\ifNAT@super \NAT@superfalse
|
| 237 |
+
\let\NAT@merge\z@
|
| 238 |
+
\DeclareOption{numbers}{\NAT@numberstrue
|
| 239 |
+
\ExecuteOptions{square,comma,nobibstyle}}
|
| 240 |
+
\DeclareOption{super}{\NAT@supertrue\NAT@numberstrue
|
| 241 |
+
\renewcommand\NAT@open{}\renewcommand\NAT@close{}
|
| 242 |
+
\ExecuteOptions{nobibstyle}}
|
| 243 |
+
\DeclareOption{authoryear}{\NAT@numbersfalse
|
| 244 |
+
\ExecuteOptions{round,semicolon,bibstyle}}
|
| 245 |
+
\DeclareOption{round}{%
|
| 246 |
+
\renewcommand\NAT@open{(} \renewcommand\NAT@close{)}
|
| 247 |
+
\ExecuteOptions{nobibstyle}}
|
| 248 |
+
\DeclareOption{square}{%
|
| 249 |
+
\renewcommand\NAT@open{[} \renewcommand\NAT@close{]}
|
| 250 |
+
\ExecuteOptions{nobibstyle}}
|
| 251 |
+
\DeclareOption{angle}{%
|
| 252 |
+
\renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}
|
| 253 |
+
\ExecuteOptions{nobibstyle}}
|
| 254 |
+
\DeclareOption{curly}{%
|
| 255 |
+
\renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}
|
| 256 |
+
\ExecuteOptions{nobibstyle}}
|
| 257 |
+
\DeclareOption{comma}{\renewcommand\NAT@sep{,}
|
| 258 |
+
\ExecuteOptions{nobibstyle}}
|
| 259 |
+
\DeclareOption{semicolon}{\renewcommand\NAT@sep{;}
|
| 260 |
+
\ExecuteOptions{nobibstyle}}
|
| 261 |
+
\DeclareOption{colon}{\ExecuteOptions{semicolon}}
|
| 262 |
+
\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
|
| 263 |
+
\DeclareOption{bibstyle}{\let\bibstyle=\@citestyle}
|
| 264 |
+
\newif\ifNAT@openbib \NAT@openbibfalse
|
| 265 |
+
\DeclareOption{openbib}{\NAT@openbibtrue}
|
| 266 |
+
\DeclareOption{sectionbib}{\def\NAT@sectionbib{on}}
|
| 267 |
+
\def\NAT@sort{\z@}
|
| 268 |
+
\def\NAT@cmprs{\z@}
|
| 269 |
+
\DeclareOption{sort}{\def\NAT@sort{\@ne}}
|
| 270 |
+
\DeclareOption{compress}{\def\NAT@cmprs{\@ne}}
|
| 271 |
+
\DeclareOption{sort&compress}{\def\NAT@sort{\@ne}\def\NAT@cmprs{\@ne}}
|
| 272 |
+
\DeclareOption{mcite}{\let\NAT@merge\@ne}
|
| 273 |
+
\DeclareOption{merge}{\@ifnum{\NAT@merge<\tw@}{\let\NAT@merge\tw@}{}}
|
| 274 |
+
\DeclareOption{elide}{\@ifnum{\NAT@merge<\thr@@}{\let\NAT@merge\thr@@}{}}
|
| 275 |
+
\@ifpackageloaded{cite}{\PackageWarningNoLine{natbib}
|
| 276 |
+
{The `cite' package should not be used\MessageBreak
|
| 277 |
+
with natbib. Use option `sort' instead}\ExecuteOptions{sort}}{}
|
| 278 |
+
\@ifpackageloaded{mcite}{\PackageWarningNoLine{natbib}
|
| 279 |
+
{The `mcite' package should not be used\MessageBreak
|
| 280 |
+
with natbib. Use option `merge' instead}\ExecuteOptions{merge}}{}
|
| 281 |
+
\@ifpackageloaded{citeref}{\PackageError{natbib}
|
| 282 |
+
{The `citeref' package must be loaded after natbib}%
|
| 283 |
+
{Move \protect\usepackage{citeref} to after \string\usepackage{natbib}}}{}
|
| 284 |
+
\newif\ifNAT@longnames\NAT@longnamesfalse
|
| 285 |
+
\DeclareOption{longnamesfirst}{\NAT@longnamestrue}
|
| 286 |
+
\DeclareOption{nonamebreak}{\def\NAT@nmfmt#1{\mbox{\NAT@up#1}}}
|
| 287 |
+
\def\NAT@nmfmt#1{{\NAT@up#1}}
|
| 288 |
+
\renewcommand\bibstyle[1]{\csname bibstyle@#1\endcsname}
|
| 289 |
+
\AtBeginDocument{\global\let\bibstyle=\@gobble}
|
| 290 |
+
\let\@citestyle\bibstyle
|
| 291 |
+
\newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}
|
| 292 |
+
\newcommand\bibpunct[7][, ]%
|
| 293 |
+
{\gdef\NAT@open{#2}\gdef\NAT@close{#3}\gdef
|
| 294 |
+
\NAT@sep{#4}\global\NAT@numbersfalse
|
| 295 |
+
\ifx #5n\global\NAT@numberstrue\global\NAT@superfalse
|
| 296 |
+
\else
|
| 297 |
+
\ifx #5s\global\NAT@numberstrue\global\NAT@supertrue
|
| 298 |
+
\fi\fi
|
| 299 |
+
\gdef\NAT@aysep{#6}\gdef\NAT@yrsep{#7}%
|
| 300 |
+
\gdef\NAT@cmt{#1}%
|
| 301 |
+
\NAT@@setcites
|
| 302 |
+
}
|
| 303 |
+
\newcommand\setcitestyle[1]{
|
| 304 |
+
\@for\@tempa:=#1\do
|
| 305 |
+
{\def\@tempb{round}\ifx\@tempa\@tempb
|
| 306 |
+
\renewcommand\NAT@open{(}\renewcommand\NAT@close{)}\fi
|
| 307 |
+
\def\@tempb{square}\ifx\@tempa\@tempb
|
| 308 |
+
\renewcommand\NAT@open{[}\renewcommand\NAT@close{]}\fi
|
| 309 |
+
\def\@tempb{angle}\ifx\@tempa\@tempb
|
| 310 |
+
\renewcommand\NAT@open{$<$}\renewcommand\NAT@close{$>$}\fi
|
| 311 |
+
\def\@tempb{curly}\ifx\@tempa\@tempb
|
| 312 |
+
\renewcommand\NAT@open{\{}\renewcommand\NAT@close{\}}\fi
|
| 313 |
+
\def\@tempb{semicolon}\ifx\@tempa\@tempb
|
| 314 |
+
\renewcommand\NAT@sep{;}\fi
|
| 315 |
+
\def\@tempb{colon}\ifx\@tempa\@tempb
|
| 316 |
+
\renewcommand\NAT@sep{;}\fi
|
| 317 |
+
\def\@tempb{comma}\ifx\@tempa\@tempb
|
| 318 |
+
\renewcommand\NAT@sep{,}\fi
|
| 319 |
+
\def\@tempb{authoryear}\ifx\@tempa\@tempb
|
| 320 |
+
\NAT@numbersfalse\fi
|
| 321 |
+
\def\@tempb{numbers}\ifx\@tempa\@tempb
|
| 322 |
+
\NAT@numberstrue\NAT@superfalse\fi
|
| 323 |
+
\def\@tempb{super}\ifx\@tempa\@tempb
|
| 324 |
+
\NAT@numberstrue\NAT@supertrue\fi
|
| 325 |
+
\expandafter\NAT@find@eq\@tempa=\relax\@nil
|
| 326 |
+
\if\@tempc\relax\else
|
| 327 |
+
\expandafter\NAT@rem@eq\@tempc
|
| 328 |
+
\def\@tempb{open}\ifx\@tempa\@tempb
|
| 329 |
+
\xdef\NAT@open{\@tempc}\fi
|
| 330 |
+
\def\@tempb{close}\ifx\@tempa\@tempb
|
| 331 |
+
\xdef\NAT@close{\@tempc}\fi
|
| 332 |
+
\def\@tempb{aysep}\ifx\@tempa\@tempb
|
| 333 |
+
\xdef\NAT@aysep{\@tempc}\fi
|
| 334 |
+
\def\@tempb{yysep}\ifx\@tempa\@tempb
|
| 335 |
+
\xdef\NAT@yrsep{\@tempc}\fi
|
| 336 |
+
\def\@tempb{notesep}\ifx\@tempa\@tempb
|
| 337 |
+
\xdef\NAT@cmt{\@tempc}\fi
|
| 338 |
+
\def\@tempb{citesep}\ifx\@tempa\@tempb
|
| 339 |
+
\xdef\NAT@sep{\@tempc}\fi
|
| 340 |
+
\fi
|
| 341 |
+
}%
|
| 342 |
+
\NAT@@setcites
|
| 343 |
+
}
|
| 344 |
+
\def\NAT@find@eq#1=#2\@nil{\def\@tempa{#1}\def\@tempc{#2}}
|
| 345 |
+
\def\NAT@rem@eq#1={\def\@tempc{#1}}
|
| 346 |
+
\def\NAT@@setcites{\global\let\bibstyle\@gobble}
|
| 347 |
+
\AtBeginDocument{\let\NAT@@setcites\NAT@set@cites}
|
| 348 |
+
\newcommand\NAT@open{(} \newcommand\NAT@close{)}
|
| 349 |
+
\newcommand\NAT@sep{;}
|
| 350 |
+
\ProcessOptions
|
| 351 |
+
\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
|
| 352 |
+
\newcommand\NAT@cmt{, }
|
| 353 |
+
\newcommand\NAT@cite%
|
| 354 |
+
[3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
|
| 355 |
+
#1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
|
| 356 |
+
\newcommand\NAT@citenum%
|
| 357 |
+
[3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
|
| 358 |
+
#1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
|
| 359 |
+
\newcommand\NAT@citesuper[3]{\ifNAT@swa
|
| 360 |
+
\if*#2*\else#2\NAT@spacechar\fi
|
| 361 |
+
\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%
|
| 362 |
+
\if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup}
|
| 363 |
+
\providecommand\textsuperscript[1]{\mbox{$^{\mbox{\scriptsize#1}}$}}
|
| 364 |
+
\begingroup \catcode`\_=8
|
| 365 |
+
\gdef\NAT@ifcat@num#1{%
|
| 366 |
+
\ifcat_\ifnum\z@<0#1_\else A\fi
|
| 367 |
+
\expandafter\@firstoftwo
|
| 368 |
+
\else
|
| 369 |
+
\expandafter\@secondoftwo
|
| 370 |
+
\fi
|
| 371 |
+
}%
|
| 372 |
+
\endgroup
|
| 373 |
+
\providecommand\@firstofone[1]{#1}
|
| 374 |
+
\newcommand\NAT@citexnum{}
|
| 375 |
+
\def\NAT@citexnum[#1][#2]#3{%
|
| 376 |
+
\NAT@reset@parser
|
| 377 |
+
\NAT@sort@cites{#3}%
|
| 378 |
+
\NAT@reset@citea
|
| 379 |
+
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
|
| 380 |
+
\@for\@citeb:=\NAT@cite@list\do
|
| 381 |
+
{\@safe@activestrue
|
| 382 |
+
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
|
| 383 |
+
\@safe@activesfalse
|
| 384 |
+
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
|
| 385 |
+
{\reset@font\bfseries?}
|
| 386 |
+
\NAT@citeundefined\PackageWarning{natbib}%
|
| 387 |
+
{Citation `\@citeb' on page \thepage \space undefined}}%
|
| 388 |
+
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
|
| 389 |
+
\NAT@parse{\@citeb}%
|
| 390 |
+
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
|
| 391 |
+
\let\NAT@name=\NAT@all@names
|
| 392 |
+
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
|
| 393 |
+
\fi
|
| 394 |
+
\ifNAT@full\let\NAT@nm\NAT@all@names\else
|
| 395 |
+
\let\NAT@nm\NAT@name\fi
|
| 396 |
+
\ifNAT@swa
|
| 397 |
+
\@ifnum{\NAT@ctype>\@ne}{%
|
| 398 |
+
\@citea
|
| 399 |
+
\NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}%
|
| 400 |
+
}{%
|
| 401 |
+
\@ifnum{\NAT@cmprs>\z@}{%
|
| 402 |
+
\NAT@ifcat@num\NAT@num
|
| 403 |
+
{\let\NAT@nm=\NAT@num}%
|
| 404 |
+
{\def\NAT@nm{-2}}%
|
| 405 |
+
\NAT@ifcat@num\NAT@last@num
|
| 406 |
+
{\@tempcnta=\NAT@last@num\relax}%
|
| 407 |
+
{\@tempcnta\m@ne}%
|
| 408 |
+
\@ifnum{\NAT@nm=\@tempcnta}{%
|
| 409 |
+
\@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%
|
| 410 |
+
}{%
|
| 411 |
+
\advance\@tempcnta by\@ne
|
| 412 |
+
\@ifnum{\NAT@nm=\@tempcnta}{%
|
| 413 |
+
\ifx\NAT@last@yr\relax
|
| 414 |
+
\def@NAT@last@yr{\@citea}%
|
| 415 |
+
\else
|
| 416 |
+
\def@NAT@last@yr{--\NAT@penalty}%
|
| 417 |
+
\fi
|
| 418 |
+
}{%
|
| 419 |
+
\NAT@last@yr@mbox
|
| 420 |
+
}%
|
| 421 |
+
}%
|
| 422 |
+
}{%
|
| 423 |
+
\@tempswatrue
|
| 424 |
+
\@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}%
|
| 425 |
+
\if@tempswa\NAT@citea@mbox\fi
|
| 426 |
+
}%
|
| 427 |
+
}%
|
| 428 |
+
\NAT@def@citea
|
| 429 |
+
\else
|
| 430 |
+
\ifcase\NAT@ctype
|
| 431 |
+
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else
|
| 432 |
+
\@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}%
|
| 433 |
+
\fi
|
| 434 |
+
\if*#1*\else#1\NAT@spacechar\fi
|
| 435 |
+
\NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
|
| 436 |
+
\NAT@def@citea@box
|
| 437 |
+
\or
|
| 438 |
+
\NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
|
| 439 |
+
\or
|
| 440 |
+
\NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
|
| 441 |
+
\or
|
| 442 |
+
\NAT@hyper@citea@space\NAT@alias
|
| 443 |
+
\fi
|
| 444 |
+
\fi
|
| 445 |
+
}%
|
| 446 |
+
}%
|
| 447 |
+
\@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}%
|
| 448 |
+
\ifNAT@swa\else
|
| 449 |
+
\@ifnum{\NAT@ctype=\z@}{%
|
| 450 |
+
\if*#2*\else\NAT@cmt#2\fi
|
| 451 |
+
}{}%
|
| 452 |
+
\NAT@mbox{\NAT@@close}%
|
| 453 |
+
\fi
|
| 454 |
+
}{#1}{#2}%
|
| 455 |
+
}%
|
| 456 |
+
\def\NAT@citea@mbox{%
|
| 457 |
+
\@citea\mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
|
| 458 |
+
}%
|
| 459 |
+
\def\NAT@hyper@#1{%
|
| 460 |
+
\hyper@natlinkstart{\@citeb\@extra@b@citeb}#1\hyper@natlinkend
|
| 461 |
+
}%
|
| 462 |
+
\def\NAT@hyper@citea#1{%
|
| 463 |
+
\@citea
|
| 464 |
+
\NAT@hyper@{#1}%
|
| 465 |
+
\NAT@def@citea
|
| 466 |
+
}%
|
| 467 |
+
\def\NAT@hyper@citea@space#1{%
|
| 468 |
+
\@citea
|
| 469 |
+
\NAT@hyper@{#1}%
|
| 470 |
+
\NAT@def@citea@space
|
| 471 |
+
}%
|
| 472 |
+
\def\def@NAT@last@yr#1{%
|
| 473 |
+
\protected@edef\NAT@last@yr{%
|
| 474 |
+
#1%
|
| 475 |
+
\noexpand\mbox{%
|
| 476 |
+
\noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
|
| 477 |
+
{\noexpand\citenumfont{\NAT@num}}%
|
| 478 |
+
\noexpand\hyper@natlinkend
|
| 479 |
+
}%
|
| 480 |
+
}%
|
| 481 |
+
}%
|
| 482 |
+
\def\NAT@last@yr@mbox{%
|
| 483 |
+
\NAT@last@yr\let\NAT@last@yr\relax
|
| 484 |
+
\NAT@citea@mbox
|
| 485 |
+
}%
|
| 486 |
+
\newcommand\NAT@test[1]{%
|
| 487 |
+
\@ifnum{#1=\@ne}{%
|
| 488 |
+
\ifx\NAT@nm\NAT@noname
|
| 489 |
+
\begingroup\reset@font\bfseries(author?)\endgroup
|
| 490 |
+
\PackageWarning{natbib}{%
|
| 491 |
+
Author undefined for citation`\@citeb' \MessageBreak on page \thepage%
|
| 492 |
+
}%
|
| 493 |
+
\else \NAT@nm
|
| 494 |
+
\fi
|
| 495 |
+
}{%
|
| 496 |
+
\if\relax\NAT@date\relax
|
| 497 |
+
\begingroup\reset@font\bfseries(year?)\endgroup
|
| 498 |
+
\PackageWarning{natbib}{%
|
| 499 |
+
Year undefined for citation`\@citeb' \MessageBreak on page \thepage%
|
| 500 |
+
}%
|
| 501 |
+
\else \NAT@date
|
| 502 |
+
\fi
|
| 503 |
+
}%
|
| 504 |
+
}%
|
| 505 |
+
\let\citenumfont=\@empty
|
| 506 |
+
\newcommand\NAT@citex{}
|
| 507 |
+
\def\NAT@citex%
|
| 508 |
+
[#1][#2]#3{%
|
| 509 |
+
\NAT@reset@parser
|
| 510 |
+
\NAT@sort@cites{#3}%
|
| 511 |
+
\NAT@reset@citea
|
| 512 |
+
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
|
| 513 |
+
\@for\@citeb:=\NAT@cite@list\do
|
| 514 |
+
{\@safe@activestrue
|
| 515 |
+
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
|
| 516 |
+
\@safe@activesfalse
|
| 517 |
+
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
|
| 518 |
+
{\reset@font\bfseries ?}\NAT@citeundefined
|
| 519 |
+
\PackageWarning{natbib}%
|
| 520 |
+
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
|
| 521 |
+
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
|
| 522 |
+
\NAT@parse{\@citeb}%
|
| 523 |
+
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
|
| 524 |
+
\let\NAT@name=\NAT@all@names
|
| 525 |
+
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
|
| 526 |
+
\fi
|
| 527 |
+
\ifNAT@full\let\NAT@nm\NAT@all@names\else
|
| 528 |
+
\let\NAT@nm\NAT@name\fi
|
| 529 |
+
\ifNAT@swa\ifcase\NAT@ctype
|
| 530 |
+
\if\relax\NAT@date\relax
|
| 531 |
+
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%
|
| 532 |
+
\else
|
| 533 |
+
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
|
| 534 |
+
\ifx\NAT@last@yr\NAT@year
|
| 535 |
+
\def\NAT@temp{{?}}%
|
| 536 |
+
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
|
| 537 |
+
{Multiple citation on page \thepage: same authors and
|
| 538 |
+
year\MessageBreak without distinguishing extra
|
| 539 |
+
letter,\MessageBreak appears as question mark}\fi
|
| 540 |
+
\NAT@hyper@{\NAT@exlab}%
|
| 541 |
+
\else\unskip\NAT@spacechar
|
| 542 |
+
\NAT@hyper@{\NAT@date}%
|
| 543 |
+
\fi
|
| 544 |
+
\else
|
| 545 |
+
\@citea\NAT@hyper@{%
|
| 546 |
+
\NAT@nmfmt{\NAT@nm}%
|
| 547 |
+
\hyper@natlinkbreak{%
|
| 548 |
+
\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb
|
| 549 |
+
}%
|
| 550 |
+
\NAT@date
|
| 551 |
+
}%
|
| 552 |
+
\fi
|
| 553 |
+
\fi
|
| 554 |
+
\or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
|
| 555 |
+
\or\@citea\NAT@hyper@{\NAT@date}%
|
| 556 |
+
\or\@citea\NAT@hyper@{\NAT@alias}%
|
| 557 |
+
\fi \NAT@def@citea
|
| 558 |
+
\else
|
| 559 |
+
\ifcase\NAT@ctype
|
| 560 |
+
\if\relax\NAT@date\relax
|
| 561 |
+
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
|
| 562 |
+
\else
|
| 563 |
+
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
|
| 564 |
+
\ifx\NAT@last@yr\NAT@year
|
| 565 |
+
\def\NAT@temp{{?}}%
|
| 566 |
+
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
|
| 567 |
+
{Multiple citation on page \thepage: same authors and
|
| 568 |
+
year\MessageBreak without distinguishing extra
|
| 569 |
+
letter,\MessageBreak appears as question mark}\fi
|
| 570 |
+
\NAT@hyper@{\NAT@exlab}%
|
| 571 |
+
\else
|
| 572 |
+
\unskip\NAT@spacechar
|
| 573 |
+
\NAT@hyper@{\NAT@date}%
|
| 574 |
+
\fi
|
| 575 |
+
\else
|
| 576 |
+
\@citea\NAT@hyper@{%
|
| 577 |
+
\NAT@nmfmt{\NAT@nm}%
|
| 578 |
+
\hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
|
| 579 |
+
{\@citeb\@extra@b@citeb}%
|
| 580 |
+
\NAT@date
|
| 581 |
+
}%
|
| 582 |
+
\fi
|
| 583 |
+
\fi
|
| 584 |
+
\or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
|
| 585 |
+
\or\@citea\NAT@hyper@{\NAT@date}%
|
| 586 |
+
\or\@citea\NAT@hyper@{\NAT@alias}%
|
| 587 |
+
\fi
|
| 588 |
+
\if\relax\NAT@date\relax
|
| 589 |
+
\NAT@def@citea
|
| 590 |
+
\else
|
| 591 |
+
\NAT@def@citea@close
|
| 592 |
+
\fi
|
| 593 |
+
\fi
|
| 594 |
+
}}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
|
| 595 |
+
\if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
|
| 596 |
+
\def\NAT@spacechar{\ }%
|
| 597 |
+
\def\NAT@separator{\NAT@sep\NAT@penalty}%
|
| 598 |
+
\def\NAT@reset@citea{\c@NAT@ctr\@ne\let\@citea\@empty}%
|
| 599 |
+
\def\NAT@def@citea{\def\@citea{\NAT@separator\NAT@space}}%
|
| 600 |
+
\def\NAT@def@citea@space{\def\@citea{\NAT@separator\NAT@spacechar}}%
|
| 601 |
+
\def\NAT@def@citea@close{\def\@citea{\NAT@@close\NAT@separator\NAT@space}}%
|
| 602 |
+
\def\NAT@def@citea@box{\def\@citea{\NAT@mbox{\NAT@@close}\NAT@separator\NAT@spacechar}}%
|
| 603 |
+
\newif\ifNAT@par \NAT@partrue
|
| 604 |
+
\newcommand\NAT@@open{\ifNAT@par\NAT@open\fi}
|
| 605 |
+
\newcommand\NAT@@close{\ifNAT@par\NAT@close\fi}
|
| 606 |
+
\newcommand\NAT@alias{\@ifundefined{al@\@citeb\@extra@b@citeb}{%
|
| 607 |
+
{\reset@font\bfseries(alias?)}\PackageWarning{natbib}
|
| 608 |
+
{Alias undefined for citation `\@citeb'
|
| 609 |
+
\MessageBreak on page \thepage}}{\@nameuse{al@\@citeb\@extra@b@citeb}}}
|
| 610 |
+
\let\NAT@up\relax
|
| 611 |
+
\newcommand\NAT@Up[1]{{\let\protect\@unexpandable@protect\let~\relax
|
| 612 |
+
\expandafter\NAT@deftemp#1}\expandafter\NAT@UP\NAT@temp}
|
| 613 |
+
\newcommand\NAT@deftemp[1]{\xdef\NAT@temp{#1}}
|
| 614 |
+
\newcommand\NAT@UP[1]{\let\@tempa\NAT@UP\ifcat a#1\MakeUppercase{#1}%
|
| 615 |
+
\let\@tempa\relax\else#1\fi\@tempa}
|
| 616 |
+
\newcommand\shortcites[1]{%
|
| 617 |
+
\@bsphack\@for\@citeb:=#1\do
|
| 618 |
+
{\@safe@activestrue
|
| 619 |
+
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
|
| 620 |
+
\@safe@activesfalse
|
| 621 |
+
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}\@esphack}
|
| 622 |
+
\newcommand\NAT@biblabel[1]{\hfill}
|
| 623 |
+
\newcommand\NAT@biblabelnum[1]{\bibnumfmt{#1}}
|
| 624 |
+
\let\bibnumfmt\@empty
|
| 625 |
+
\providecommand\@biblabel[1]{[#1]}
|
| 626 |
+
\AtBeginDocument{\ifx\bibnumfmt\@empty\let\bibnumfmt\@biblabel\fi}
|
| 627 |
+
\newcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
|
| 628 |
+
\setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}%
|
| 629 |
+
\setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%
|
| 630 |
+
\ifNAT@openbib
|
| 631 |
+
\addtolength{\leftmargin}{\bibindent}%
|
| 632 |
+
\setlength{\itemindent}{-\bibindent}%
|
| 633 |
+
\setlength{\listparindent}{\itemindent}%
|
| 634 |
+
\setlength{\parsep}{0pt}%
|
| 635 |
+
\fi
|
| 636 |
+
}
|
| 637 |
+
\newlength{\bibhang}
|
| 638 |
+
\setlength{\bibhang}{1em}
|
| 639 |
+
\newlength{\bibsep}
|
| 640 |
+
{\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
|
| 641 |
+
|
| 642 |
+
\newcommand\NAT@bibsetup%
|
| 643 |
+
[1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\leftmargin}%
|
| 644 |
+
\setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
|
| 645 |
+
\newcommand\NAT@set@cites{%
|
| 646 |
+
\ifNAT@numbers
|
| 647 |
+
\ifNAT@super \let\@cite\NAT@citesuper
|
| 648 |
+
\def\NAT@mbox##1{\unskip\nobreak\textsuperscript{##1}}%
|
| 649 |
+
\let\citeyearpar=\citeyear
|
| 650 |
+
\let\NAT@space\relax
|
| 651 |
+
\def\NAT@super@kern{\kern\p@}%
|
| 652 |
+
\else
|
| 653 |
+
\let\NAT@mbox=\mbox
|
| 654 |
+
\let\@cite\NAT@citenum
|
| 655 |
+
\let\NAT@space\NAT@spacechar
|
| 656 |
+
\let\NAT@super@kern\relax
|
| 657 |
+
\fi
|
| 658 |
+
\let\@citex\NAT@citexnum
|
| 659 |
+
\let\@biblabel\NAT@biblabelnum
|
| 660 |
+
\let\@bibsetup\NAT@bibsetnum
|
| 661 |
+
\renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@num\NAT@close}%
|
| 662 |
+
\def\natexlab##1{}%
|
| 663 |
+
\def\NAT@penalty{\penalty\@m}%
|
| 664 |
+
\else
|
| 665 |
+
\let\@cite\NAT@cite
|
| 666 |
+
\let\@citex\NAT@citex
|
| 667 |
+
\let\@biblabel\NAT@biblabel
|
| 668 |
+
\let\@bibsetup\NAT@bibsetup
|
| 669 |
+
\let\NAT@space\NAT@spacechar
|
| 670 |
+
\let\NAT@penalty\@empty
|
| 671 |
+
\renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}%
|
| 672 |
+
\def\natexlab##1{##1}%
|
| 673 |
+
\fi}
|
| 674 |
+
\AtBeginDocument{\NAT@set@cites}
|
| 675 |
+
\AtBeginDocument{\ifx\SK@def\@undefined\else
|
| 676 |
+
\ifx\SK@cite\@empty\else
|
| 677 |
+
\SK@def\@citex[#1][#2]#3{\SK@\SK@@ref{#3}\SK@@citex[#1][#2]{#3}}\fi
|
| 678 |
+
\ifx\SK@citeauthor\@undefined\def\HAR@checkdef{}\else
|
| 679 |
+
\let\citeauthor\SK@citeauthor
|
| 680 |
+
\let\citefullauthor\SK@citefullauthor
|
| 681 |
+
\let\citeyear\SK@citeyear\fi
|
| 682 |
+
\fi}
|
| 683 |
+
\newif\ifNAT@full\NAT@fullfalse
|
| 684 |
+
\newif\ifNAT@swa
|
| 685 |
+
\DeclareRobustCommand\citet
|
| 686 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
|
| 687 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 688 |
+
\newcommand\NAT@citetp{\@ifnextchar[{\NAT@@citetp}{\NAT@@citetp[]}}
|
| 689 |
+
\newcommand\NAT@@citetp{}
|
| 690 |
+
\def\NAT@@citetp[#1]{\@ifnextchar[{\@citex[#1]}{\@citex[][#1]}}
|
| 691 |
+
\DeclareRobustCommand\citep
|
| 692 |
+
{\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue
|
| 693 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 694 |
+
\DeclareRobustCommand\cite
|
| 695 |
+
{\begingroup\let\NAT@ctype\z@\NAT@partrue\NAT@swatrue
|
| 696 |
+
\@ifstar{\NAT@fulltrue\NAT@cites}{\NAT@fullfalse\NAT@cites}}
|
| 697 |
+
\newcommand\NAT@cites{\@ifnextchar [{\NAT@@citetp}{%
|
| 698 |
+
\ifNAT@numbers\else
|
| 699 |
+
\NAT@swafalse
|
| 700 |
+
\fi
|
| 701 |
+
\NAT@@citetp[]}}
|
| 702 |
+
\DeclareRobustCommand\citealt
|
| 703 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse
|
| 704 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 705 |
+
\DeclareRobustCommand\citealp
|
| 706 |
+
{\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse
|
| 707 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 708 |
+
\DeclareRobustCommand\citenum
|
| 709 |
+
{\begingroup
|
| 710 |
+
\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\let\textsuperscript\NAT@spacechar
|
| 711 |
+
\NAT@citexnum[][]}
|
| 712 |
+
\DeclareRobustCommand\citeauthor
|
| 713 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse
|
| 714 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 715 |
+
\DeclareRobustCommand\Citet
|
| 716 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
|
| 717 |
+
\let\NAT@up\NAT@Up
|
| 718 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 719 |
+
\DeclareRobustCommand\Citep
|
| 720 |
+
{\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue
|
| 721 |
+
\let\NAT@up\NAT@Up
|
| 722 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 723 |
+
\DeclareRobustCommand\Citealt
|
| 724 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse
|
| 725 |
+
\let\NAT@up\NAT@Up
|
| 726 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 727 |
+
\DeclareRobustCommand\Citealp
|
| 728 |
+
{\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse
|
| 729 |
+
\let\NAT@up\NAT@Up
|
| 730 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 731 |
+
\DeclareRobustCommand\Citeauthor
|
| 732 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse
|
| 733 |
+
\let\NAT@up\NAT@Up
|
| 734 |
+
\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
|
| 735 |
+
\DeclareRobustCommand\citeyear
|
| 736 |
+
{\begingroup\NAT@swafalse\let\NAT@ctype\tw@\NAT@parfalse\NAT@citetp}
|
| 737 |
+
\DeclareRobustCommand\citeyearpar
|
| 738 |
+
{\begingroup\NAT@swatrue\let\NAT@ctype\tw@\NAT@partrue\NAT@citetp}
|
| 739 |
+
\newcommand\citetext[1]{\NAT@open#1\NAT@close}
|
| 740 |
+
\DeclareRobustCommand\citefullauthor
|
| 741 |
+
{\citeauthor*}
|
| 742 |
+
\newcommand\defcitealias[2]{%
|
| 743 |
+
\@ifundefined{al@#1\@extra@b@citeb}{}
|
| 744 |
+
{\PackageWarning{natbib}{Overwriting existing alias for citation #1}}
|
| 745 |
+
\@namedef{al@#1\@extra@b@citeb}{#2}}
|
| 746 |
+
\DeclareRobustCommand\citetalias{\begingroup
|
| 747 |
+
\NAT@swafalse\let\NAT@ctype\thr@@\NAT@parfalse\NAT@citetp}
|
| 748 |
+
\DeclareRobustCommand\citepalias{\begingroup
|
| 749 |
+
\NAT@swatrue\let\NAT@ctype\thr@@\NAT@partrue\NAT@citetp}
|
| 750 |
+
\renewcommand\nocite[1]{\@bsphack
|
| 751 |
+
\@for\@citeb:=#1\do{%
|
| 752 |
+
\@safe@activestrue
|
| 753 |
+
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
|
| 754 |
+
\@safe@activesfalse
|
| 755 |
+
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
|
| 756 |
+
\if*\@citeb\else
|
| 757 |
+
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
|
| 758 |
+
\NAT@citeundefined \PackageWarning{natbib}%
|
| 759 |
+
{Citation `\@citeb' undefined}}{}\fi}%
|
| 760 |
+
\@esphack}
|
| 761 |
+
\newcommand\NAT@parse[1]{%
|
| 762 |
+
\begingroup
|
| 763 |
+
\let\protect=\@unexpandable@protect
|
| 764 |
+
\let~\relax
|
| 765 |
+
\let\active@prefix=\@gobble
|
| 766 |
+
\edef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}%
|
| 767 |
+
\aftergroup\NAT@split
|
| 768 |
+
\expandafter
|
| 769 |
+
\endgroup
|
| 770 |
+
\NAT@temp{}{}{}{}{}@@%
|
| 771 |
+
\expandafter\NAT@parse@date\NAT@date??????@@%
|
| 772 |
+
\ifciteindex\NAT@index\fi
|
| 773 |
+
}%
|
| 774 |
+
\def\NAT@split#1#2#3#4#5@@{%
|
| 775 |
+
\gdef\NAT@num{#1}\gdef\NAT@name{#3}\gdef\NAT@date{#2}%
|
| 776 |
+
\gdef\NAT@all@names{#4}%
|
| 777 |
+
\ifx\NAT@num\@empty\gdef\NAT@num{0}\fi
|
| 778 |
+
\ifx\NAT@noname\NAT@all@names \gdef\NAT@all@names{#3}\fi
|
| 779 |
+
}%
|
| 780 |
+
\def\NAT@reset@parser{%
|
| 781 |
+
\global\let\NAT@num\@empty
|
| 782 |
+
\global\let\NAT@name\@empty
|
| 783 |
+
\global\let\NAT@date\@empty
|
| 784 |
+
\global\let\NAT@all@names\@empty
|
| 785 |
+
}%
|
| 786 |
+
\newcommand\NAT@parse@date{}
|
| 787 |
+
\def\NAT@parse@date#1#2#3#4#5#6@@{%
|
| 788 |
+
\ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else
|
| 789 |
+
\ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else
|
| 790 |
+
\ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else
|
| 791 |
+
\ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else
|
| 792 |
+
\def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}
|
| 793 |
+
\newcommand\NAT@index{}
|
| 794 |
+
\let\NAT@makeindex=\makeindex
|
| 795 |
+
\renewcommand\makeindex{\NAT@makeindex
|
| 796 |
+
\renewcommand\NAT@index{\@bsphack\begingroup
|
| 797 |
+
\def~{\string~}\@wrindex{\NAT@idxtxt}}}
|
| 798 |
+
\newcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}
|
| 799 |
+
\@ifxundefined\@indexfile{}{\let\NAT@makeindex\relax\makeindex}
|
| 800 |
+
\newif\ifciteindex \citeindexfalse
|
| 801 |
+
\newcommand\citeindextype{default}
|
| 802 |
+
\newcommand\NAT@index@alt{{\let\protect=\noexpand\let~\relax
|
| 803 |
+
\xdef\NAT@temp{\NAT@idxtxt}}\expandafter\NAT@exp\NAT@temp\@nil}
|
| 804 |
+
\newcommand\NAT@exp{}
|
| 805 |
+
\def\NAT@exp#1\@nil{\index[\citeindextype]{#1}}
|
| 806 |
+
|
| 807 |
+
\AtBeginDocument{%
|
| 808 |
+
\@ifpackageloaded{index}{\let\NAT@index=\NAT@index@alt}{}}
|
| 809 |
+
\newcommand\NAT@ifcmd{\futurelet\NAT@temp\NAT@ifxcmd}
|
| 810 |
+
\newcommand\NAT@ifxcmd{\ifx\NAT@temp\relax\else\expandafter\NAT@bare\fi}
|
| 811 |
+
\def\NAT@bare#1(#2)#3(@)#4\@nil#5{%
|
| 812 |
+
\if @#2
|
| 813 |
+
\expandafter\NAT@apalk#1, , \@nil{#5}%
|
| 814 |
+
\else
|
| 815 |
+
\NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{#3}{#5}%
|
| 816 |
+
\fi
|
| 817 |
+
}
|
| 818 |
+
\newcommand\NAT@wrout[5]{%
|
| 819 |
+
\if@filesw
|
| 820 |
+
{\let\protect\noexpand\let~\relax
|
| 821 |
+
\immediate
|
| 822 |
+
\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
|
| 823 |
+
\ignorespaces}
|
| 824 |
+
\def\NAT@noname{{}}
|
| 825 |
+
\renewcommand\bibitem{\@ifnextchar[{\@lbibitem}{\@lbibitem[]}}%
|
| 826 |
+
\let\NAT@bibitem@first@sw\@secondoftwo
|
| 827 |
+
\def\@lbibitem[#1]#2{%
|
| 828 |
+
\if\relax\@extra@b@citeb\relax\else
|
| 829 |
+
\@ifundefined{br@#2\@extra@b@citeb}{}{%
|
| 830 |
+
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}%
|
| 831 |
+
}%
|
| 832 |
+
\fi
|
| 833 |
+
\@ifundefined{b@#2\@extra@b@citeb}{%
|
| 834 |
+
\def\NAT@num{}%
|
| 835 |
+
}{%
|
| 836 |
+
\NAT@parse{#2}%
|
| 837 |
+
}%
|
| 838 |
+
\def\NAT@tmp{#1}%
|
| 839 |
+
\expandafter\let\expandafter\bibitemOpen\csname NAT@b@open@#2\endcsname
|
| 840 |
+
\expandafter\let\expandafter\bibitemShut\csname NAT@b@shut@#2\endcsname
|
| 841 |
+
\@ifnum{\NAT@merge>\@ne}{%
|
| 842 |
+
\NAT@bibitem@first@sw{%
|
| 843 |
+
\@firstoftwo
|
| 844 |
+
}{%
|
| 845 |
+
\@ifundefined{NAT@b*@#2}{%
|
| 846 |
+
\@firstoftwo
|
| 847 |
+
}{%
|
| 848 |
+
\expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
|
| 849 |
+
\@secondoftwo
|
| 850 |
+
}%
|
| 851 |
+
}%
|
| 852 |
+
}{%
|
| 853 |
+
\@firstoftwo
|
| 854 |
+
}%
|
| 855 |
+
{%
|
| 856 |
+
\global\advance\c@NAT@ctr\@ne
|
| 857 |
+
\@ifx{\NAT@tmp\@empty}{\@firstoftwo}{%
|
| 858 |
+
\@secondoftwo
|
| 859 |
+
}%
|
| 860 |
+
{%
|
| 861 |
+
\expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
|
| 862 |
+
\global\NAT@stdbsttrue
|
| 863 |
+
}{}%
|
| 864 |
+
\bibitem@fin
|
| 865 |
+
\item[\hfil\NAT@anchor{#2}{\NAT@num}]%
|
| 866 |
+
\global\let\NAT@bibitem@first@sw\@secondoftwo
|
| 867 |
+
\NAT@bibitem@init
|
| 868 |
+
}%
|
| 869 |
+
{%
|
| 870 |
+
\NAT@anchor{#2}{}%
|
| 871 |
+
\NAT@bibitem@cont
|
| 872 |
+
\bibitem@fin
|
| 873 |
+
}%
|
| 874 |
+
\@ifx{\NAT@tmp\@empty}{%
|
| 875 |
+
\NAT@wrout{\the\c@NAT@ctr}{}{}{}{#2}%
|
| 876 |
+
}{%
|
| 877 |
+
\expandafter\NAT@ifcmd\NAT@tmp(@)(@)\@nil{#2}%
|
| 878 |
+
}%
|
| 879 |
+
}%
|
| 880 |
+
\def\bibitem@fin{%
|
| 881 |
+
\@ifxundefined\@bibstop{}{\csname bibitem@\@bibstop\endcsname}%
|
| 882 |
+
}%
|
| 883 |
+
\def\NAT@bibitem@init{%
|
| 884 |
+
\let\@bibstop\@undefined
|
| 885 |
+
}%
|
| 886 |
+
\def\NAT@bibitem@cont{%
|
| 887 |
+
\let\bibitem@Stop\bibitemStop
|
| 888 |
+
\let\bibitem@NoStop\bibitemContinue
|
| 889 |
+
}%
|
| 890 |
+
\def\BibitemOpen{%
|
| 891 |
+
\bibitemOpen
|
| 892 |
+
}%
|
| 893 |
+
\def\BibitemShut#1{%
|
| 894 |
+
\bibitemShut
|
| 895 |
+
\def\@bibstop{#1}%
|
| 896 |
+
\let\bibitem@Stop\bibitemStop
|
| 897 |
+
\let\bibitem@NoStop\bibitemNoStop
|
| 898 |
+
}%
|
| 899 |
+
\def\bibitemStop{}%
|
| 900 |
+
\def\bibitemNoStop{.\spacefactor\@mmm\space}%
|
| 901 |
+
\def\bibitemContinue{\spacefactor\@mmm\space}%
|
| 902 |
+
\mathchardef\@mmm=3000 %
|
| 903 |
+
\providecommand{\bibAnnote}[3]{%
|
| 904 |
+
\BibitemShut{#1}%
|
| 905 |
+
\def\@tempa{#3}\@ifx{\@tempa\@empty}{}{%
|
| 906 |
+
\begin{quotation}\noindent
|
| 907 |
+
\textsc{Key:}\ #2\\\textsc{Annotation:}\ \@tempa
|
| 908 |
+
\end{quotation}%
|
| 909 |
+
}%
|
| 910 |
+
}%
|
| 911 |
+
\providecommand{\bibAnnoteFile}[2]{%
|
| 912 |
+
\IfFileExists{#2}{%
|
| 913 |
+
\bibAnnote{#1}{#2}{\input{#2}}%
|
| 914 |
+
}{%
|
| 915 |
+
\bibAnnote{#1}{#2}{}%
|
| 916 |
+
}%
|
| 917 |
+
}%
|
| 918 |
+
\let\bibitemOpen\relax
|
| 919 |
+
\let\bibitemShut\relax
|
| 920 |
+
\def\bibfield{\@ifnum{\NAT@merge>\tw@}{\@bibfield}{\@secondoftwo}}%
|
| 921 |
+
\def\@bibfield#1#2{%
|
| 922 |
+
\begingroup
|
| 923 |
+
\let\Doi\@gobble
|
| 924 |
+
\let\bibinfo\relax
|
| 925 |
+
\let\restore@protect\@empty
|
| 926 |
+
\protected@edef\@tempa{#2}%
|
| 927 |
+
\aftergroup\def\aftergroup\@tempa
|
| 928 |
+
\expandafter\endgroup\expandafter{\@tempa}%
|
| 929 |
+
\expandafter\@ifx\expandafter{\csname @bib#1\endcsname\@tempa}{%
|
| 930 |
+
\expandafter\let\expandafter\@tempa\csname @bib@X#1\endcsname
|
| 931 |
+
}{%
|
| 932 |
+
\expandafter\let\csname @bib#1\endcsname\@tempa
|
| 933 |
+
\expandafter\let\expandafter\@tempa\csname @bib@Y#1\endcsname
|
| 934 |
+
}%
|
| 935 |
+
\@ifx{\@tempa\relax}{\let\@tempa\@firstofone}{}%
|
| 936 |
+
\@tempa{#2}%
|
| 937 |
+
}%
|
| 938 |
+
\def\bibinfo#1{%
|
| 939 |
+
\expandafter\let\expandafter\@tempa\csname bibinfo@X@#1\endcsname
|
| 940 |
+
\@ifx{\@tempa\relax}{\@firstofone}{\@tempa}%
|
| 941 |
+
}%
|
| 942 |
+
\def\@bib@Xauthor#1{\let\@bib@Xjournal\@gobble}%
|
| 943 |
+
\def\@bib@Xjournal#1{\begingroup\let\bibinfo@X@journal\@bib@Z@journal#1\endgroup}%
|
| 944 |
+
\def\@bibibid@#1{\textit{ibid}.}%
|
| 945 |
+
\appdef\NAT@bibitem@init{%
|
| 946 |
+
\let\@bibauthor \@empty
|
| 947 |
+
\let\@bibjournal \@empty
|
| 948 |
+
\let\@bib@Z@journal\@bibibid@
|
| 949 |
+
}%
|
| 950 |
+
\ifx\SK@lbibitem\@undefined\else
|
| 951 |
+
\let\SK@lbibitem\@lbibitem
|
| 952 |
+
\def\@lbibitem[#1]#2{%
|
| 953 |
+
\SK@lbibitem[#1]{#2}\SK@\SK@@label{#2}\ignorespaces}\fi
|
| 954 |
+
\newif\ifNAT@stdbst \NAT@stdbstfalse
|
| 955 |
+
|
| 956 |
+
\AtEndDocument{%
|
| 957 |
+
\ifNAT@stdbst\if@filesw
|
| 958 |
+
\immediate\write\@auxout{%
|
| 959 |
+
\string\providecommand\string\NAT@force@numbers{}%
|
| 960 |
+
\string\NAT@force@numbers
|
| 961 |
+
}%
|
| 962 |
+
\fi\fi
|
| 963 |
+
}
|
| 964 |
+
\newcommand\NAT@force@numbers{%
|
| 965 |
+
\ifNAT@numbers\else
|
| 966 |
+
\PackageError{natbib}{Bibliography not compatible with author-year
|
| 967 |
+
citations.\MessageBreak
|
| 968 |
+
Press <return> to continue in numerical citation style}
|
| 969 |
+
{Check the bibliography entries for non-compliant syntax,\MessageBreak
|
| 970 |
+
or select author-year BibTeX style, e.g. plainnat}%
|
| 971 |
+
\global\NAT@numberstrue\fi}
|
| 972 |
+
|
| 973 |
+
\providecommand\bibcite{}
|
| 974 |
+
\renewcommand\bibcite[2]{%
|
| 975 |
+
\@ifundefined{b@#1\@extra@binfo}{\relax}{%
|
| 976 |
+
\NAT@citemultiple
|
| 977 |
+
\PackageWarningNoLine{natbib}{Citation `#1' multiply defined}%
|
| 978 |
+
}%
|
| 979 |
+
\global\@namedef{b@#1\@extra@binfo}{#2}%
|
| 980 |
+
}%
|
| 981 |
+
\AtEndDocument{\NAT@swatrue\let\bibcite\NAT@testdef}
|
| 982 |
+
\newcommand\NAT@testdef[2]{%
|
| 983 |
+
\def\NAT@temp{#2}%
|
| 984 |
+
\expandafter \ifx \csname b@#1\@extra@binfo\endcsname\NAT@temp
|
| 985 |
+
\else
|
| 986 |
+
\ifNAT@swa \NAT@swafalse
|
| 987 |
+
\PackageWarningNoLine{natbib}{%
|
| 988 |
+
Citation(s) may have changed.\MessageBreak
|
| 989 |
+
Rerun to get citations correct%
|
| 990 |
+
}%
|
| 991 |
+
\fi
|
| 992 |
+
\fi
|
| 993 |
+
}%
|
| 994 |
+
\newcommand\NAT@apalk{}
|
| 995 |
+
\def\NAT@apalk#1, #2, #3\@nil#4{%
|
| 996 |
+
\if\relax#2\relax
|
| 997 |
+
\global\NAT@stdbsttrue
|
| 998 |
+
\NAT@wrout{#1}{}{}{}{#4}%
|
| 999 |
+
\else
|
| 1000 |
+
\NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%
|
| 1001 |
+
\fi
|
| 1002 |
+
}%
|
| 1003 |
+
\newcommand\citeauthoryear{}
|
| 1004 |
+
\def\citeauthoryear#1#2#3(@)(@)\@nil#4{%
|
| 1005 |
+
\if\relax#3\relax
|
| 1006 |
+
\NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%
|
| 1007 |
+
\else
|
| 1008 |
+
\NAT@wrout{\the\c@NAT@ctr}{#3}{#2}{#1}{#4}%
|
| 1009 |
+
\fi
|
| 1010 |
+
}%
|
| 1011 |
+
\newcommand\citestarts{\NAT@open}%
|
| 1012 |
+
\newcommand\citeends{\NAT@close}%
|
| 1013 |
+
\newcommand\betweenauthors{and}%
|
| 1014 |
+
\newcommand\astroncite{}
|
| 1015 |
+
\def\astroncite#1#2(@)(@)\@nil#3{%
|
| 1016 |
+
\NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#3}%
|
| 1017 |
+
}%
|
| 1018 |
+
\newcommand\citename{}
|
| 1019 |
+
\def\citename#1#2(@)(@)\@nil#3{\expandafter\NAT@apalk#1#2, \@nil{#3}}
|
| 1020 |
+
\newcommand\harvarditem[4][]{%
|
| 1021 |
+
\if\relax#1\relax
|
| 1022 |
+
\bibitem[#2(#3)]{#4}%
|
| 1023 |
+
\else
|
| 1024 |
+
\bibitem[#1(#3)#2]{#4}%
|
| 1025 |
+
\fi
|
| 1026 |
+
}%
|
| 1027 |
+
\newcommand\harvardleft{\NAT@open}
|
| 1028 |
+
\newcommand\harvardright{\NAT@close}
|
| 1029 |
+
\newcommand\harvardyearleft{\NAT@open}
|
| 1030 |
+
\newcommand\harvardyearright{\NAT@close}
|
| 1031 |
+
\AtBeginDocument{\providecommand{\harvardand}{and}}
|
| 1032 |
+
\newcommand\harvardurl[1]{\textbf{URL:} \textit{#1}}
|
| 1033 |
+
\providecommand\bibsection{}
|
| 1034 |
+
\@ifundefined{chapter}{%
|
| 1035 |
+
\renewcommand\bibsection{%
|
| 1036 |
+
\section*{\refname\@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}%
|
| 1037 |
+
}%
|
| 1038 |
+
}{%
|
| 1039 |
+
\@ifxundefined\NAT@sectionbib{%
|
| 1040 |
+
\renewcommand\bibsection{%
|
| 1041 |
+
\chapter*{\bibname\@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}%
|
| 1042 |
+
}%
|
| 1043 |
+
}{%
|
| 1044 |
+
\renewcommand\bibsection{%
|
| 1045 |
+
\section*{\bibname\ifx\@mkboth\@gobbletwo\else\markright{\MakeUppercase{\bibname}}\fi}%
|
| 1046 |
+
}%
|
| 1047 |
+
}%
|
| 1048 |
+
}%
|
| 1049 |
+
\@ifclassloaded{amsart}{\renewcommand\bibsection{\section*{\refname}}}{}%
|
| 1050 |
+
\@ifclassloaded{amsbook}{\renewcommand\bibsection{\chapter*{\bibname}}}{}%
|
| 1051 |
+
\@ifxundefined\bib@heading{}{\let\bibsection\bib@heading}%
|
| 1052 |
+
\newcounter{NAT@ctr}
|
| 1053 |
+
\renewenvironment{thebibliography}[1]{%
|
| 1054 |
+
\bibsection
|
| 1055 |
+
\parindent\z@
|
| 1056 |
+
\bibpreamble
|
| 1057 |
+
\bibfont
|
| 1058 |
+
\list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%
|
| 1059 |
+
\ifNAT@openbib
|
| 1060 |
+
\renewcommand\newblock{\par}%
|
| 1061 |
+
\else
|
| 1062 |
+
\renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
|
| 1063 |
+
\fi
|
| 1064 |
+
\sloppy\clubpenalty4000\widowpenalty4000
|
| 1065 |
+
\sfcode`\.\@m
|
| 1066 |
+
\let\NAT@bibitem@first@sw\@firstoftwo
|
| 1067 |
+
\let\citeN\cite \let\shortcite\cite
|
| 1068 |
+
\let\citeasnoun\cite
|
| 1069 |
+
}{%
|
| 1070 |
+
\bibitem@fin
|
| 1071 |
+
\bibpostamble
|
| 1072 |
+
\def\@noitemerr{%
|
| 1073 |
+
\PackageWarning{natbib}{Empty `thebibliography' environment}%
|
| 1074 |
+
}%
|
| 1075 |
+
\endlist
|
| 1076 |
+
\bibcleanup
|
| 1077 |
+
}%
|
| 1078 |
+
\let\bibfont\@empty
|
| 1079 |
+
\let\bibpreamble\@empty
|
| 1080 |
+
\let\bibpostamble\@empty
|
| 1081 |
+
\def\bibcleanup{\vskip-\lastskip}%
|
| 1082 |
+
\providecommand\reset@font{\relax}
|
| 1083 |
+
\providecommand\bibname{Bibliography}
|
| 1084 |
+
\providecommand\refname{References}
|
| 1085 |
+
\newcommand\NAT@citeundefined{\gdef \NAT@undefined {%
|
| 1086 |
+
\PackageWarningNoLine{natbib}{There were undefined citations}}}
|
| 1087 |
+
\let \NAT@undefined \relax
|
| 1088 |
+
\newcommand\NAT@citemultiple{\gdef \NAT@multiple {%
|
| 1089 |
+
\PackageWarningNoLine{natbib}{There were multiply defined citations}}}
|
| 1090 |
+
\let \NAT@multiple \relax
|
| 1091 |
+
\AtEndDocument{\NAT@undefined\NAT@multiple}
|
| 1092 |
+
\providecommand\@mkboth[2]{}
|
| 1093 |
+
\providecommand\MakeUppercase{\uppercase}
|
| 1094 |
+
\providecommand{\@extra@b@citeb}{}
|
| 1095 |
+
\gdef\@extra@binfo{}
|
| 1096 |
+
\def\NAT@anchor#1#2{%
|
| 1097 |
+
\hyper@natanchorstart{#1\@extra@b@citeb}%
|
| 1098 |
+
\def\@tempa{#2}\@ifx{\@tempa\@empty}{}{\@biblabel{#2}}%
|
| 1099 |
+
\hyper@natanchorend
|
| 1100 |
+
}%
|
| 1101 |
+
\providecommand\hyper@natanchorstart[1]{}%
|
| 1102 |
+
\providecommand\hyper@natanchorend{}%
|
| 1103 |
+
\providecommand\hyper@natlinkstart[1]{}%
|
| 1104 |
+
\providecommand\hyper@natlinkend{}%
|
| 1105 |
+
\providecommand\hyper@natlinkbreak[2]{#1}%
|
| 1106 |
+
\AtBeginDocument{%
|
| 1107 |
+
\@ifpackageloaded{babel}{%
|
| 1108 |
+
\let\org@@citex\@citex}{}}
|
| 1109 |
+
\providecommand\@safe@activestrue{}%
|
| 1110 |
+
\providecommand\@safe@activesfalse{}%
|
| 1111 |
+
|
| 1112 |
+
\newcommand\NAT@sort@cites[1]{%
|
| 1113 |
+
\let\NAT@cite@list\@empty
|
| 1114 |
+
\@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}%
|
| 1115 |
+
\if@filesw
|
| 1116 |
+
\expandafter\immediate\expandafter\write\expandafter\@auxout
|
| 1117 |
+
\expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}%
|
| 1118 |
+
\fi
|
| 1119 |
+
\@ifnum{\NAT@sort>\z@}{%
|
| 1120 |
+
\expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}%
|
| 1121 |
+
}{}%
|
| 1122 |
+
}%
|
| 1123 |
+
\def\NAT@star@cite{%
|
| 1124 |
+
\let\NAT@star@sw\@secondoftwo
|
| 1125 |
+
\@ifnum{\NAT@merge>\z@}{%
|
| 1126 |
+
\@ifnextchar*{%
|
| 1127 |
+
\let\NAT@star@sw\@firstoftwo
|
| 1128 |
+
\NAT@star@cite@star
|
| 1129 |
+
}{%
|
| 1130 |
+
\NAT@star@cite@nostar
|
| 1131 |
+
}%
|
| 1132 |
+
}{%
|
| 1133 |
+
\NAT@star@cite@noextension
|
| 1134 |
+
}%
|
| 1135 |
+
}%
|
| 1136 |
+
\def\NAT@star@cite@star*{%
|
| 1137 |
+
\NAT@star@cite@nostar
|
| 1138 |
+
}%
|
| 1139 |
+
\def\NAT@star@cite@nostar{%
|
| 1140 |
+
\let\nat@keyopt@open\@empty
|
| 1141 |
+
\let\nat@keyopt@shut\@empty
|
| 1142 |
+
\@ifnextchar[{\NAT@star@cite@pre}{\NAT@star@cite@pre[]}%
|
| 1143 |
+
}%
|
| 1144 |
+
\def\NAT@star@cite@pre[#1]{%
|
| 1145 |
+
\def\nat@keyopt@open{#1}%
|
| 1146 |
+
\@ifnextchar[{\NAT@star@cite@post}{\NAT@star@cite@post[]}%
|
| 1147 |
+
}%
|
| 1148 |
+
\def\NAT@star@cite@post[#1]#2\@@{%
|
| 1149 |
+
\def\nat@keyopt@shut{#1}%
|
| 1150 |
+
\NAT@star@sw{\expandafter\global\expandafter\let\csname NAT@b*@#2\endcsname\@empty}{}%
|
| 1151 |
+
\NAT@cite@list@append{#2}%
|
| 1152 |
+
}%
|
| 1153 |
+
\def\NAT@star@cite@noextension#1\@@{%
|
| 1154 |
+
\let\nat@keyopt@open\@empty
|
| 1155 |
+
\let\nat@keyopt@shut\@empty
|
| 1156 |
+
\NAT@cite@list@append{#1}%
|
| 1157 |
+
}%
|
| 1158 |
+
\def\NAT@cite@list@append#1{%
|
| 1159 |
+
\edef\@citeb{\@firstofone#1\@empty}%
|
| 1160 |
+
\if@filesw\@ifxundefined\@cprwrite{}{\expandafter\@cprwrite\@citeb=}\fi
|
| 1161 |
+
\if\relax\nat@keyopt@open\relax\else
|
| 1162 |
+
\global\expandafter\let\csname NAT@b@open@\@citeb\endcsname\nat@keyopt@open
|
| 1163 |
+
\fi
|
| 1164 |
+
\if\relax\nat@keyopt@shut\relax\else
|
| 1165 |
+
\global\expandafter\let\csname NAT@b@shut@\@citeb\endcsname\nat@keyopt@shut
|
| 1166 |
+
\fi
|
| 1167 |
+
\toks@\expandafter{\NAT@cite@list}%
|
| 1168 |
+
\ifx\NAT@cite@list\@empty
|
| 1169 |
+
\@temptokena\expandafter{\@citeb}%
|
| 1170 |
+
\else
|
| 1171 |
+
\@temptokena\expandafter{\expandafter,\@citeb}%
|
| 1172 |
+
\fi
|
| 1173 |
+
\edef\NAT@cite@list{\the\toks@\the\@temptokena}%
|
| 1174 |
+
}%
|
| 1175 |
+
\newcommand\NAT@sort@cites@[1]{%
|
| 1176 |
+
\count@\z@
|
| 1177 |
+
\@tempcntb\m@ne
|
| 1178 |
+
\let\@celt\delimiter
|
| 1179 |
+
\def\NAT@num@list{}%
|
| 1180 |
+
\let\NAT@cite@list\@empty
|
| 1181 |
+
\let\NAT@nonsort@list\@empty
|
| 1182 |
+
\@for \@citeb:=#1\do{\NAT@make@cite@list}%
|
| 1183 |
+
\ifx\NAT@nonsort@list\@empty\else
|
| 1184 |
+
\protected@edef\NAT@cite@list{\NAT@cite@list\NAT@nonsort@list}%
|
| 1185 |
+
\fi
|
| 1186 |
+
\ifx\NAT@cite@list\@empty\else
|
| 1187 |
+
\protected@edef\NAT@cite@list{\expandafter\NAT@xcom\NAT@cite@list @@}%
|
| 1188 |
+
\fi
|
| 1189 |
+
}%
|
| 1190 |
+
\def\NAT@make@cite@list{%
|
| 1191 |
+
\advance\count@\@ne
|
| 1192 |
+
\@safe@activestrue
|
| 1193 |
+
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
|
| 1194 |
+
\@safe@activesfalse
|
| 1195 |
+
\@ifundefined{b@\@citeb\@extra@b@citeb}%
|
| 1196 |
+
{\def\NAT@num{A}}%
|
| 1197 |
+
{\NAT@parse{\@citeb}}%
|
| 1198 |
+
\NAT@ifcat@num\NAT@num
|
| 1199 |
+
{\@tempcnta\NAT@num \relax
|
| 1200 |
+
\@ifnum{\@tempcnta<\@tempcntb}{%
|
| 1201 |
+
\let\NAT@@cite@list=\NAT@cite@list
|
| 1202 |
+
\let\NAT@cite@list\@empty
|
| 1203 |
+
\begingroup\let\@celt=\NAT@celt\NAT@num@list\endgroup
|
| 1204 |
+
\protected@edef\NAT@num@list{%
|
| 1205 |
+
\expandafter\NAT@num@celt \NAT@num@list \@gobble @%
|
| 1206 |
+
}%
|
| 1207 |
+
}{%
|
| 1208 |
+
\protected@edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
|
| 1209 |
+
\protected@edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
|
| 1210 |
+
\@tempcntb\@tempcnta
|
| 1211 |
+
}%
|
| 1212 |
+
}%
|
| 1213 |
+
{\protected@edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}}%
|
| 1214 |
+
}%
|
| 1215 |
+
\def\NAT@celt#1{%
|
| 1216 |
+
\@ifnum{#1>\@tempcnta}{%
|
| 1217 |
+
\xdef\NAT@cite@list{\NAT@cite@list\@citeb,\NAT@@cite@list}%
|
| 1218 |
+
\let\@celt\@gobble
|
| 1219 |
+
}{%
|
| 1220 |
+
\expandafter\def@NAT@cite@lists\NAT@@cite@list\@@
|
| 1221 |
+
}%
|
| 1222 |
+
}%
|
| 1223 |
+
\def\NAT@num@celt#1#2{%
|
| 1224 |
+
\ifx#1\@celt
|
| 1225 |
+
\@ifnum{#2>\@tempcnta}{%
|
| 1226 |
+
\@celt{\number\@tempcnta}%
|
| 1227 |
+
\@celt{#2}%
|
| 1228 |
+
}{%
|
| 1229 |
+
\@celt{#2}%
|
| 1230 |
+
\expandafter\NAT@num@celt
|
| 1231 |
+
}%
|
| 1232 |
+
\fi
|
| 1233 |
+
}%
|
| 1234 |
+
\def\def@NAT@cite@lists#1,#2\@@{%
|
| 1235 |
+
\xdef\NAT@cite@list{\NAT@cite@list#1,}%
|
| 1236 |
+
\xdef\NAT@@cite@list{#2}%
|
| 1237 |
+
}%
|
| 1238 |
+
\def\NAT@nextc#1,#2@@{#1,}
|
| 1239 |
+
\def\NAT@restc#1,#2{#2}
|
| 1240 |
+
\def\NAT@xcom#1,@@{#1}
|
| 1241 |
+
\InputIfFileExists{natbib.cfg}
|
| 1242 |
+
{\typeout{Local config file natbib.cfg used}}{}
|
| 1243 |
+
%%
|
| 1244 |
+
%% <<<<< End of generated file <<<<<<
|
| 1245 |
+
%%
|
| 1246 |
+
%% End of file `natbib.sty'.
|
gmnet/project/gmnet_tpami/reference/source/sec/0_abstract.tex
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\begin{abstract}
|
| 2 |
+
Lightweight neural networks, essential for on-device applications, often suffer from a low-frequency bias due to their constrained capacity and depth.
|
| 3 |
+
This limits their ability to capture the fine-grained, high-frequency details (e.g., textures, edges) that are crucial for complex computer vision tasks. To address this fundamental limitation, we perform the first systematic analysis of gating mechanisms from a frequency perspective.
|
| 4 |
+
Inspired by the convolution theorem, we show how the interplay between element-wise multiplication and non-linear activation functions within Gated Linear Units (GLUs) provides a powerful mechanism to selectively amplify high-frequency signals, thereby enriching the model's feature representations.
|
| 5 |
+
Based on these findings, we introduce the Gating Mechanism Network (GmNet), a simple yet highly effective architecture that incorporates our frequency-aware gating principles into a standard lightweight backbone. The efficacy of our approach is remarkable: without relying on complex training strategies or architectural search, GmNet achieves a new state-of-the-art for efficient models. Our code can be found in \href{https://github.com/YFWang1999/GmNet}{https://github.com/YFWang1999/GmNet}
|
| 6 |
+
%Vision network designs, including Convolutional Neural
|
| 7 |
+
%Networks and Vision Transformers, have significantly advanced the field of computer vision.
|
| 8 |
+
%Yet, their complex computations pose challenges for practical deployments, particularly in real-time applications. To tackle this issue, researchers have explored various lightweight and efficient
|
| 9 |
+
%network designs. However, existing lightweight models leveraging self-attention mechanisms and convolutions neglect the capture of the high-frequency.
|
| 10 |
+
% Gating mechanisms have emerged as an effective strategy integrated into model designs beyond recurrent neural networks for addressing long-range dependency problems.
|
| 11 |
+
% In a broad understanding, it provides adaptive control over the information flow while maintaining computational efficiency.
|
| 12 |
+
% However, there is a lack of theoretical analysis on how the gating mechanism works in neural networks.
|
| 13 |
+
% In this paper, inspired by the \textit{convolution theorem}, we systematically explore the effect of gating mechanisms on the training dynamics of neural networks from a frequency perspective.
|
| 14 |
+
% We investigate the interact between the element-wise product and activation functions in managing the responses to different frequency components.
|
| 15 |
+
% Leveraging these insights, we propose a Gating Mechanism Network (GmNet), a lightweight model designed to efficiently utilize the information of various frequency components.
|
| 16 |
+
% It minimizes the low-frequency bias present in existing lightweight models.
|
| 17 |
+
% GmNet achieves impressive performance in terms of both effectiveness and efficiency in the image classification task.
|
| 18 |
+
% Gating mechanisms have emerged as an effective strategy for addressing long-range dependency problems in model designs beyond recurrent neural networks. Broadly speaking, these mechanisms provide adaptive control over information flow while maintaining computational efficiency. However, a significant gap exists in the theoretical analysis of how they function within neural networks. In this paper, inspired by the convolution theorem, we systematically explore the effect of gating mechanisms on the training dynamics of neural networks from a frequency perspective. We investigate the interaction between element-wise products and activation functions in managing responses to different frequency components. Leveraging these insights, we propose a Gating Mechanism Network (GmNet), a lightweight model designed to efficiently utilize information from various frequency components. GmNet minimizes the low-frequency bias present in existing lightweight models and achieves impressive performance in both effectiveness and efficiency for the image classification task.
|
| 19 |
+
%Our code is public at \href{https://github.com/YFWang1999/GmNet}{https://github.com/YFWang1999/GmNet}
|
| 20 |
+
%XXXX achieves over $81\%$ top-1 accuracy on ImageNet-1K with only $2.9$ ms latency on an A100 GPU, surpassing state-of-the-art efficient models by a significant margin.
|
| 21 |
+
\end{abstract}
|
gmnet/project/gmnet_tpami/reference/source/sec/1_intro.tex
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\section{Introduction}
|
| 2 |
+
\label{sec:intro}
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
Designing neural networks that are both highly accurate and computationally efficient is a central challenge in modern vision task.
|
| 6 |
+
Lightweight models are essential for on-device applications, but their reduced capacity often limits their ability to capture the fine-grained details necessary for complex recognition tasks.
|
| 7 |
+
A growing body of research suggests this limitation stems from a spectral bias, where standard neural network architectures preferentially learn simple, low-frequency global patterns while struggling to capture high-frequency information corresponding to textures and edges \cite{rahaman2019spectral, tancik2020fourier}.
|
| 8 |
+
This fundamental performance gap motivates the exploration of architectural innovations that can improve a model's representational power without sacrificing efficiency.
|
| 9 |
+
% Lightweight models are essential for on-device applications, but their reduced capacity often limits their ability to capture the fine-grained details necessary for complex recognition tasks.
|
| 10 |
+
% This performance gap motivates the exploration of architectural innovations
|
| 11 |
+
% that can improve a model's representational power without sacrificing efficiency.
|
| 12 |
+
% A growing body of research suggests that standard neural network architectures exhibit a spectral bias, preferentially learning simple, low-frequency global patterns early in training while struggling to capture high-frequency information corresponding to textures and edges \cite{rahaman2019spectral, tancik2020fourier}.
|
| 13 |
+
{This bias is particularly pronounced in efficient models whose limited capacity hinders their ability to learn complex, high-frequency information. }
|
| 14 |
+
This limitation motivates our analysis of Gated Linear Units (GLUs)—a computationally inexpensive mechanism already proven effective in various high-performance models \cite{de2024griffin, liu2021pay, gu2023mamba}.
|
| 15 |
+
While their success is often attributed to adaptive information control, their impact on a network's spectral properties remains largely unexplored.
|
| 16 |
+
We hypothesize that the element-wise multiplication at the core of GLUs, which corresponds to convolution in the frequency domain,
|
| 17 |
+
{provides a direct mechanism to modulate this spectral bias and enrich a model's high-frequency learning.}
|
| 18 |
+
%W%ith the flourish of the Transformer[] , self-attention-based architectures have largely replaced RNN[] as the base model in natural language processing.
|
| 19 |
+
%Despite its successes, efficiently scaling them to long sequences is challenging due to the quadratic complexity of global attention.
|
| 20 |
+
% The gating mechanism has been widely used in recurrent neural networks (RNNs) \cite{hochreiter1997long, chung2014empirical} to address long-term dependency issues.
|
| 21 |
+
% %The gating mechanism is a widely used strategy in deep learning models that dynamically controls the selection and filtering of information flow.
|
| 22 |
+
% With the flourish of Transformers \cite{vaswani2017attention}, self-attention-based architectures have largely replaced RNNs as the core
|
| 23 |
+
% model in natural language processing (NLP). Despite
|
| 24 |
+
% their success, scaling Transformers to long
|
| 25 |
+
% sequences remains challenging due to the quadratic complexity of global attention.
|
| 26 |
+
% Linear gating mechanisms (\textit{i.e.} Gated Linear Units \cite{dauphin2017language}) have been rediscovered as an effective approach to address it.
|
| 27 |
+
|
| 28 |
+
%that scaling Transformers to long sequences remains challenging due to the quadratic complexity of global attention.
|
| 29 |
+
%Despite their success, This drives researchers to explore more efficient methods to improve the model.
|
| 30 |
+
%Gated Linear Units \cite{dauphin2017language} have been rediscovered as an effective component to enhance Transformer performance while addressing efficiency issues \cite{shazeer2020glu}.
|
| 31 |
+
% Gated Linear Units (GLUs) introduce a gating mechanism that adaptively controls information flow, allowing the model to focus on relevant features and ignore less important ones.
|
| 32 |
+
% These architectures are simple
|
| 33 |
+
% to implement, and have no apparent computational drawbacks.
|
| 34 |
+
% Therefore, models built with GLUs have been developed in various tasks across NLP \cite{de2024griffin,dubey2024llama,gu2023mamba} and Computer Vision \cite{liu2021pay,ma2024rewrite, yang2022focal}.
|
| 35 |
+
%This reduces the burden on global attention, leading to more efficient training and inference across.
|
| 36 |
+
% \begin{figure}[t]
|
| 37 |
+
% \centering
|
| 38 |
+
% \includegraphics[width=0.58\linewidth]{imgs/intro.pdf}
|
| 39 |
+
% \hfill
|
| 40 |
+
% \includegraphics[width=0.41\linewidth]{imgs/acc_latency3.pdf}
|
| 41 |
+
% %\includegraphics[width=0.8\linewidth]{egfigure.eps}
|
| 42 |
+
|
| 43 |
+
% \caption{{\bf (a)} An illustration of how GLUs affect neural networks in classifying different frequency parts of an image. Starting with a raw image of a frog, we break it down into different frequency bands.
|
| 44 |
+
% The lowest frequency shows a recognizable outline, the middle frequency retains the general shape of the frog, but the highest frequency is almost unrecognizable.
|
| 45 |
+
% Predictions of different components are given in the lower of different models.
|
| 46 |
+
% This example demonstrates two points: 1. Neural networks can use specific frequency components for classification, not just the lowest ones, and 2. GLUs improve the NNs' ability to learn different frequency components effectively.
|
| 47 |
+
% {\bf (b)} Trade-off between Top-1 accuracy and latency on A100. GmNet variants achieve substantially lower latency compared to related works, while maintaining competitive or superior Top-1 accuracy.}
|
| 48 |
+
% \label{intro}
|
| 49 |
+
% \end{figure}
|
| 50 |
+
%Therefore, the gated linear unit (GLU) is found as an efficient and promising method to further improve performance of Transformer.
|
| 51 |
+
%Although the GLU-like structure has demonstrated the effectiveness, the theoretical analysis of the it has always been neglected.
|
| 52 |
+
% While architectures based on linear gating mechanisms have demonstrated the effectiveness,
|
| 53 |
+
% their theoretical analysis have not received enough attention.
|
| 54 |
+
%This gap limits understanding of how GLUs improve model performance.
|
| 55 |
+
% Except intuitive explanations, a deeper examination of their mathematical properties could provide valuable insights for the development of efficient gating mechanisms.
|
| 56 |
+
%Although GLU has shown its effectiveness across various tasks both in NLP[] and computer vision[], the analysis of the behavior behind the gating mechanism has been overlooked.
|
| 57 |
+
% Inspired by the Fourier interpretation of element-wise product, we propose to investigate training dynamics of neural networks (NNs) with gating mechanisms from a frequency perspective. This approach helps us understand how frequency components are selectively amplified or suppressed during learning.
|
| 58 |
+
% By the frequency analysis, we aim to uncover how GLUs influence the spectral properties of neural networks and affect the overall performance.
|
| 59 |
+
%as illustrated in Fig. \ref{intro}.
|
| 60 |
+
|
| 61 |
+
To build intuition, we present an example that visually illustrates how GLUs alter a network's response to different frequency components of an image as {shown} in Fig. \ref{intro}.
|
| 62 |
+
We take a standard convolution-based lightweight building block (the top one)
|
| 63 |
+
%—the inverted residual block from MobileNetV2 \cite{sandler2018mobilenetv2} (the top one)
|
| 64 |
+
and create a variant by incorporating our proposed gating unit ( the bottom one).
|
| 65 |
+
We first provide an input image decomposed into different frequency components from low to high.
|
| 66 |
+
%its low-frequency (coarse structure) and high-frequency (fine details, textures) components.
|
| 67 |
+
The visualizations show that the baseline model
|
| 68 |
+
primarily performs accurate on the low-frequency information, struggling capturing crucial textural details which leads to an incorrect classification on the raw image.
|
| 69 |
+
In sharp contrast, the model with GLU demonstrates a more balanced spectral response, effectively learning from both low and high-frequency
|
| 70 |
+
components to form a richer representation.
|
| 71 |
+
This simple experiment provides initial illustration that gating mechanisms can directly counteract the low-frequency bias in many efficient architectures.
|
| 72 |
+
|
| 73 |
+
The mechanism enabling this enhanced spectral response is rooted in the convolution theorem: element-wise multiplication in the spatial domain is equivalent to convolution in the frequency domain.
|
| 74 |
+
This operation allows the network to create complex interactions between different frequency
|
| 75 |
+
\begin{wrapfigure}{r}{0.5\textwidth}
|
| 76 |
+
\centering
|
| 77 |
+
\includegraphics[width=0.5\textwidth]{imgs/intro.pdf}
|
| 78 |
+
\caption{An illustration of how GLUs affect neural networks in classifying different frequency parts of an image. $\sigma$ means activation function. Starting with a raw image of a `Tiger cat', we break it down into different frequency bands. The lowest frequency shows a recognizable outline, the higher frequency retains the general shape of the {cat}, but the highest frequency is almost unrecognizable.
|
| 79 |
+
Predictions of different components are given in the left of different models.
|
| 80 |
+
This example demonstrates two points: 1. Although low-frequency decomposed images closely resemble the originals, accurate recognition of it does not guarantee accurate recognition of the original images, and 2. GLUs improve the NNs' ability to learn higher frequency components effectively.
|
| 81 |
+
}
|
| 82 |
+
\vspace{-2mm}
|
| 83 |
+
\label{intro}
|
| 84 |
+
%\hfill
|
| 85 |
+
\end{wrapfigure}
|
| 86 |
+
bands, enriching the feature hierarchy.
|
| 87 |
+
However, as prior work has noted \cite{wang2020high,yin2019fourier}, naively amplifying high frequencies can make a model overly sensitive to noise.
|
| 88 |
+
The key, therefore, is selective modulation. We contend that Gated Linear Units, by pairing the multiplication with a data-dependent gate and a non-linear activation function, provide exactly this control.
|
| 89 |
+
They allow the model to learn when to integrate high-frequency details and how much to trust them, effectively amplifying useful signals while remaining robust to high-frequency noise.
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
%Basically, the component-wise product which equals to the convolution in the frequency domain can introduce new frequency components.
|
| 93 |
+
%It may include new information of different frequencies and emphasize the amplitude of the high frequency component.
|
| 94 |
+
%However, as demonstrated by [] and [], NNs may be sensitive to high-frequency noise.
|
| 95 |
+
%Therefore, it is necessary to apply an activation layer in the gating unit to control the new generated information.
|
| 96 |
+
%Activation functions can be classified into two types based on their differential properties.
|
| 97 |
+
%The smooth activation functions whose higher derivatives are continuous introduce fewer high-frequency information. Functions with discontinuous higher derivatives more likely encourage NNs to learn faster from higher frequency.
|
| 98 |
+
% Existing approaches \cite{ma2024rewrite} typically employ independent projections for the feature and gating branches. However, this decoupling often leads to misalignment between the modulated and gating signals, causing the gating to behave like a generic filter and reducing sensitivity to fine-grained, high-frequency variations. To address this limitation, we introduce a self-reinforcing gating structure in which both signals are derived from a shared representation. This design ensures that salient variations are consistently amplified, making the model inherently more effective at capturing and preserving high-frequency information.
|
| 99 |
+
To put these principles into practice, we introduce the Gating Mechanism Network (GmNet), a lightweight architecture designed to leverage the spectral advantages of gating.
|
| 100 |
+
By effectively capturing information across the full frequency spectrum, GmNet demonstrates that a structurally-motivated design can lead to substantial practical gains.
|
| 101 |
+
Compared to the existing methods \cite{ma2024rewrite, ma2024efficient} which also involve gating designs, our design leverages a self-reinforcing gating mechanism in which the modulation and gating signals are derived from a shared representation.
|
| 102 |
+
This alignment ensures that salient variations, particularly those associated with high-frequency components, are consistently emphasized rather than suppressed.
|
| 103 |
+
In contrast, methods based on independent projections often act as generic filters, leading to weaker sensitivity to subtle variations that are critical for classification.
|
| 104 |
+
Consequently, our approach is inherently more effective in preserving and enhancing high-frequency information.
|
| 105 |
+
% In contrast, when the two signals originate from independent projections, the gating no longer aligns with the feature variations of the main branch, functioning more as a generic filter rather than a targeted amplifier.
|
| 106 |
+
% As a result, the former structure is inherently more effective in preserving and enhancing high-frequency information.
|
| 107 |
+
The results are compelling: without relying on advanced training techniques, our GmNet-S3 model achieves 81.3\% top-1 accuracy on ImageNet-1K. This surpasses EfficientFormer-L1 by a significant 4.0\% margin while simultaneously being 4x faster on an A100 GPU, showcasing a new state-of-the-art in efficient network design.
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
We summarize the key contributions of this work as follows:
|
| 111 |
+
(1) We provide the first systematic analysis of Gated Linear Units (GLUs) from a frequency perspective, establishing a clear link between their core operations and their ability to modulate a network's spectral response.
|
| 112 |
+
(2) We demonstrate that this spectral modulation can directly counteract the inherent low-frequency bias in many lightweight architectures, enabling them to learn more balanced and detailed feature representations from both low and high frequencies.
|
| 113 |
+
(3) Based on these insights, we introduce the Gating Mechanism Network (GmNet), a simple yet powerful lightweight architecture that achieves a new state-of-the-art in performance and efficiency, validating the practical benefits of our frequency-based design principles.
|
| 114 |
+
%GmNet reaches over $81\%$ top-1 accuracy, with only $2.9$ ms latency on an A100 GPU.
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
% We succinctly summarize and emphasize the key contributions of this work as following points:
|
| 118 |
+
% %\begin{itemize}
|
| 119 |
+
% 1). We present a comprehensive study on how gated linear units influence neural network training dynamics from a frequency perspective. Through both theoretical analysis and experimental evidences, we demonstrate how the interaction between element-wise multiplication and activation functions shapes the frequency response of NNs.
|
| 120 |
+
% %\item We valid our analysis through sufficient experiments of testing and tracking the
|
| 121 |
+
% 2).Inspired by the study of the gating mechanism, we investigate the effect of capturing the high-frequency information and propose a competitive lightweight model, named \textbf{G}ating \textbf{M}echanism \textbf{Net}work (GmNet), which achieves promising performance without the need for strong training strategy, surpassing numerous efficient designs.
|
| 122 |
+
|
| 123 |
+
%Capitalizing on the efficacy of the star peration, our StarNet can even surpass various meticulously designed efficient models, like MobileNetv3 [27], EdgeViT [42], FasterNet [6], etc.
|
| 124 |
+
%For example, our StarNet-S4 outperforms EdgeViT-XS by 0.9% top-1 accuracy on ImageNet-1K validation set while running 3× faster on iPhone13 and CPU, and 2× faster on GPU. These results not only empirically validate our insights regarding the star operation but also underscore its practical value in real-world applications.
|
| 125 |
+
|
| 126 |
+
|
gmnet/project/gmnet_tpami/reference/source/sec/3_method.tex
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\begin{figure*}
|
| 2 |
+
\centering
|
| 3 |
+
\includegraphics[width=1.0\textwidth]{imgs/mobilenetv2.pdf}
|
| 4 |
+
%\caption{Comparison among Res18, Res18-Ewp. Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 5 |
+
\label{bpgg}
|
| 6 |
+
\vspace{-6mm}
|
| 7 |
+
\caption{Comparison among different variants of MobileNetv2.
|
| 8 |
+
Different architectures respond differently to specific frequency component.
|
| 9 |
+
To ensure an informative comparison, we select representative frequency thresholds tailored to each model where we set $r$ to $10$. Additional results under other threshold configurations and other based models are included in the supplementary material.
|
| 10 |
+
%and EfficientFormer-v2 (Eformerv2)
|
| 11 |
+
%for MobileNetv2 and $\{ 4, 8\}$ for %EfficientFormer-v2 respectively.
|
| 12 |
+
%All the variants shows almost same training curves and very close testing curves of the raw data where the difference is lower than $0.03$ on average. In this case, a difference value of $0.1$ can be seen as a significant change.
|
| 13 |
+
%When accuracy falls below $15\%$, it can be considered close to the random selection, suggesting that neural networks struggle to learn from this particular frequency range.
|
| 14 |
+
%For a better view, we only put curves of two variants in a single image for figures a, b and c. Also, we plot all curves in a single plot and highlighted the most upper curves for each images in (d) to have a comprehensive
|
| 15 |
+
%understanding.
|
| 16 |
+
}
|
| 17 |
+
\label{lgw_comparison}
|
| 18 |
+
\end{figure*}
|
| 19 |
+
\section{Gating Mechanism Network (GmNet)}
|
| 20 |
+
\label{sec:method}
|
| 21 |
+
\subsection{Rethinking Current Lightweight Model Architectures From A Frequency Perspective}
|
| 22 |
+
\begin{wrapfigure}{r}{0.4\textwidth}
|
| 23 |
+
\vspace{-7mm}
|
| 24 |
+
\centering
|
| 25 |
+
\includegraphics[width=0.85\linewidth]{imgs/arch1.png}
|
| 26 |
+
\vspace{-4mm}
|
| 27 |
+
\caption{{\bf GmNet architecture}. GmNet adopts a traditional hybrid architecture, utilizing convolutional layers to down-sample the resolution and double the number of channels at each stage.
|
| 28 |
+
%Several blocks are repeated to extract features.
|
| 29 |
+
}
|
| 30 |
+
\vspace{-7mm}
|
| 31 |
+
%\includegraphics[width=0.8\linewidth]{egfigure.eps}
|
| 32 |
+
\label{arch-main}
|
| 33 |
+
\end{wrapfigure}
|
| 34 |
+
|
| 35 |
+
Before introducing our proposed network, we first investigate the importance of capturing high-frequency information in efficient architectures by modifying existing efficient models to incorporate Gated Linear Units (GLUs).
|
| 36 |
+
Specifically, we select one representative architecture: the pure CNN-based MobileNetV2 \cite{sandler2018mobilenetv2}.
|
| 37 |
+
%and the transformer-based EfficientFormer-V2 \cite{li2023rethinking}.
|
| 38 |
+
We replace the activation functions in their MLP blocks with a simple GLU. Detailed architectural modifications are provided in the appendix.
|
| 39 |
+
|
| 40 |
+
As shown in Fig. \ref{lgw_comparison}, {we present the testing accuracy curves under the frequency threshold $r=10$.}
|
| 41 |
+
Our results demonstrate that integrating GLUs improves classification accuracy on high-frequency components.
|
| 42 |
+
%under different threshold settings.
|
| 43 |
+
Notably, this improvement in high-frequency classification also correlates with a gain in overall performance.
|
| 44 |
+
Furthermore, we observe that using GELU as the activation function within the GLUs enhances performance on low-frequency components, though it has a relatively minor effect on overall accuracy.
|
| 45 |
+
These findings suggest that effectively modeling high-frequency information is more crucial for improving the performance of lightweight neural networks.
|
| 46 |
+
It underscores the critical role of frequency-aware design in the lightweight networks.
|
| 47 |
+
Moreover, we also conduct similar experiments on the transformer-based model EfficientFormer-V2 \cite{li2023rethinking} which can be found in the appendix.
|
| 48 |
+
%Incorporating activation functions with favorable frequency characteristics, such as GLUs, offers a promising direction to mitigate the performance gap between lightweight and full-sized models.
|
| 49 |
+
|
| 50 |
+
\subsection{Architecture of GmNet}
|
| 51 |
+
|
| 52 |
+
%The advantages of learning more from high-frequencies have been investigated by many works in various tasks [].
|
| 53 |
+
To address the limitation of low-frequency bias for current lightweight network designs, our
|
| 54 |
+
proposed method named as GmNet integrates a simple gated linear unit into the block as illustrated in
|
| 55 |
+
Fig. \ref{arch-main}.
|
| 56 |
+
GmNet offers both conceptual and practical advantages on encouraging the model to learn
|
| 57 |
+
from a broader range of frequency regions, especially the high-frequency domain.
|
| 58 |
+
|
| 59 |
+
%Building on the intuitive exploration of the gated linear unit (GLU), This enables XX to efficiently leverage high-frequency information.
|
| 60 |
+
GmNets employ an extremely streamlined model architecture, carefully designed to minimize both parameter count and computational speed, making them particularly suitable for deployment in resource-constrained environments.
|
| 61 |
+
We incorporate two depth-wise convolution layers with kernel sizes of $7\times 7$ at the beginning and
|
| 62 |
+
end of the block respectively to facilitate the integration of low- and high-frequency information.
|
| 63 |
+
At the core of the block, we have two $1\times 1$ convolution layers and a simple gated linear unit.
|
| 64 |
+
We use the ReLU6 as the activation function.
|
| 65 |
+
%Unlike existing methods that often rely on complex structures,
|
| 66 |
+
|
| 67 |
+
% Using such simple structure is mainly for better building a self-reinforcing gating mechanism.
|
| 68 |
+
%ReLU6 can not only emphasize the higher frequency components since it has discontinuous higher derivatives, but also it can limit the amplitudes and energy of the high-frequency components with limiting the max values.
|
| 69 |
+
% the details are listed in Table \ref{variants}.
|
| 70 |
+
|
| 71 |
+
GmNet uses a simplified GLU structure for two reasons: (1) to keep the model as
|
| 72 |
+
lightweight as possible, reducing computational load; and (2) ensuring that high-frequency signals can be better enhanced without adding any additional convolutional or fully connected layers within the GLU.
|
| 73 |
+
%There are two main purposes of employing the simplest GLU architecture: (1) Improving the model efficiency
|
| 74 |
+
%Additionally, a layer scaler is placed at the end of the block to regulate frequency amplitudes, effectively reducing high-frequency noise while enhancing the useful frequency range.
|
| 75 |
+
%Different from StarNet \cite{ma2024rewrite}, which employs two separate FC layers for element-wise multiplication, our method simplifies this process with a single FC layer before the GLU.
|
| 76 |
+
%Besides the purpose of improving the model efficiency, the simplest GLU architecture whic also enhances the model’s capability to extend the frequency spectrum and emphasize high-frequency components form the feature perspective. We have
|
| 77 |
+
Furthermore, our gate unit is more interpretable, aligning with our analysis of GLUs in the frequency domain.
|
| 78 |
+
%We also provide experimental evidence demonstrating that this simplified structure is indeed the most effective and efficient.
|
| 79 |
+
Experimental results and ablation studies consistently demonstrate the superiority of our model, validating its design in accordance with our GLU frequency domain studies.
|
| 80 |
+
We also show that the simplest structure achieves the optimal trade-off between efficiency and effectiveness.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
gmnet/project/gmnet_tpami/reference/source/sec/6_statements.tex
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\section{Statements}
|
| 2 |
+
|
| 3 |
+
\subsection{Ethics Statement}
|
| 4 |
+
In our paper, we strictly follow the ICLR ethical research standards and laws. To the best of our knowledge, our work abides by the General Ethical Principles.
|
| 5 |
+
|
| 6 |
+
\subsection{Reproducibility Statement}
|
| 7 |
+
We adhere to ICLR reproducibility standards and ensure the reproducibility of our work. All datasets we employed are publicly available. We will provide the code to reviewers and area chairs in the supplementary material.
|
| 8 |
+
|
gmnet/project/gmnet_tpami/reference/source/sec/X_suppl.tex
ADDED
|
@@ -0,0 +1,583 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%\clearpage
|
| 2 |
+
%\setcounter{page}{1}
|
| 3 |
+
%This supplementary document elaborates on the implementation details of ResNet18 variants and GmNet, as showcased in Figure 2 and 4 in the main body of the paper. It also includes the more training details of GmNet in Sec. \ref{implement}.
|
| 4 |
+
%Sec. \ref{block} shows more studies of different GLUs designs.
|
| 5 |
+
%We provide more comparisons of the main results of our model in latency-acc tradeoff of comparing the latency on the GPU in Sec. \ref{mainre}.
|
| 6 |
+
%The results of downstream tasks including object detection, instance segmentation and semantic segmentation are shown in Sec. \ref{down}.
|
| 7 |
+
%Moreover, we provide more experimental results of using different activate functions of Res18-Gate models on classifying different frequency components in Sec. \ref{gate}.
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
\subsection{Implementation Details}
|
| 15 |
+
\label{implement}
|
| 16 |
+
\subsubsection{Pseudo-codes of Model Architectures }
|
| 17 |
+
\definecolor{g}{HTML}{00bc12}
|
| 18 |
+
In our modified ResNet18, featured in Fig. 2, we adjust the activation function as the different variants.
|
| 19 |
+
As an example, we provide the pseudo-codes of Res18-Gate-ReLU in the
|
| 20 |
+
Algorithm \ref{res18relu}
|
| 21 |
+
\begin{algorithm}
|
| 22 |
+
\caption{Pseudo-codes of Res18-Gate-ReLU}
|
| 23 |
+
\begin{algorithmic}
|
| 24 |
+
\label{res18relu}
|
| 25 |
+
\STATE \textcolor{blue}{def} Block(x, in\_planes, planes)
|
| 26 |
+
%\STATE \quad \textcolor{g}{$\backslash\backslash$ conv1 = nn.Conv2d( in\_planes, planes, 3, 1, 1 )}
|
| 27 |
+
\STATE \quad out = Conv2d(x, in\_planes, planes, 3, 1, 1)
|
| 28 |
+
%\textcolor{g}{$\backslash\backslash$ Conv2d with kernel\_size=3, stride=1}
|
| 29 |
+
\STATE \quad out = BatchNorm2d(x)
|
| 30 |
+
\STATE \quad out = ReLU(out) * out
|
| 31 |
+
\STATE \quad out = Conv2d(out, planes, planes, 3, 1, 1)
|
| 32 |
+
\STATE \quad out = BatchNorm2d(out)
|
| 33 |
+
\STATE \quad out += self.shortcut(x)
|
| 34 |
+
\STATE \quad out = ReLU(out)
|
| 35 |
+
\STATE \quad \textcolor{blue}{return} out
|
| 36 |
+
\end{algorithmic}
|
| 37 |
+
\end{algorithm}
|
| 38 |
+
|
| 39 |
+
\noindent For the proposed GmNet, featured in Fig. 4, we provide the pseudo-code of GmNet in the
|
| 40 |
+
Algorithm \ref{gmnet}. Also, for ease of reproduction, we include a separate file in the supplementary materials dedicated to our GmNet.
|
| 41 |
+
|
| 42 |
+
\begin{algorithm}[h]
|
| 43 |
+
|
| 44 |
+
\caption{Pseudo-codes of GmNet}
|
| 45 |
+
\begin{algorithmic}
|
| 46 |
+
\label{gmnet}
|
| 47 |
+
\STATE \textcolor{blue}{def} Block(x, dim, mlp\_ratio)
|
| 48 |
+
%\STATE \quad \textcolor{g}{$\backslash\backslash$ conv1 = nn.Conv2d( in\_planes, planes, 3, 1, 1 )}
|
| 49 |
+
\STATE \quad input = x
|
| 50 |
+
\STATE \quad x = DWConv2d(x, dim, dim, 7, 1, 3, group=dim)
|
| 51 |
+
%\textcolor{g}{$\backslash\backslash$ Conv2d with kernel\_size=3, stride=1}
|
| 52 |
+
\STATE \quad x = BatchNorm2d(x)
|
| 53 |
+
\STATE \quad x = Conv2d(x, dim, mlp\_ratio*dim, 1)
|
| 54 |
+
\STATE \quad x = ReLU6(x) * x
|
| 55 |
+
\STATE \quad x = Conv2d(x, mlp\_ratio*dim, dim, 1)
|
| 56 |
+
\STATE \quad x = BatchNorm2d(x)
|
| 57 |
+
\STATE \quad x = DWConv2d(x, dim, dim, 7, 1, 3, group=dim)
|
| 58 |
+
%\STATE \quad x = layer\_scale(x)
|
| 59 |
+
\STATE \quad x = input + drop\_path(layer\_scale(x))
|
| 60 |
+
\STATE \quad \textcolor{blue}{return} x
|
| 61 |
+
\end{algorithmic}
|
| 62 |
+
\end{algorithm}
|
| 63 |
+
\subsubsection{Training Recipes}
|
| 64 |
+
We first provide the detailed training settings of variants of ResNet18 in Table \ref{res18config}.
|
| 65 |
+
|
| 66 |
+
\subsubsection{GmNet Variants}
|
| 67 |
+
We provide the setting of variants of GmNet in Table. \ref{gmnet-variants}.
|
| 68 |
+
\begin{table}[h]
|
| 69 |
+
\centering
|
| 70 |
+
\begin{tabular}{l|ccc|cc}
|
| 71 |
+
\hline Variant & $C_1$ & depth & ratio & Params & FLOPs \\
|
| 72 |
+
\hline GmNet-S1 & 40 & {$[2,2,10,2]$} & {$[3,3,3,2]$} & 3.7 M & 0.6 G \\
|
| 73 |
+
GmNet-S2 & 48 & {$[2,2,8,3]$} & {$[3,3,3,2]$} & 6.2 M & 0.9 G \\
|
| 74 |
+
GmNet-S3 & 48 & {$[3,3,8,3]$} & {$[4,4,4,4]$} & 7.8 M & 1.2 G \\
|
| 75 |
+
GmNet-S4 & 68 & {$[3,3,11,3]$} & {$[4,4,4,4]$} & 17.0 M & 2.7 G \\
|
| 76 |
+
\hline
|
| 77 |
+
\end{tabular}
|
| 78 |
+
\caption{Configurations of GmNet. We vary the
|
| 79 |
+
embedding width, depth, and gating ratio to construct different model sizes of GmNet.}
|
| 80 |
+
\label{gmnet-variants}
|
| 81 |
+
\end{table}
|
| 82 |
+
|
| 83 |
+
\begin{table}[h]
|
| 84 |
+
\centering
|
| 85 |
+
\begin{tabular}{l|c}
|
| 86 |
+
config & value \\
|
| 87 |
+
\hline image size & 32 \\
|
| 88 |
+
optimizer & SGD \\
|
| 89 |
+
base learning rate & $0.1$ \\
|
| 90 |
+
weight decay & 5e-4 \\
|
| 91 |
+
optimizer momentum & $0.9$ \\
|
| 92 |
+
batch size & 128 \\
|
| 93 |
+
learning rate schedule & cosine decay \\
|
| 94 |
+
training epochs & 100 \\
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
\end{tabular}
|
| 98 |
+
\caption{Res18 variants training setting}
|
| 99 |
+
\label{res18config}
|
| 100 |
+
\end{table}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
\noindent We also provide a detailed training configures of GmNet in this section as shown in the Table \ref{config}.
|
| 105 |
+
%All variants of GmNet use the same setting.
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
\begin{table}[h]
|
| 109 |
+
\centering
|
| 110 |
+
\begin{tabular}{l|c}
|
| 111 |
+
config & value \\
|
| 112 |
+
\hline image size & 224 \\
|
| 113 |
+
optimizer & AdamW \\
|
| 114 |
+
base learning rate & $3 \mathrm{e}-3$ \\
|
| 115 |
+
weight decay & 0.03 \\
|
| 116 |
+
optimizer momentum & $\beta_1, \beta_2=0.9,0.999$ \\
|
| 117 |
+
batch size & 2048 \\
|
| 118 |
+
learning rate schedule & cosine decay \\
|
| 119 |
+
warmup epochs & 5 \\
|
| 120 |
+
training epochs & 300 \\
|
| 121 |
+
AutoAugment & rand-m1-mstd0.5-inc1 \\
|
| 122 |
+
label smoothing & 0.1 \\
|
| 123 |
+
cutmix & 0.4 \\
|
| 124 |
+
color jitter & 0. \\
|
| 125 |
+
drop path & $0 .(\mathrm{S} 1 / \mathrm{S} 2), 0.02(\mathrm{S} 3 / \mathrm{~S} 4)$ \\
|
| 126 |
+
|
| 127 |
+
\end{tabular}
|
| 128 |
+
\caption{GmNet training setting}
|
| 129 |
+
\label{config}
|
| 130 |
+
\end{table}
|
| 131 |
+
|
| 132 |
+
\begin{figure}[t]
|
| 133 |
+
\centering
|
| 134 |
+
\includegraphics[width=1.0\linewidth]{imgs/lacc.png}
|
| 135 |
+
%\includegraphics[width=0.8\linewidth]{egfigure.eps}
|
| 136 |
+
|
| 137 |
+
\caption{Top-1 accuracy vs Latency on A100. Our models have significantly smaller latency compared to related works. }
|
| 138 |
+
\label{lacc}
|
| 139 |
+
\vspace{-3mm}
|
| 140 |
+
\end{figure}
|
| 141 |
+
|
| 142 |
+
\begin{table*}[h]
|
| 143 |
+
\centering
|
| 144 |
+
\caption {Comparison of different GLU designs for GmNet-S3 on ImageNet-1K. }
|
| 145 |
+
%\tabcolsep=0.1cm
|
| 146 |
+
\resizebox{0.95\textwidth}{!}{
|
| 147 |
+
\begin{tabular}{lccccccccccccc}
|
| 148 |
+
\toprule
|
| 149 |
+
\multirow{2}{*}{ {GLUs}} & {Top-1} & {Params} & {GPU} & \multicolumn{2}{c}{$r = 12$}& \multicolumn{2}{c}{$r = 24$}& \multicolumn{2}{c}{$r = 36$}& \multicolumn{2}{c}{$r = 48$}& \multicolumn{2}{c}{$r = 60$}\\
|
| 150 |
+
\cmidrule(lr){5-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}\cmidrule(lr){11-12}\cmidrule(lr){13-14}
|
| 151 |
+
& (\%) & (M) & (ms) & {Low} & High & {Low} & High & {Low} & High & {Low} & High & {Low} & High \\
|
| 152 |
+
\midrule
|
| 153 |
+
|
| 154 |
+
$\sigma(x)\cdot\text{FC}(x)$ & 79.2 & 20.2 & 3.6 & 10.8&51.4&39.6&8.7&52.6&4.4&62.9&3.4&69.9&2.4 \\
|
| 155 |
+
|
| 156 |
+
{$\sigma(\text{FC}(x))\cdot x$} & 79.6 & 20.2 & 3.4 & 9.4&48.9&35.0&9.1&51.1&3.6&62.1&3.1&68.7&2.4\\
|
| 157 |
+
|
| 158 |
+
$\sigma(x)\cdot x$ & 79.3 & 7.8 & 2.1 & {14.8} & {51.7} & 41.6 & {12.1}&55.2&4.7&64.4&2.5&71.1&1.4 \\
|
| 159 |
+
\bottomrule
|
| 160 |
+
\end{tabular}}
|
| 161 |
+
|
| 162 |
+
\label{glu-design}
|
| 163 |
+
\end{table*}
|
| 164 |
+
|
| 165 |
+
\subsection{More GLUs designs.}
|
| 166 |
+
\label{block}
|
| 167 |
+
|
| 168 |
+
In this section, we present additional block designs to demonstrate the efficiency and effectiveness of our proposed architecture. As shown in Table \ref{glu-design}, we conducted experiments incorporating fully connected (FC) layers into the Gated Linear Units (GLUs). Adding an extra FC layer to one branch of the GLUs may slightly improve performance. However, this modification significantly increases the number of parameters and reduces the model's latency.
|
| 169 |
+
|
| 170 |
+
Moreover, this enhanced architecture does not perform better in classifying different frequency components. The reason is that features processed by an FC layer cannot effectively emphasize various frequency components. While adding more parameters and employing different training methods might enhance the capability to learn different frequency components, in lightweight models, the simplest GLU design often delivers better performance. This observation is consistent with findings from many recent studies on lightweight models.
|
| 171 |
+
%\cite{ma2024rewrite, sandler2018mobilenetv2, wang2024repvit}.
|
| 172 |
+
\subsection{More comparisons of the main results.}
|
| 173 |
+
\label{mainre}
|
| 174 |
+
We provide more comparisons of the main results in Fig. \ref{lacc}. We plot a larger latency-acc trade-off figure to include more methods including EdgeViT, MobileNetV2 and GhostNet.
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
% \subsection{Results in downstream tasks}
|
| 178 |
+
% \label{down}
|
| 179 |
+
% \paragraph{Object Detection and Instance Segmentation.}
|
| 180 |
+
% We have conducted experiments on GmNet-S3 of object detection and instance segmentation on MSCOCO 2017 with the Mask RCNN framework. Our method shows better performance compared to the sota methods RepViT-M1.5 and EfficientFormer-L3 with better efficiency in terms of latency, AP\(^{box}\) and AP\(^{mask}\) under similar model sizes. Specifically, GmNet-S3 outperforms RepViT-M1.5 significantly by 2.4 AP\(^{mask}_{75}\) and 1.4 AP\(^{box}_{75}\). Meanwhile, GmNet-S3 has 1.7 ms faster on the Mobile latency and more than 2 times faster than EfficientFormer-L3.
|
| 181 |
+
% \paragraph{Semantic Segmentation.}
|
| 182 |
+
% We also conduct experiments on
|
| 183 |
+
% ADE20K to verify the performance of GmNet-S3 on the
|
| 184 |
+
% semantic segmentation task. Following the sota methods, we integrate GmNet into the Semantic FPN framework. With significant improvements on the speed, GmNet-S3 still match the performance on semantic segmentation task with RepV-T-M1.5 and EfficientFormer-L3.
|
| 185 |
+
% \begin{table}[t]
|
| 186 |
+
% \centering
|
| 187 |
+
% %\small
|
| 188 |
+
% %\vspace{-4mm}
|
| 189 |
+
|
| 190 |
+
% \tabcolsep=0.1cm
|
| 191 |
+
% %\renewcommand{\arraystretch}{0.1}
|
| 192 |
+
% \resizebox{1\linewidth}{!}{
|
| 193 |
+
% \begin{tabular}{c|c|ccc|ccc|c}
|
| 194 |
+
% \toprule
|
| 195 |
+
% \multirow{2}{*}{Backbone} &Latency$\downarrow$ & \multicolumn{3}{c|}{Object Detection$\uparrow$} & \multicolumn{3}{c|}{Instance Segmentation$\uparrow$} &Semantic $\uparrow$\\
|
| 196 |
+
% & (ms) & AP$^{box}$ & AP$^{box}_{50}$ & AP$^{box}_{75}$ & AP$^{mask}$ & AP$^{mask}_{50}$ & AP$^{mask}_{75}$ &mIoU \\
|
| 197 |
+
% \hline
|
| 198 |
+
|
| 199 |
+
% EfficientFormer-L3 & 12.4&41.4&63.9&44.7&38.1& 61.0&40.4 & 43.5\\
|
| 200 |
+
% RepViT-M1.5 & 6.9 & 41.6 & 63.2 & {45.3} & {38.9} & {60.5} & {41.5} &43.6 \\
|
| 201 |
+
% GmNet-S3 & 5.2 & 42.2 & 63.4 & 46.7 & 40.1 & {61.2} & {42.9} &44.6 \\
|
| 202 |
+
% \bottomrule
|
| 203 |
+
% \end{tabular}}
|
| 204 |
+
% %\vspace{-5mm}
|
| 205 |
+
% \label{tab:coco}
|
| 206 |
+
% \caption{
|
| 207 |
+
% {Object detection \&
|
| 208 |
+
% Instance segmentation\&
|
| 209 |
+
% Semantic segmentation}. The latency is tested on iPhone 14 by Core ML Tools.
|
| 210 |
+
% }
|
| 211 |
+
% \end{table}
|
| 212 |
+
|
| 213 |
+
\subsection{Results on CUB-100.}
|
| 214 |
+
{We evaluated GmNet-S1 on the CUB-100 dataset. The results are competitive, as shown in Table}~\ref{tab:cub100}. {Compared to ShuffleNet-V2, GmNet-S1 achieves better performance with a smaller model size.}
|
| 215 |
+
|
| 216 |
+
\begin{table}[h]
|
| 217 |
+
\centering
|
| 218 |
+
\begin{tabular}{l|c|c}
|
| 219 |
+
\hline
|
| 220 |
+
Variant & Params (M) & Top-1 Acc (\%) \\
|
| 221 |
+
\hline
|
| 222 |
+
ShuffleNet-V2 & 3.5 & 76.0 \\
|
| 223 |
+
GmNet-S1 & 3.1 & 81.5 \\
|
| 224 |
+
\hline
|
| 225 |
+
\end{tabular}
|
| 226 |
+
\caption{Results on CUB-100.}
|
| 227 |
+
\label{tab:cub100}
|
| 228 |
+
\end{table}
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
\subsection{Performance with SwiGLU and SiLU}
|
| 232 |
+
{We have conducted experiments with the SiLU variant on CIFAR-10 to illustrate the learning dynamics in Fig.~14. Following the reviewer’s advice, we adapted both SwiGLU and SiLU to GmNet-S3 and trained the models under the same settings. The results in Table}~\ref{tab:silu_swish} {show that both activations improve performance compared to the baseline configuration, which removes activations inside the GLU. However, their gains remain consistently smaller than those achieved by our proposed design, confirming that the proposed GmNet block is better aligned with the frequency characteristics and architectural constraints of lightweight models.}
|
| 233 |
+
\begin{table}[h]
|
| 234 |
+
\centering
|
| 235 |
+
\begin{tabular}{l|c}
|
| 236 |
+
\hline
|
| 237 |
+
Model / Activation & Top-1 Acc (\%) \\
|
| 238 |
+
\hline
|
| 239 |
+
Baseline (Identity) & 70.5 \\
|
| 240 |
+
+ SiLU & 77.9 \\
|
| 241 |
+
+ SwiGLU & 77.2 \\
|
| 242 |
+
+ Proposed (ReLU6-GLU) & \textbf{79.3} \\
|
| 243 |
+
\hline
|
| 244 |
+
\end{tabular}
|
| 245 |
+
\caption{Results of using SiLU and SwiGLU in GmNet-S3.}
|
| 246 |
+
\label{tab:silu_swish}
|
| 247 |
+
\end{table}
|
| 248 |
+
|
| 249 |
+
\subsection{Performance of changing ReLU6 to ReLU.}
|
| 250 |
+
Table~\ref{tab:relu_change} {shows the performance change when replacing ReLU6 with ReLU across multiple GmNet variants. The degradation is consistent across all model sizes.}
|
| 251 |
+
|
| 252 |
+
\begin{table}[h]
|
| 253 |
+
\centering
|
| 254 |
+
\begin{tabular}{l|c}
|
| 255 |
+
\hline
|
| 256 |
+
Variant & ReLU6 $\rightarrow$ ReLU \\
|
| 257 |
+
\hline
|
| 258 |
+
GmNet-S1 & 75.5 $\rightarrow$ 74.7 \\
|
| 259 |
+
GmNet-S2 & 78.3 $\rightarrow$ 77.4 \\
|
| 260 |
+
GmNet-S3 & 79.3 $\rightarrow$ 78.3 \\
|
| 261 |
+
GmNet-S4 & 81.5 $\rightarrow$ 80.5 \\
|
| 262 |
+
\hline
|
| 263 |
+
\end{tabular}
|
| 264 |
+
\caption{Performance degradation when replacing ReLU6 with ReLU.}
|
| 265 |
+
\label{tab:relu_change}
|
| 266 |
+
\end{table}
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
\subsection{Studies on aliasing and robustness}
|
| 270 |
+
{We train \textbf{Res18-Gate-ReLU} and \textbf{Res18-Gate-GELU} on CIFAR-10 following the setting of}~\cite{ref2} {to show how different activation functions affect robustness. We conducted an adversarial robustness ablation under PGD attacks. As shown below, the ReLU-based GLU---which emphasizes higher-frequency components---exhibits slightly lower PGD accuracy:}
|
| 271 |
+
\begin{itemize}
|
| 272 |
+
\item \textbf{Res18-Gate-ReLU:} 45.7\% PGD accuracy
|
| 273 |
+
\item \textbf{Res18-Gate-GELU:} 46.7\% PGD accuracy
|
| 274 |
+
\end{itemize}
|
| 275 |
+
{Clean accuracy remains similar for both variants} (82.2\% vs.\ 82.8\%), but the $\sim$1\% {drop in PGD robustness for the ReLU gate is consistent with prior findings that stronger high-frequency reliance increases vulnerability to aliasing and adversarial perturbations.}
|
| 276 |
+
|
| 277 |
+
\subsection{Experiments on ConvNeXt}
|
| 278 |
+
{To show the generalization of gating structure, we adapted our GLU to ConvNeXt-Tiny and trained the model using the same setting as GmNet on ImageNet-1k. As shown in Table}~\ref{tab:convnext_glu}, {GLU improves the performance without introducing any additional computational cost.
|
| 279 |
+
|
| 280 |
+
The improvement is smaller compared to GmNet, which may result from the fact that large CNNs are less affected by activation-induced frequency bias. Block design should be architecture-dependent.
|
| 281 |
+
}
|
| 282 |
+
\begin{table}[h]
|
| 283 |
+
\centering
|
| 284 |
+
\begin{tabular}{l|c|c|c}
|
| 285 |
+
\hline
|
| 286 |
+
Model & Top-1 Acc (\%) & Params (M) & FLOPs (G) \\
|
| 287 |
+
\hline
|
| 288 |
+
ConvNeXt & 82.5 & 28.6 & 4.46 \\
|
| 289 |
+
ConvNeXt + GLU & \textbf{83.0} & 28.6 & 4.46 \\
|
| 290 |
+
\hline
|
| 291 |
+
\end{tabular}
|
| 292 |
+
\caption{Comparison between ConvNeXt-Tiny and its GLU-enhanced variant.}
|
| 293 |
+
\label{tab:convnext_glu}
|
| 294 |
+
\end{table}
|
| 295 |
+
|
| 296 |
+
\subsection{More results on Efformerv2 and MobileNetV2.}
|
| 297 |
+
\begin{figure}[h]
|
| 298 |
+
\vspace{-2mm}
|
| 299 |
+
\centering
|
| 300 |
+
\includegraphics[width=0.5\linewidth]{imgs/modifications.png}
|
| 301 |
+
\caption{The illustration of modifications of MobileNetV2 and EfficientFormer-V2.
|
| 302 |
+
%Several blocks are repeated to extract features.
|
| 303 |
+
}
|
| 304 |
+
% \vspace{-15mm}
|
| 305 |
+
%\includegraphics[width=0.8\linewidth]{egfigure.eps}
|
| 306 |
+
\label{arch}
|
| 307 |
+
\end{figure}
|
| 308 |
+
We first show the illustration of the modifications for both models in . Moreover, we plot the testing curves with different settings of thresholds. As shown in Fig. \ref{supp_me}, the overall performance trend is consistent with the charts and figures presented in the main text. The model using ReLU6 shows better performance on the high-frequency components where the overall performance also surpasses other models. Meanwhile, the model using GELU performs better on low-frequencies. The extra results demonstrate the effect of GLU on helping model learning various frequency information and the improvements on high-frequency information have more impact on the final performance.
|
| 309 |
+
|
| 310 |
+
\begin{figure*}
|
| 311 |
+
\centering
|
| 312 |
+
\includegraphics[width=1.0\textwidth]{imgs/res18_r_4_7.png}
|
| 313 |
+
%\caption{Comparison among Res18, Res18-Ewp. Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 314 |
+
|
| 315 |
+
\caption{Additional results under different threshold configurations of different variants of ResNet18.
|
| 316 |
+
}
|
| 317 |
+
\label{supp_resnet}
|
| 318 |
+
\end{figure*}
|
| 319 |
+
|
| 320 |
+
\begin{figure*}
|
| 321 |
+
\centering
|
| 322 |
+
\includegraphics[width=1.0\textwidth]{imgs/mobilenetv2_supp.pdf}
|
| 323 |
+
%\caption{Comparison among Res18, Res18-Ewp. Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 324 |
+
|
| 325 |
+
\caption{Additional results under different threshold configurations of different variants of MobileNetv2.
|
| 326 |
+
}
|
| 327 |
+
\label{supp_resnet}
|
| 328 |
+
\end{figure*}
|
| 329 |
+
|
| 330 |
+
\begin{figure*}
|
| 331 |
+
\centering
|
| 332 |
+
\includegraphics[width=1.0\textwidth]{imgs/eformerv2.pdf}
|
| 333 |
+
%\caption{Comparison among Res18, Res18-Ewp. Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 334 |
+
|
| 335 |
+
\caption{Additional results under different threshold configurations of different variants of Efficientformer-V2.
|
| 336 |
+
}
|
| 337 |
+
\label{supp_resnet}
|
| 338 |
+
\end{figure*}
|
| 339 |
+
\begin{figure*}
|
| 340 |
+
\centering
|
| 341 |
+
\includegraphics[width=1.0\textwidth]{imgs/supp_me.png}
|
| 342 |
+
%\caption{Comparison among Res18, Res18-Ewp. Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 343 |
+
|
| 344 |
+
\caption{Additional results under different threshold configurations of different variants of MobileNetv2 and EfficientFormer-v2 (Eformerv2).
|
| 345 |
+
}
|
| 346 |
+
\label{supp_me}
|
| 347 |
+
\end{figure*}
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
\subsection{ {Quantitative spectral evidences.}} {
|
| 351 |
+
To further explore the effect of different activation functions, we provide the quantitative spectral evidence.
|
| 352 |
+
Based on the GmNet-S3 variants, we computed high/low-frequency energy ratios across multiple layers and model variants as shown in Table} \ref{spectral_evidence}.
|
| 353 |
+
{Firstly, we extract the layers before/after the gate and compute their high/low-frequency energy ratios to show the spectral changes.
|
| 354 |
+
Also, to demonstrate how different activation functions affect the model's frequency response, we compute the high/low-frequency energy ratios of the first DW-Conv layers in each stages.
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
\begin{table}[t]
|
| 358 |
+
%\vspace{-.2in}
|
| 359 |
+
\caption{High/Low Frequency Ratio Comparison. We computed the spectral changes from the layer before to the layer after the gate which are defined as f and g respectively. We also compute the high/low-frequency energy ratios of the first 7×7 DW-Conv layers of each stage.}
|
| 360 |
+
\vspace{-1mm}
|
| 361 |
+
\label{spectral_evidence}
|
| 362 |
+
\centering
|
| 363 |
+
\resizebox{0.59\textwidth}{!}{
|
| 364 |
+
\begin{tabular}{c|c|c|c|c}
|
| 365 |
+
\toprule
|
| 366 |
+
\multicolumn{5}{c}{\it High/Low Frequency Ratio Changes before/after the gate variants} \\
|
| 367 |
+
\midrule
|
| 368 |
+
Stage & Layer Pair & ReLU6 (H/L) & GELU (H/L) & ReLU (H/L) \\
|
| 369 |
+
\midrule
|
| 370 |
+
0.1 & f $\rightarrow$ g & 0.1195 $\rightarrow$ 0.1200 & 0.0575 $\rightarrow$ 0.0040 & 0.5172 $\rightarrow$ 0.5674 \\
|
| 371 |
+
1.1 & f $\rightarrow$ g & 0.0989 $\rightarrow$ 0.1429 & 0.0423 $\rightarrow$ 0.0022 & 0.1422 $\rightarrow$ 0.1751 \\
|
| 372 |
+
2.1 & f $\rightarrow$ g & 0.0386 $\rightarrow$ 0.0706 & 0.0252 $\rightarrow$ 0.0013 & 0.0018 $\rightarrow$ 0.0030 \\
|
| 373 |
+
3.1 & f $\rightarrow$ g & 0.0019 $\rightarrow$ 0.0281 & 0.0106 $\rightarrow$ 0.0003 & 0.0032 $\rightarrow$ 0.0341 \\
|
| 374 |
+
\midrule
|
| 375 |
+
\multicolumn{5}{c}{\it High/Low Frequency Ratio Comparison at DW-Conv layers} \\
|
| 376 |
+
\midrule
|
| 377 |
+
Stage&Layer & GELU (H/L) & ReLU (H/L) & ReLU6 (H/L) \\
|
| 378 |
+
\midrule
|
| 379 |
+
0.1 &1st DW-Conv& 0.1203 & \textbf{1.1553} & 0.7057 \\
|
| 380 |
+
1.1 &1st DW-Conv& 0.0695 & \textbf{0.3040} & 0.2452 \\
|
| 381 |
+
2.1 &1st DW-Conv& 0.0381 & 0.0024 & \textbf{0.0697} \\
|
| 382 |
+
3.1 &1st DW-Conv& 0.0057 & 0.0088 & \textbf{0.0142} \\
|
| 383 |
+
\bottomrule
|
| 384 |
+
\end{tabular}}
|
| 385 |
+
\vspace{-5mm}
|
| 386 |
+
\end{table}
|
| 387 |
+
%This change reduces computational complexity while still capturing the essential spectral properties without requiring further decomposition.
|
| 388 |
+
{We define the low frequencies as the central 1/4 region of the 2D spectrum.
|
| 389 |
+
Table} \ref{spectral_evidence} {shows that a consistent spectral pattern distinguishing smooth and non-smooth activations.
|
| 390 |
+
For GELU, the transition from f to g typically increases the low-frequency response, and across all stages GELU yields the lowest high/low ratios.
|
| 391 |
+
This aligns with its smooth functional form, which naturally biases the network toward low-frequency representations.
|
| 392 |
+
In contrast, ReLU and ReLU6 systematically amplify high-frequency components.
|
| 393 |
+
In the early stages (Stage 0 and 1), ReLU exhibits the strongest high-frequency response, reflecting its non-smooth activation behavior and its tendency to preserve or enhance sharp transitions.
|
| 394 |
+
In deeper layers (Stage 2 and 3), ReLU6 produces the highest high/low ratios, suggesting that its clipped nonlinearity becomes more influential as depth increases—potentially explaining why the ReLU6-based model obtains the best overall performance.
|
| 395 |
+
These effects are stable across stages, blocks, and models, and they directly support our hypothesis: smooth activations such as GELU favor low-frequency features, whereas non-smooth activations (ReLU/ReLU6) amplify high-frequency content.
|
| 396 |
+
This yields a clear falsifiable prediction—if a smooth activation were ever to systematically exceed ReLU/ReLU6 in high-frequency ratios under comparable settings, our hypothesis would be invalidated—which strengthens the explanatory robustness of the spectral analysis presented in Sec.} \ref{act_analysis}.
|
| 397 |
+
\\
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
\subsection{Extra experiments on gating mechanisms.}
|
| 401 |
+
\label{gate}
|
| 402 |
+
In this section, we present additional experimental results demonstrating how different activation functions affect frequency learning.
|
| 403 |
+
Firstly, we have conducted experiments with different settings of $r$ of Fig. \ref{bpgg_resnet} in the main paper.
|
| 404 |
+
We have set $r$ to $\{4, 7\}$ respectively. The results are shown in Fig., the performances are aligned with our analysis in Sec. \ref{sec:analysis} which indicates that the results shown in Fig. \ref{bpgg_resnet} are not accidental.
|
| 405 |
+
|
| 406 |
+
Specifically, we conduct experimearents using another smooth activation function, Swish (SiLU), and a non-smooth function, ReLU6.
|
| 407 |
+
|
| 408 |
+
As shown in Figures \ref{glr6} and \ref{rr6}, ReLU6 performs similarly to GELU. Although ReLU6 may introduce more high-frequency components, it does not perform as well as ReLU for two main reasons:
|
| 409 |
+
(1) ReLU6 caps the activation values. It can reduce the model's sensitivity to high-frequency components where those components are often associated with higher activation values.
|
| 410 |
+
(2) The use of low-resolution images can adversely affect the performance in classifying high-frequency components, as finer details are lost, making it harder for the model to learn these features.
|
| 411 |
+
Figures \ref{gls} and \ref{rs} present comparisons between SiLU (Swish) and ReLU, as well as between SiLU and GELU, respectively. The Res18-Gate-SiLU performs better on lower-frequency components, specifically in the range
|
| 412 |
+
$r\in(0,r_1)$. This indicates that SiLU has a greater smoothing effect on the information, encouraging the model to learn more effectively from lower frequencies.
|
| 413 |
+
|
| 414 |
+
Moreover, we investigated the impact of different training strategies to understand their effects on model performance. Specifically, as plotted in the Fig. \ref{adam}, we replaced the optimizer with Adam, setting its learning rate to 0.001. While the training curves showed noticeable variations compared to the baseline setup, the overall performance differences among the model variants remained consistent. This consistency indicates that the observed behaviors are robust to changes in optimization strategies.
|
| 415 |
+
|
| 416 |
+
%In this section, we provide more experimental results of different activation functions on affecting the frequency learning. We further conduct experiments on one more smooth function and non-smooth function, variants of using Swish and ReLU6. Also, we display more comparisons between different activation functions.
|
| 417 |
+
%As shown in Figs. \ref{glr6} and \ref{rr6}, ReLU6 performs similar to that of GELU. Although the ReLU6 may introduce more high-frequency components, there are two reasons why it can not perform as well as ReLU.
|
| 418 |
+
%(1) The limited max activating values can lower the model's sensitivity to the high-frequency components since high-frequency components sometimes are related to the high values,
|
| 419 |
+
%and (2) the low resolution images can also effect the performance of classifying the high-frequency components.
|
| 420 |
+
|
| 421 |
+
%Figs. \ref{gls} and \ref{rs} represent the comparisons between SiLU (Swish) and ReLU, SiLU and GELU respectively.
|
| 422 |
+
%Res18-Gate-SiLU performs better on lower frequency components like $r\in (0, 6)$.
|
| 423 |
+
%It indicates that the SiLU has more effect on smoothing the information to encourage the model to learn from the lower frequencies.
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
%Moreover, we further investigate the impact of employing different training strategies to understand their effects on model performance. As part of this exploration, we replaced the optimizer with Adam, setting its learning rate to $0.001$, and observed how this change influenced the training process. While the training curves demonstrated noticeable variations compared to the baseline setup, the overall performance differences across the model variants remained consistent. This consistency indicates that the observed behaviors are robust to changes in optimization strategies.
|
| 428 |
+
|
| 429 |
+
%These results provide valuable insights into the functionality of the gating mechanisms. Specifically, they suggest that the way the element-wise product interacts with activation functions is a general phenomenon, rather than being tied to a particular optimizer or training setup. This generality underscores the robustness of our findings and highlights the fundamental nature of the interactions driving these mechanisms.
|
| 430 |
+
|
| 431 |
+
We also conduct experiments on setting the redii to different sets. As shown in Figs. \ref{rt4} and \ref{rt8}, we set radii to $[0, 4, 8, 12, +\infty]$ and $[0, 8, 16, 24, +\infty]$ respectively. When
|
| 432 |
+
the frequency intervals are too small, the differences between the methods become less pronounced, especially in the lower-frequency components. When
|
| 433 |
+
the frequency intervals are too large, all models struggle to classify higher-frequency components. Although differences between models
|
| 434 |
+
become more pronounced in the lower-frequency components, such as between GELU and ReLU activations, to better understand the
|
| 435 |
+
training dynamics, it is necessary to examine the differences in the high-frequency components as well.
|
| 436 |
+
Therefore, we decide to display the results of setting radii to $[0, 6, 12, 24, +\infty]$ in the main body of the paper to have a better understand of the training dynamic of different variants.
|
| 437 |
+
These results provide valuable insights into the functionality of the gating mechanisms. They suggest that the interaction between the element-wise product and the activation functions is a general phenomenon.
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
\subsection{{Downstream tasks.}} {We further provide the results of downstream tasks of \emph{Object Detection, Instance Segmentation} and \emph{Semantic Segmentation}.
|
| 441 |
+
Firstly, we conducted experiments on GmNet-S3 on MSCOCO 2017 with the Mask RCNN }
|
| 442 |
+
\begin{wraptable}{r}{.7\textwidth}
|
| 443 |
+
\vspace{-2mm}
|
| 444 |
+
\caption{{Object detection \&
|
| 445 |
+
Instance segmentation\&
|
| 446 |
+
Semantic segmentation}. The latency is tested on iPhone 14 by Core ML Tools.}
|
| 447 |
+
\vspace{-1mm}
|
| 448 |
+
\label{contribution_breakdown}
|
| 449 |
+
\centering
|
| 450 |
+
\resizebox{0.67\textwidth}{!}{
|
| 451 |
+
\begin{tabular}{c|c|ccc|ccc|c}
|
| 452 |
+
\toprule
|
| 453 |
+
\multirow{2}{*}{Backbone} &Latency$\downarrow$ & \multicolumn{3}{c|}{Object Detection$\uparrow$} & \multicolumn{3}{c|}{Instance Segmentation$\uparrow$} &Semantic $\uparrow$\\
|
| 454 |
+
& (ms) & AP$^{box}$ & AP$^{box}_{50}$ & AP$^{box}_{75}$ & AP$^{mask}$ & AP$^{mask}_{50}$ & AP$^{mask}_{75}$ &mIoU \\
|
| 455 |
+
\midrule
|
| 456 |
+
EfficientFormer-L3 & 12.4&41.4&63.9&44.7&38.1& 61.0&40.4 & 43.5\\
|
| 457 |
+
RepViT-M1.5 & 6.9 & 41.6 & 63.2 & {45.3} & {38.9} & {60.5} & {41.5} &43.6 \\
|
| 458 |
+
GmNet-S3 & 5.2 & 42.2 & 63.4 & 46.7 & 40.1 & {61.2} & {42.9} &44.6 \\
|
| 459 |
+
\bottomrule
|
| 460 |
+
\end{tabular}}
|
| 461 |
+
\vspace{-2mm}
|
| 462 |
+
\end{wraptable}
|
| 463 |
+
{framework for object detection and instance segmentation.
|
| 464 |
+
Our method shows better performance compared to the existing methods RepViT-M1.5} \cite{wang2024repvit} {and EfficientFormer-L3} \cite{li2022efficientformer} {with better efficiency in terms of latency, AP}\(^{box}\) and AP\(^{mask}\) {under similar model sizes.
|
| 465 |
+
Specifically, GmNet-S3 outperforms RepViT-M1.5 significantly by 2.4 AP}\(^{mask}_{75}\) and 1.4 AP\(^{box}_{75}\).
|
| 466 |
+
{Meanwhile, GmNet-S3 has 1.7 ms faster on the Mobile latency and more than 2 times faster than EfficientFormer-L3.
|
| 467 |
+
For the semantic segmentation, we conduct experiments on ADE20K to verify the performance of GmNet-S3. Following the existing methods, we integrate GmNet into the Semantic FPN framework. With significant improvements on the speed, GmNet-S3 still match the performance on semantic segmentation task with RepV-T-M1.5 and EfficientFormer-L3.
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
\subsection{The Usage of Large Language Models (LLMs)}
|
| 471 |
+
We used GPT for polishing grammar and improving readability. All research ideas and analyses were conducted by the authors, who take full responsibility for the content.
|
| 472 |
+
%$$\mathcal{F(\omega)}\in [-\Omega, +\Omega] \rightarrow \mathcal{F}\ast \mathcal{F}(\omega)\in [-2\Omega, +2\Omega]$$
|
| 473 |
+
|
| 474 |
+
%This generality underscores the robustness of our findings and highlights the fundamental nature of the interactions driving these mechanisms.
|
| 475 |
+
|
| 476 |
+
\begin{figure*}[t]
|
| 477 |
+
\centering
|
| 478 |
+
\begin{subfigure}{1\linewidth}
|
| 479 |
+
|
| 480 |
+
\includegraphics[width=0.99\textwidth]{imgs/glr6.png}
|
| 481 |
+
\caption{Comparison between Res18-Gate-GELU and Res18-Gate-ReLU6.}
|
| 482 |
+
\label{glr6}
|
| 483 |
+
\end{subfigure}
|
| 484 |
+
\hfill
|
| 485 |
+
\begin{subfigure}{1\linewidth}
|
| 486 |
+
\includegraphics[width=0.99\textwidth]{imgs/rr6.png}
|
| 487 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-ReLU6.}
|
| 488 |
+
\label{rr6}
|
| 489 |
+
\end{subfigure}
|
| 490 |
+
\hfill
|
| 491 |
+
\begin{subfigure}{1\linewidth}
|
| 492 |
+
\includegraphics[width=0.99\textwidth]{imgs/gls.png}
|
| 493 |
+
\caption{Comparison between Res18-Gate-GELU and Res18-Gate-SiLU.}
|
| 494 |
+
\label{gls}
|
| 495 |
+
\end{subfigure}
|
| 496 |
+
\hfill
|
| 497 |
+
\begin{subfigure}{1\linewidth}
|
| 498 |
+
\includegraphics[width=0.99\textwidth]{imgs/rs.png}
|
| 499 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Gate-SiLU.}
|
| 500 |
+
\label{rs}
|
| 501 |
+
\end{subfigure}
|
| 502 |
+
\caption{Learning curves of Resnet18 and its variants for $100$ epoch. The radii are set to $\{ 0, 6, 12, 18, +\infty \}$}
|
| 503 |
+
\label{freq}
|
| 504 |
+
\end{figure*}
|
| 505 |
+
|
| 506 |
+
|
| 507 |
+
\begin{figure*}
|
| 508 |
+
\centering
|
| 509 |
+
\begin{subfigure}{1\linewidth}
|
| 510 |
+
|
| 511 |
+
\includegraphics[width=0.99\textwidth]{imgs/bp_adam.png}
|
| 512 |
+
\caption{Comparison between Res18 and Res18-Ewp.}
|
| 513 |
+
\label{bp}
|
| 514 |
+
\end{subfigure}
|
| 515 |
+
\hfill
|
| 516 |
+
\begin{subfigure}{1\linewidth}
|
| 517 |
+
\includegraphics[width=0.99\textwidth]{imgs/pg_adam.png}
|
| 518 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Ewp.}
|
| 519 |
+
\label{gp}
|
| 520 |
+
\end{subfigure}
|
| 521 |
+
\hfill
|
| 522 |
+
\begin{subfigure}{1\linewidth}
|
| 523 |
+
\includegraphics[width=0.99\textwidth]{imgs/ggl_adam.png}
|
| 524 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 525 |
+
\label{ggl}
|
| 526 |
+
\end{subfigure}
|
| 527 |
+
|
| 528 |
+
\caption{Learning curves of Resnet18 and its variants for $100$ epochs with optimizer of Adam. The learning rate is set to $0.001$. Radii are set to $\{ 0, 6, 12, 18, +\infty \}$}
|
| 529 |
+
\label{adam}
|
| 530 |
+
\end{figure*}
|
| 531 |
+
|
| 532 |
+
\begin{figure*}
|
| 533 |
+
\centering
|
| 534 |
+
\begin{subfigure}{1\linewidth}
|
| 535 |
+
|
| 536 |
+
\includegraphics[width=0.99\textwidth]{imgs/bprt4.png}
|
| 537 |
+
\caption{Comparison between Res18 and Res18-Ewp.}
|
| 538 |
+
\label{bp}
|
| 539 |
+
\end{subfigure}
|
| 540 |
+
\hfill
|
| 541 |
+
\begin{subfigure}{1\linewidth}
|
| 542 |
+
\includegraphics[width=0.99\textwidth]{imgs/pgrt4.png}
|
| 543 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Ewp.}
|
| 544 |
+
\label{gp}
|
| 545 |
+
\end{subfigure}
|
| 546 |
+
\hfill
|
| 547 |
+
\begin{subfigure}{1\linewidth}
|
| 548 |
+
\includegraphics[width=0.99\textwidth]{imgs/gglrt4.png}
|
| 549 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 550 |
+
\label{ggl}
|
| 551 |
+
\end{subfigure}
|
| 552 |
+
|
| 553 |
+
\caption{Learning curves of Resnet18 and its variants for $100$ epochs with optimizer of SGD. Radii are set to $\{ 0, 4, 8, 12, +\infty \}$. When the frequency intervals are too small, the differences between the methods become less pronounced, especially in the lower-frequency components. However, it remains evident that the different variants have distinct effects on learning the various frequency components. }
|
| 554 |
+
\label{rt4}
|
| 555 |
+
\end{figure*}
|
| 556 |
+
%Although the mobile latency of GmNet is not as good as that on GPU, our model still surpass most of existing methods.
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
\begin{figure*}
|
| 560 |
+
\centering
|
| 561 |
+
\begin{subfigure}{1\linewidth}
|
| 562 |
+
|
| 563 |
+
\includegraphics[width=0.99\textwidth]{imgs/bprt8.png}
|
| 564 |
+
\caption{Comparison between Res18 and Res18-Ewp.}
|
| 565 |
+
\label{bp}
|
| 566 |
+
\end{subfigure}
|
| 567 |
+
\hfill
|
| 568 |
+
\begin{subfigure}{1\linewidth}
|
| 569 |
+
\includegraphics[width=0.99\textwidth]{imgs/pgrt8.png}
|
| 570 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Ewp.}
|
| 571 |
+
\label{gp}
|
| 572 |
+
\end{subfigure}
|
| 573 |
+
\hfill
|
| 574 |
+
\begin{subfigure}{1\linewidth}
|
| 575 |
+
\includegraphics[width=0.99\textwidth]{imgs/gglrt8.png}
|
| 576 |
+
\caption{Comparison between Res18-Gate-ReLU and Res18-Gate-GELU.}
|
| 577 |
+
\label{ggl}
|
| 578 |
+
\end{subfigure}
|
| 579 |
+
|
| 580 |
+
\caption{Learning curves of Resnet18 and its variants for $100$ epochs with optimizer of SGD. Radii are set to $\{ 0, 8, 16, 24, +\infty \}$. When the frequency intervals are too large, all models struggle to classify higher-frequency components. Although differences between models become more pronounced in the lower-frequency components, such as between GELU and ReLU activations, to better understand the training dynamics, it is necessary to examine the differences in the high-frequency components as well.}
|
| 581 |
+
\label{rt8}
|
| 582 |
+
\end{figure*}
|
| 583 |
+
|
gmnet/project/gmnet_tpami/reference/source/sec/author.tex
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\author{Yifan Wang\textsuperscript{\rm 1}~~~Xu Ma\textsuperscript{\rm 1}~~~Yitian Zhang\textsuperscript{\rm 1}~~~Zhongruo Wang\textsuperscript{\rm 2}
|
| 2 |
+
%\\
|
| 3 |
+
%\And
|
| 4 |
+
~~~{\bf Sung-Cheol Kim\textsuperscript{\rm 3}}
|
| 5 |
+
\\
|
| 6 |
+
{\bf Vahid Mirjalili} \textsuperscript{\rm 3}~~~{\bf Vidya Renganathan}\textsuperscript{\rm 3}~~~{\bf Yun Fu}\textsuperscript{\rm 1}\\
|
| 7 |
+
\textsuperscript{\rm 1} Northeastern University
|
| 8 |
+
\hspace{0.3cm} \textsuperscript{\rm 2} UC Davis \hspace{0.3cm}
|
| 9 |
+
\textsuperscript{\rm 3} FM-Global \\
|
| 10 |
+
\small{\{wang.yifan25, ma.xu1, zhang.yitian\}@northeastern.edu, yunfu@ece.neu.edu }
|
| 11 |
+
%\\
|
| 12 |
+
%\small{\{sungcheol.kim, Vahid.Mirjalili, Vidya.Renganathan\}@fmglobal.com, yunfu@ece.neu.edu}
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
\if 0
|
| 18 |
+
\author{First Author\\
|
| 19 |
+
Institution1\\
|
| 20 |
+
Institution1 address\\
|
| 21 |
+
{\tt\small firstauthor@i1.org}
|
| 22 |
+
% For a paper whose authors are all at the same institution,
|
| 23 |
+
% omit the following lines up until the closing ``}''.
|
| 24 |
+
% Additional authors and addresses can be added with ``\and'',
|
| 25 |
+
% just like the second author.
|
| 26 |
+
% To save space, use either the email address or home page, not both
|
| 27 |
+
\and
|
| 28 |
+
Second Author\\
|
| 29 |
+
Institution2\\
|
| 30 |
+
First line of institution2 address\\
|
| 31 |
+
{\tt\small secondauthor@i2.org}
|
| 32 |
+
}
|
| 33 |
+
\fi
|
gmnet/project/gmnet_tpami/scripts/run_e4_imagenet_spectral_audit.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gmnet/project/gmnet_tpami/scripts/summarize_e4_mechanism.py
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ed ImageNet mechanism evidence report."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import csv
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
import hashlib
|
| 10 |
+
import json
|
| 11 |
+
import os
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
import statistics
|
| 14 |
+
import sys
|
| 15 |
+
from typing import Any
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
JOURNAL_ROOT = Path("/nfs/ywang29/GmNet/journal_exp")
|
| 19 |
+
if str(JOURNAL_ROOT) not in sys.path:
|
| 20 |
+
sys.path.insert(0, str(JOURNAL_ROOT))
|
| 21 |
+
|
| 22 |
+
from scripts.evaluate_imagenet_long import validate_official_eval
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
DEFAULT_OUTPUT = Path(
|
| 26 |
+
"/nfs/ywang29/GmNet/local_results/e4_mechanism_followup_20260718"
|
| 27 |
+
)
|
| 28 |
+
RUNS_ROOT = Path("/nfs/ywang29/GmNet/runs")
|
| 29 |
+
METRICS = ("top1", "top5", "nll", "ece")
|
| 30 |
+
EXPECTED_CHANNEL_MANIFEST = (
|
| 31 |
+
"0219d0a289ae2e3c2bde90568af4b05d23ca629522f1b19b6a1d09473d87fb8b"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@dataclass(frozen=True)
|
| 36 |
+
class RunSpec:
|
| 37 |
+
key: str
|
| 38 |
+
label: str
|
| 39 |
+
path: Path
|
| 40 |
+
family: str
|
| 41 |
+
role: str
|
| 42 |
+
primary_reference: str
|
| 43 |
+
expected_epochs: int = 300
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
RUN_SPECS = (
|
| 47 |
+
RunSpec(
|
| 48 |
+
"B",
|
| 49 |
+
"Current-code ReLU6 baseline",
|
| 50 |
+
RUNS_ROOT
|
| 51 |
+
/ "e4_mechanism_followup/e4f_s3_current_baseline_seed0",
|
| 52 |
+
"mechanism",
|
| 53 |
+
"baseline",
|
| 54 |
+
"B",
|
| 55 |
+
),
|
| 56 |
+
RunSpec(
|
| 57 |
+
"H",
|
| 58 |
+
"Historical paper-recipe ReLU6",
|
| 59 |
+
RUNS_ROOT / "e0_s3_seed0",
|
| 60 |
+
"context",
|
| 61 |
+
"historical_baseline",
|
| 62 |
+
"B",
|
| 63 |
+
),
|
| 64 |
+
RunSpec(
|
| 65 |
+
"S",
|
| 66 |
+
"Stop-gradient",
|
| 67 |
+
RUNS_ROOT / "e4_alignment/e4a_s3_stop_gradient_seed0",
|
| 68 |
+
"mechanism",
|
| 69 |
+
"stop_gradient",
|
| 70 |
+
"B",
|
| 71 |
+
),
|
| 72 |
+
RunSpec(
|
| 73 |
+
"C",
|
| 74 |
+
"Channel derangement",
|
| 75 |
+
RUNS_ROOT / "e4_alignment/e4a_s3_channel_derangement_seed0",
|
| 76 |
+
"mechanism",
|
| 77 |
+
"channel_derangement",
|
| 78 |
+
"B",
|
| 79 |
+
),
|
| 80 |
+
RunSpec(
|
| 81 |
+
"D",
|
| 82 |
+
"Batch derangement",
|
| 83 |
+
RUNS_ROOT
|
| 84 |
+
/ "e4_mechanism_followup/e4f_s3_batch_derangement_seed0",
|
| 85 |
+
"mechanism",
|
| 86 |
+
"batch_derangement",
|
| 87 |
+
"B",
|
| 88 |
+
),
|
| 89 |
+
RunSpec(
|
| 90 |
+
"SC",
|
| 91 |
+
"Stop-gradient + channel derangement",
|
| 92 |
+
RUNS_ROOT
|
| 93 |
+
/ "e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0",
|
| 94 |
+
"mechanism",
|
| 95 |
+
"combined",
|
| 96 |
+
"B",
|
| 97 |
+
),
|
| 98 |
+
RunSpec(
|
| 99 |
+
"RELU",
|
| 100 |
+
"ReLU self-gate",
|
| 101 |
+
RUNS_ROOT / "e3_s3_relu_seed0",
|
| 102 |
+
"gate_shape",
|
| 103 |
+
"unclipped_relu",
|
| 104 |
+
"H",
|
| 105 |
+
),
|
| 106 |
+
RunSpec(
|
| 107 |
+
"GELU",
|
| 108 |
+
"GELU self-gate",
|
| 109 |
+
RUNS_ROOT / "e3_s3_gelu_seed0",
|
| 110 |
+
"gate_shape",
|
| 111 |
+
"gelu",
|
| 112 |
+
"H",
|
| 113 |
+
),
|
| 114 |
+
RunSpec(
|
| 115 |
+
"LS",
|
| 116 |
+
"Learned smooth cap",
|
| 117 |
+
RUNS_ROOT / "e3_s3_smooth_static_seed0",
|
| 118 |
+
"clipping",
|
| 119 |
+
"learned_smooth",
|
| 120 |
+
"H",
|
| 121 |
+
),
|
| 122 |
+
RunSpec(
|
| 123 |
+
"F6",
|
| 124 |
+
"Fixed smooth cap c=6",
|
| 125 |
+
RUNS_ROOT
|
| 126 |
+
/ "single_seed_followup/ssfu_e3_s3_smooth_fixed_c6_seed0",
|
| 127 |
+
"clipping",
|
| 128 |
+
"fixed_smooth_c6",
|
| 129 |
+
"H",
|
| 130 |
+
),
|
| 131 |
+
RunSpec(
|
| 132 |
+
"A",
|
| 133 |
+
"ReLU6 only (no self-multiplication)",
|
| 134 |
+
RUNS_ROOT / "single_seed_followup/ssfu_e3_s3_relu6_only_seed0",
|
| 135 |
+
"operator",
|
| 136 |
+
"activation_only",
|
| 137 |
+
"H",
|
| 138 |
+
),
|
| 139 |
+
RunSpec(
|
| 140 |
+
"N",
|
| 141 |
+
"No complete gated operator",
|
| 142 |
+
RUNS_ROOT / "single_seed_followup/ssfu_e3_s3_no_gate_seed0",
|
| 143 |
+
"operator",
|
| 144 |
+
"no_gate",
|
| 145 |
+
"H",
|
| 146 |
+
),
|
| 147 |
+
RunSpec(
|
| 148 |
+
"R",
|
| 149 |
+
"Release-paper-BN recipe audit",
|
| 150 |
+
RUNS_ROOT
|
| 151 |
+
/ "single_seed_followup/ssfu_e0_s3_release_paperbn_seed0",
|
| 152 |
+
"recipe_audit",
|
| 153 |
+
"release_paper_bn",
|
| 154 |
+
"H",
|
| 155 |
+
expected_epochs=310,
|
| 156 |
+
),
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
MECHANISM_KEYS = ("B", "H", "S", "C", "D", "SC")
|
| 160 |
+
DIAGNOSTIC_KEYS = ("B", "S", "C", "D", "SC")
|
| 161 |
+
GATE_CONTEXT_KEYS = ("H", "RELU", "GELU", "LS", "F6", "A", "N", "R")
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def parse_args() -> argparse.Namespace:
|
| 165 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 166 |
+
parser.add_argument("--output-dir", type=Path, default=DEFAULT_OUTPUT)
|
| 167 |
+
parser.add_argument(
|
| 168 |
+
"--check",
|
| 169 |
+
action="store_true",
|
| 170 |
+
help="Regenerate in memory and require existing files to match exactly.",
|
| 171 |
+
)
|
| 172 |
+
return parser.parse_args()
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
def stable_json(value: Any) -> str:
|
| 176 |
+
return json.dumps(
|
| 177 |
+
value,
|
| 178 |
+
indent=2,
|
| 179 |
+
sort_keys=True,
|
| 180 |
+
allow_nan=False,
|
| 181 |
+
ensure_ascii=False,
|
| 182 |
+
) + "\n"
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def csv_text(rows: list[dict[str, Any]]) -> str:
|
| 186 |
+
if not rows:
|
| 187 |
+
raise ValueError("refusing to render an empty CSV")
|
| 188 |
+
fields: list[str] = []
|
| 189 |
+
for row in rows:
|
| 190 |
+
for field in row:
|
| 191 |
+
if field not in fields:
|
| 192 |
+
fields.append(field)
|
| 193 |
+
from io import StringIO
|
| 194 |
+
|
| 195 |
+
stream = StringIO(newline="")
|
| 196 |
+
writer = csv.DictWriter(stream, fieldnames=fields, lineterminator="\n")
|
| 197 |
+
writer.writeheader()
|
| 198 |
+
writer.writerows(rows)
|
| 199 |
+
return stream.getvalue()
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def read_json(path: Path) -> dict[str, Any]:
|
| 203 |
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
| 204 |
+
if not isinstance(payload, dict):
|
| 205 |
+
raise TypeError(f"expected JSON object: {path}")
|
| 206 |
+
return payload
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def sha256_file(path: Path) -> str:
|
| 210 |
+
digest = hashlib.sha256()
|
| 211 |
+
with path.open("rb") as handle:
|
| 212 |
+
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
| 213 |
+
digest.update(chunk)
|
| 214 |
+
return digest.hexdigest()
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def validate_run(spec: RunSpec) -> dict[str, Any]:
|
| 218 |
+
official = spec.path / "official_eval"
|
| 219 |
+
checkpoint = spec.path / "checkpoint_last.pt"
|
| 220 |
+
if not (official / "COMPLETE").is_file():
|
| 221 |
+
raise FileNotFoundError(f"official COMPLETE marker is missing: {official}")
|
| 222 |
+
result = validate_official_eval(
|
| 223 |
+
official,
|
| 224 |
+
checkpoint_path=checkpoint,
|
| 225 |
+
require_check_certificate=True,
|
| 226 |
+
)
|
| 227 |
+
completion = result["training_completion"]
|
| 228 |
+
expected_steps = spec.expected_epochs * 625
|
| 229 |
+
problems: list[str] = []
|
| 230 |
+
if result.get("status") != "complete" or result.get("partial_evaluation") is not False:
|
| 231 |
+
problems.append("official evaluation is not complete")
|
| 232 |
+
if int(result["training_epochs"]) != spec.expected_epochs:
|
| 233 |
+
problems.append("training epoch count differs from the registered run")
|
| 234 |
+
if int(result["checkpoint_epoch"]) != spec.expected_epochs - 1:
|
| 235 |
+
problems.append("checkpoint is not the fixed final epoch")
|
| 236 |
+
if int(completion["global_step"]) != expected_steps:
|
| 237 |
+
problems.append("global step count differs from the registered run")
|
| 238 |
+
if completion.get("training_complete") is not True:
|
| 239 |
+
problems.append("training_complete is not true")
|
| 240 |
+
if int(completion["world_size"]) != 8:
|
| 241 |
+
problems.append("world size is not eight")
|
| 242 |
+
if int(result["metrics"]["samples"]) != 50_000:
|
| 243 |
+
problems.append("official evaluation does not contain 50,000 samples")
|
| 244 |
+
if problems:
|
| 245 |
+
raise RuntimeError(f"{spec.key} failed validation: {'; '.join(problems)}")
|
| 246 |
+
checks = read_json(official / "checks.json")
|
| 247 |
+
return {
|
| 248 |
+
"spec": spec,
|
| 249 |
+
"result": result,
|
| 250 |
+
"checks": checks,
|
| 251 |
+
"diagnostics": read_json(official / "gate_diagnostics.json"),
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
def metric_rows(validated: dict[str, dict[str, Any]]) -> list[dict[str, Any]]:
|
| 256 |
+
rows: list[dict[str, Any]] = []
|
| 257 |
+
for spec in RUN_SPECS:
|
| 258 |
+
item = validated[spec.key]
|
| 259 |
+
result = item["result"]
|
| 260 |
+
reference = validated[spec.primary_reference]["result"]["metrics"]
|
| 261 |
+
metrics = result["metrics"]
|
| 262 |
+
row: dict[str, Any] = {
|
| 263 |
+
"key": spec.key,
|
| 264 |
+
"label": spec.label,
|
| 265 |
+
"family": spec.family,
|
| 266 |
+
"role": spec.role,
|
| 267 |
+
"reference": spec.primary_reference,
|
| 268 |
+
"run_name": result["run_name"],
|
| 269 |
+
"run_dir": str(spec.path),
|
| 270 |
+
"checkpoint_sha256": result["hashes"]["checkpoint_sha256"],
|
| 271 |
+
"epochs": result["training_epochs"],
|
| 272 |
+
"global_step": result["training_completion"]["global_step"],
|
| 273 |
+
"samples": metrics["samples"],
|
| 274 |
+
"checks_status": item["checks"]["status"],
|
| 275 |
+
}
|
| 276 |
+
for metric in METRICS:
|
| 277 |
+
value = float(metrics[metric])
|
| 278 |
+
row[metric] = value
|
| 279 |
+
row[f"delta_{metric}"] = value - float(reference[metric])
|
| 280 |
+
rows.append(row)
|
| 281 |
+
return rows
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def aggregate_diagnostics(
|
| 285 |
+
key: str,
|
| 286 |
+
diagnostics: dict[str, Any],
|
| 287 |
+
) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
|
| 288 |
+
blocks = diagnostics.get("blocks")
|
| 289 |
+
if not isinstance(blocks, list) or len(blocks) != 17:
|
| 290 |
+
raise RuntimeError(f"{key} does not contain exactly 17 gate diagnostics")
|
| 291 |
+
block_rows: list[dict[str, Any]] = []
|
| 292 |
+
for block in blocks:
|
| 293 |
+
intervention = block["gate_intervention"]
|
| 294 |
+
coherence = intervention.get("coherence") or {}
|
| 295 |
+
block_rows.append(
|
| 296 |
+
{
|
| 297 |
+
"key": key,
|
| 298 |
+
"stage": int(block["stage"]),
|
| 299 |
+
"block": int(block["block"]),
|
| 300 |
+
"global_block_index": int(block["global_block_index"]),
|
| 301 |
+
"module": block["module"],
|
| 302 |
+
"mode": intervention["mode"],
|
| 303 |
+
"coherence_pearson_proxy": coherence.get("pearson"),
|
| 304 |
+
"element_count": int(block["element_count"]),
|
| 305 |
+
"negative_fraction": float(block["negative_fraction"]),
|
| 306 |
+
"active_0_to_6_fraction": float(block["active_0_to_6_fraction"]),
|
| 307 |
+
"clip_crossing_fraction": block.get("actual_clip_crossing_fraction"),
|
| 308 |
+
"permutation_sha256": (intervention.get("permutation") or {}).get(
|
| 309 |
+
"sha256"
|
| 310 |
+
),
|
| 311 |
+
}
|
| 312 |
+
)
|
| 313 |
+
|
| 314 |
+
stage_rows: list[dict[str, Any]] = []
|
| 315 |
+
for stage in ("all", 1, 2, 3, 4):
|
| 316 |
+
selected = blocks if stage == "all" else [b for b in blocks if b["stage"] == stage]
|
| 317 |
+
total = sum(int(block["element_count"]) for block in selected)
|
| 318 |
+
coherences = [
|
| 319 |
+
float(block["gate_intervention"]["coherence"]["pearson"])
|
| 320 |
+
for block in selected
|
| 321 |
+
if block["gate_intervention"].get("coherence", {}).get("pearson")
|
| 322 |
+
is not None
|
| 323 |
+
]
|
| 324 |
+
crossing_count = sum(
|
| 325 |
+
int(block.get("actual_clip_crossing_count") or 0) for block in selected
|
| 326 |
+
)
|
| 327 |
+
stage_rows.append(
|
| 328 |
+
{
|
| 329 |
+
"key": key,
|
| 330 |
+
"stage": stage,
|
| 331 |
+
"block_count": len(selected),
|
| 332 |
+
"element_count": total,
|
| 333 |
+
"coherence_proxy_mean": statistics.mean(coherences),
|
| 334 |
+
"coherence_proxy_min": min(coherences),
|
| 335 |
+
"coherence_proxy_max": max(coherences),
|
| 336 |
+
"negative_fraction": sum(
|
| 337 |
+
int(block["negative_count"]) for block in selected
|
| 338 |
+
)
|
| 339 |
+
/ total,
|
| 340 |
+
"active_0_to_6_fraction": sum(
|
| 341 |
+
int(block["active_0_to_6_count"]) for block in selected
|
| 342 |
+
)
|
| 343 |
+
/ total,
|
| 344 |
+
"clip_crossing_fraction": crossing_count / total,
|
| 345 |
+
}
|
| 346 |
+
)
|
| 347 |
+
return block_rows, stage_rows
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def validate_intervention_contracts(validated: dict[str, dict[str, Any]]) -> None:
|
| 351 |
+
topologies = {
|
| 352 |
+
(
|
| 353 |
+
item["result"]["topology"]["parameter_count"],
|
| 354 |
+
item["result"]["topology"]["model_state_schema_sha256"],
|
| 355 |
+
)
|
| 356 |
+
for key, item in validated.items()
|
| 357 |
+
if key in DIAGNOSTIC_KEYS
|
| 358 |
+
}
|
| 359 |
+
if len(topologies) != 1:
|
| 360 |
+
raise RuntimeError("mechanism arms do not share one model topology")
|
| 361 |
+
parameter_count, _ = next(iter(topologies))
|
| 362 |
+
if int(parameter_count) != 7_791_544:
|
| 363 |
+
raise RuntimeError("mechanism arms do not use the registered S3 topology")
|
| 364 |
+
|
| 365 |
+
channel = validated["C"]["result"]["gate_intervention"]
|
| 366 |
+
combined = validated["SC"]["result"]["gate_intervention"]
|
| 367 |
+
for identity in (channel, combined):
|
| 368 |
+
if identity.get("permutation_manifest_sha256") != EXPECTED_CHANNEL_MANIFEST:
|
| 369 |
+
raise RuntimeError("channel permutation manifest differs from registration")
|
| 370 |
+
|
| 371 |
+
batch_blocks = validated["D"]["diagnostics"]["blocks"]
|
| 372 |
+
for block in batch_blocks:
|
| 373 |
+
mappings = block["gate_intervention"].get("batch_derangements")
|
| 374 |
+
if not isinstance(mappings, list) or {m["local_batch_size"] for m in mappings} != {
|
| 375 |
+
80,
|
| 376 |
+
256,
|
| 377 |
+
}:
|
| 378 |
+
raise RuntimeError("batch arm does not contain canonical B=256/80 mappings")
|
| 379 |
+
if any(
|
| 380 |
+
mapping.get("is_bijection") is not True
|
| 381 |
+
or int(mapping.get("fixed_points", -1)) != 0
|
| 382 |
+
for mapping in mappings
|
| 383 |
+
):
|
| 384 |
+
raise RuntimeError("batch arm contains an invalid derangement")
|
| 385 |
+
if sum(int(mapping["receiver_samples"]) for mapping in mappings) != 50_000:
|
| 386 |
+
raise RuntimeError("batch arm mapping does not cover all validation samples")
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def artifact_rows(validated: dict[str, dict[str, Any]]) -> list[dict[str, Any]]:
|
| 390 |
+
rows: list[dict[str, Any]] = []
|
| 391 |
+
for spec in RUN_SPECS:
|
| 392 |
+
item = validated[spec.key]
|
| 393 |
+
result = item["result"]
|
| 394 |
+
rows.append(
|
| 395 |
+
{
|
| 396 |
+
"key": spec.key,
|
| 397 |
+
"artifact": "checkpoint_last.pt",
|
| 398 |
+
"sha256": result["hashes"]["checkpoint_sha256"],
|
| 399 |
+
"path": str(spec.path / "checkpoint_last.pt"),
|
| 400 |
+
}
|
| 401 |
+
)
|
| 402 |
+
for relative in (
|
| 403 |
+
"results.json",
|
| 404 |
+
"checks.json",
|
| 405 |
+
"gate_diagnostics.json",
|
| 406 |
+
"per_sample.npz",
|
| 407 |
+
):
|
| 408 |
+
path = spec.path / "official_eval" / relative
|
| 409 |
+
rows.append(
|
| 410 |
+
{
|
| 411 |
+
"key": spec.key,
|
| 412 |
+
"artifact": relative,
|
| 413 |
+
"sha256": sha256_file(path),
|
| 414 |
+
"path": str(path),
|
| 415 |
+
}
|
| 416 |
+
)
|
| 417 |
+
return rows
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
def fmt(value: float, digits: int = 3) -> str:
|
| 421 |
+
return f"{value:.{digits}f}"
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
def render_report(
|
| 425 |
+
metrics: list[dict[str, Any]],
|
| 426 |
+
stages: list[dict[str, Any]],
|
| 427 |
+
interaction: dict[str, dict[str, float]],
|
| 428 |
+
) -> str:
|
| 429 |
+
by_key = {row["key"]: row for row in metrics}
|
| 430 |
+
stage_all = {row["key"]: row for row in stages if row["stage"] == "all"}
|
| 431 |
+
lines = [
|
| 432 |
+
"# GmNet ImageNet Mechanism Evidence",
|
| 433 |
+
"",
|
| 434 |
+
"Frozen on 2026-07-18 after certificate-validated fixed-last evaluation.",
|
| 435 |
+
"All mechanism comparisons are seed-0 descriptive effect sizes.",
|
| 436 |
+
"",
|
| 437 |
+
"## Artifact Acceptance",
|
| 438 |
+
"",
|
| 439 |
+
"All listed runs have a COMPLETE marker, a passed official certificate,",
|
| 440 |
+
"50,000 validation samples, a fixed-final checkpoint, finite metrics, and",
|
| 441 |
+
"complete step accounting. Mechanism arms use 8 GPUs, 300 epochs, and",
|
| 442 |
+
"187,500 optimizer steps.",
|
| 443 |
+
"",
|
| 444 |
+
"## Mechanism Panel",
|
| 445 |
+
"",
|
| 446 |
+
"| Arm | Top-1 | Delta | Top-5 | Delta | NLL | ECE |",
|
| 447 |
+
"|---|---:|---:|---:|---:|---:|---:|",
|
| 448 |
+
]
|
| 449 |
+
for key in MECHANISM_KEYS:
|
| 450 |
+
row = by_key[key]
|
| 451 |
+
lines.append(
|
| 452 |
+
f"| {key}: {row['label']} | {fmt(row['top1'])} | "
|
| 453 |
+
f"{fmt(row['delta_top1'])} | {fmt(row['top5'])} | "
|
| 454 |
+
f"{fmt(row['delta_top5'])} | {fmt(row['nll'], 6)} | "
|
| 455 |
+
f"{fmt(row['ece'], 6)} |"
|
| 456 |
+
)
|
| 457 |
+
lines.extend(
|
| 458 |
+
[
|
| 459 |
+
"",
|
| 460 |
+
"The current-code baseline differs from the historical baseline by "
|
| 461 |
+
f"{by_key['B']['top1'] - by_key['H']['top1']:+.3f} Top-1 points.",
|
| 462 |
+
"",
|
| 463 |
+
"## Descriptive Combined Interaction",
|
| 464 |
+
"",
|
| 465 |
+
"The raw-scale definition is `prediction = S + C - B` and "
|
| 466 |
+
"`interaction = SC - prediction`.",
|
| 467 |
+
"",
|
| 468 |
+
"| Metric | Additive prediction | Observed SC | Interaction |",
|
| 469 |
+
"|---|---:|---:|---:|",
|
| 470 |
+
]
|
| 471 |
+
)
|
| 472 |
+
for metric in METRICS:
|
| 473 |
+
row = interaction[metric]
|
| 474 |
+
lines.append(
|
| 475 |
+
f"| {metric} | {fmt(row['additive_prediction'], 6)} | "
|
| 476 |
+
f"{fmt(row['observed'], 6)} | {fmt(row['interaction'], 6)} |"
|
| 477 |
+
)
|
| 478 |
+
lines.extend(
|
| 479 |
+
[
|
| 480 |
+
"",
|
| 481 |
+
"Top-1 interaction is descriptive, not a population-level factorial test.",
|
| 482 |
+
"",
|
| 483 |
+
"## Gate Operating Regime",
|
| 484 |
+
"",
|
| 485 |
+
"Coherence is the mean of 17 block-level Pearson proxies computed on the",
|
| 486 |
+
"first canonical validation sample. Region fractions are element-weighted",
|
| 487 |
+
"over all 50,000 validation images.",
|
| 488 |
+
"",
|
| 489 |
+
"| Arm | Coherence proxy | Negative | Active [0,6) | Clip crossing |",
|
| 490 |
+
"|---|---:|---:|---:|---:|",
|
| 491 |
+
]
|
| 492 |
+
)
|
| 493 |
+
for key in DIAGNOSTIC_KEYS:
|
| 494 |
+
row = stage_all[key]
|
| 495 |
+
lines.append(
|
| 496 |
+
f"| {key} | {fmt(row['coherence_proxy_mean'], 4)} | "
|
| 497 |
+
f"{100 * row['negative_fraction']:.3f}% | "
|
| 498 |
+
f"{100 * row['active_0_to_6_fraction']:.3f}% | "
|
| 499 |
+
f"{100 * row['clip_crossing_fraction']:.4f}% |"
|
| 500 |
+
)
|
| 501 |
+
lines.extend(
|
| 502 |
+
[
|
| 503 |
+
"",
|
| 504 |
+
"Batch derangement learns a high cross-sample coherence proxy but shifts",
|
| 505 |
+
"most values into the negative region and remains 24.436 Top-1 points",
|
| 506 |
+
"below baseline. This is partial adaptation to shared/marginal gate",
|
| 507 |
+
"statistics, not preservation of same-sample modulation.",
|
| 508 |
+
"",
|
| 509 |
+
"Channel derangement alone retains 77.794 Top-1 and develops increasing",
|
| 510 |
+
"deep-stage coherence. The combined arm uses the identical channel",
|
| 511 |
+
"permutation, keeps coherence near zero, and falls to 69.508. This supports",
|
| 512 |
+
"the gate-gradient path as part of adaptation to a fixed mismatch.",
|
| 513 |
+
"",
|
| 514 |
+
"## Gate Shape And Clipping Context",
|
| 515 |
+
"",
|
| 516 |
+
"| Arm | Top-1 | Delta vs H | Top-5 | NLL | ECE |",
|
| 517 |
+
"|---|---:|---:|---:|---:|---:|",
|
| 518 |
+
]
|
| 519 |
+
)
|
| 520 |
+
for key in GATE_CONTEXT_KEYS:
|
| 521 |
+
row = by_key[key]
|
| 522 |
+
delta_vs_h = row["top1"] - by_key["H"]["top1"]
|
| 523 |
+
lines.append(
|
| 524 |
+
f"| {key}: {row['label']} | {fmt(row['top1'])} | "
|
| 525 |
+
f"{fmt(delta_vs_h)} | {fmt(row['top5'])} | "
|
| 526 |
+
f"{fmt(row['nll'], 6)} | {fmt(row['ece'], 6)} |"
|
| 527 |
+
)
|
| 528 |
+
lines.extend(
|
| 529 |
+
[
|
| 530 |
+
"",
|
| 531 |
+
"ReLU, GELU, learned smooth, and fixed-c6 variants remain close to the",
|
| 532 |
+
"historical ReLU6 result at seed 0. Clip-crossing frequency is not monotonic",
|
| 533 |
+
"with accuracy. Clipping is therefore supported as an operating-range and",
|
| 534 |
+
"spectral-spill control, not as a uniquely accuracy-improving activation.",
|
| 535 |
+
"The release-paper-BN row is a different 310-epoch recipe and is context only.",
|
| 536 |
+
"",
|
| 537 |
+
"## Frozen Claim",
|
| 538 |
+
"",
|
| 539 |
+
"> GmNet does not benefit from indiscriminate high-frequency amplification.",
|
| 540 |
+
"> Its self-gate performs input-conditioned multiplicative spectral mixing,",
|
| 541 |
+
"> whose task value depends on sample-conditioned carrier-gate coupling and",
|
| 542 |
+
"> an optimizable gate-gradient path. Exact channel correspondence is helpful",
|
| 543 |
+
"> but adaptable. Clipping bounds the operating range and spectral spill",
|
| 544 |
+
"> rather than uniquely determining clean accuracy.",
|
| 545 |
+
"",
|
| 546 |
+
"## Claim Boundaries",
|
| 547 |
+
"",
|
| 548 |
+
"- These are independently trained single-seed effect sizes; no significance, equivalence, or population-level interaction is claimed.",
|
| 549 |
+
"- Batch derangement changes the forward donor, cross-sample gradients, and batch/order dependence. It is not a pure forward-alignment intervention.",
|
| 550 |
+
"- Coherence is a one-sample-per-block proxy, not a full-dataset semantic-alignment measure or a causal mediator.",
|
| 551 |
+
"- Historical B/S/C launch-time provenance is not identical to the current batch, although certificates pass and B reproduces H within 0.052 points.",
|
| 552 |
+
"- Accuracy and gate-region diagnostics alone do not establish that total spectral mixing is matched across arms; a common post-hoc spectral audit is reported separately when available.",
|
| 553 |
+
]
|
| 554 |
+
)
|
| 555 |
+
return "\n".join(lines) + "\n"
|
| 556 |
+
|
| 557 |
+
|
| 558 |
+
def build_outputs() -> dict[str, str]:
|
| 559 |
+
validated = {spec.key: validate_run(spec) for spec in RUN_SPECS}
|
| 560 |
+
validate_intervention_contracts(validated)
|
| 561 |
+
metrics = metric_rows(validated)
|
| 562 |
+
by_key = {row["key"]: row for row in metrics}
|
| 563 |
+
|
| 564 |
+
block_rows: list[dict[str, Any]] = []
|
| 565 |
+
stage_rows: list[dict[str, Any]] = []
|
| 566 |
+
for key in DIAGNOSTIC_KEYS:
|
| 567 |
+
blocks, stages = aggregate_diagnostics(key, validated[key]["diagnostics"])
|
| 568 |
+
block_rows.extend(blocks)
|
| 569 |
+
stage_rows.extend(stages)
|
| 570 |
+
|
| 571 |
+
interaction: dict[str, dict[str, float]] = {}
|
| 572 |
+
for metric in METRICS:
|
| 573 |
+
prediction = by_key["S"][metric] + by_key["C"][metric] - by_key["B"][metric]
|
| 574 |
+
observed = by_key["SC"][metric]
|
| 575 |
+
interaction[metric] = {
|
| 576 |
+
"additive_prediction": prediction,
|
| 577 |
+
"observed": observed,
|
| 578 |
+
"interaction": observed - prediction,
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
artifacts = artifact_rows(validated)
|
| 582 |
+
payload = {
|
| 583 |
+
"schema_version": 1,
|
| 584 |
+
"protocol": "e4-imagenet-mechanism-unified-single-seed-v1",
|
| 585 |
+
"created_at_utc": max(
|
| 586 |
+
str(item["result"]["metadata"]["finished_at_utc"])
|
| 587 |
+
for item in validated.values()
|
| 588 |
+
),
|
| 589 |
+
"status": "complete",
|
| 590 |
+
"checkpoint_policy": "fixed checkpoint_last only",
|
| 591 |
+
"statistical_scope": "single-seed descriptive effect sizes",
|
| 592 |
+
"primary_reference": "B",
|
| 593 |
+
"metrics": metrics,
|
| 594 |
+
"descriptive_combined_interaction": interaction,
|
| 595 |
+
"gate_diagnostics_by_stage": stage_rows,
|
| 596 |
+
"channel_permutation_manifest_sha256": EXPECTED_CHANNEL_MANIFEST,
|
| 597 |
+
"claim": (
|
| 598 |
+
"Input-conditioned multiplicative spectral mixing is useful when carrier "
|
| 599 |
+
"and gate retain task-relevant conditional coupling and the gate-gradient "
|
| 600 |
+
"path can adapt; clipping controls the operating range rather than uniquely "
|
| 601 |
+
"determining clean accuracy."
|
| 602 |
+
),
|
| 603 |
+
}
|
| 604 |
+
artifact_manifest = "".join(
|
| 605 |
+
f"{row['sha256']} {row['path']}\n" for row in artifacts
|
| 606 |
+
)
|
| 607 |
+
return {
|
| 608 |
+
"results.json": stable_json(payload),
|
| 609 |
+
"official_metrics.csv": csv_text(metrics),
|
| 610 |
+
"gate_diagnostics_by_block.csv": csv_text(block_rows),
|
| 611 |
+
"gate_diagnostics_by_stage.csv": csv_text(stage_rows),
|
| 612 |
+
"source_artifacts.sha256": artifact_manifest,
|
| 613 |
+
"REPORT.md": render_report(metrics, stage_rows, interaction),
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
|
| 617 |
+
def write_or_check(output_dir: Path, outputs: dict[str, str], check: bool) -> None:
|
| 618 |
+
if check:
|
| 619 |
+
mismatches = []
|
| 620 |
+
for name, expected in outputs.items():
|
| 621 |
+
path = output_dir / name
|
| 622 |
+
if not path.is_file() or path.read_text(encoding="utf-8") != expected:
|
| 623 |
+
mismatches.append(str(path))
|
| 624 |
+
if mismatches:
|
| 625 |
+
raise RuntimeError(f"unified outputs are missing or stale: {mismatches}")
|
| 626 |
+
return
|
| 627 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 628 |
+
for name, content in outputs.items():
|
| 629 |
+
path = output_dir / name
|
| 630 |
+
temporary = path.with_name(f".{path.name}.tmp")
|
| 631 |
+
temporary.write_text(content, encoding="utf-8")
|
| 632 |
+
os.replace(temporary, path)
|
| 633 |
+
|
| 634 |
+
|
| 635 |
+
def main() -> None:
|
| 636 |
+
args = parse_args()
|
| 637 |
+
output_dir = args.output_dir.resolve()
|
| 638 |
+
outputs = build_outputs()
|
| 639 |
+
write_or_check(output_dir, outputs, args.check)
|
| 640 |
+
action = "Validated" if args.check else "Wrote"
|
| 641 |
+
print(f"{action} unified E4 mechanism report: {output_dir}")
|
| 642 |
+
|
| 643 |
+
|
| 644 |
+
if __name__ == "__main__":
|
| 645 |
+
main()
|
gmnet/project/gmnet_tpami/scripts/summarize_tpami_seed0_confirmatory.py
ADDED
|
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Validate and summarize the seed-0 TPAMI B/S/D/DD ImageNet panel."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import csv
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
import hashlib
|
| 10 |
+
from io import StringIO
|
| 11 |
+
import json
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
import sys
|
| 14 |
+
from typing import Any
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
CODE_ROOT = Path("/nfs/ywang29/GmNet/tpami_confirmatory_20260720/code")
|
| 20 |
+
if str(CODE_ROOT) not in sys.path:
|
| 21 |
+
sys.path.insert(0, str(CODE_ROOT))
|
| 22 |
+
|
| 23 |
+
from scripts.evaluate_imagenet_long import validate_official_eval
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
RUNS_ROOT = Path("/nfs/ywang29/GmNet/runs")
|
| 27 |
+
DEFAULT_OUTPUT = Path(
|
| 28 |
+
"/nfs/ywang29/GmNet/local_results/tpami_seed0_confirmatory_20260721"
|
| 29 |
+
)
|
| 30 |
+
BOOTSTRAP_REPLICATES = 10_000
|
| 31 |
+
BOOTSTRAP_SEED = 20_260_718
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@dataclass(frozen=True)
|
| 35 |
+
class RunSpec:
|
| 36 |
+
scale: str
|
| 37 |
+
arm: str
|
| 38 |
+
label: str
|
| 39 |
+
path: Path
|
| 40 |
+
new_run: bool
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
RUN_SPECS = (
|
| 44 |
+
RunSpec(
|
| 45 |
+
"S1",
|
| 46 |
+
"B",
|
| 47 |
+
"baseline",
|
| 48 |
+
RUNS_ROOT / "tpami_confirmatory_20260720/tpami_s1_b_seed0",
|
| 49 |
+
True,
|
| 50 |
+
),
|
| 51 |
+
RunSpec(
|
| 52 |
+
"S1",
|
| 53 |
+
"S",
|
| 54 |
+
"stop_gradient",
|
| 55 |
+
RUNS_ROOT / "tpami_confirmatory_20260720/tpami_s1_s_seed0",
|
| 56 |
+
True,
|
| 57 |
+
),
|
| 58 |
+
RunSpec(
|
| 59 |
+
"S1",
|
| 60 |
+
"D",
|
| 61 |
+
"batch_derangement",
|
| 62 |
+
RUNS_ROOT / "tpami_confirmatory_20260720/tpami_s1_d_seed0",
|
| 63 |
+
True,
|
| 64 |
+
),
|
| 65 |
+
RunSpec(
|
| 66 |
+
"S1",
|
| 67 |
+
"DD",
|
| 68 |
+
"stop_gradient_batch_derangement",
|
| 69 |
+
RUNS_ROOT / "tpami_confirmatory_20260720/tpami_s1_dd_seed0",
|
| 70 |
+
True,
|
| 71 |
+
),
|
| 72 |
+
RunSpec(
|
| 73 |
+
"S3",
|
| 74 |
+
"B",
|
| 75 |
+
"baseline",
|
| 76 |
+
RUNS_ROOT / "e4_mechanism_followup/e4f_s3_current_baseline_seed0",
|
| 77 |
+
False,
|
| 78 |
+
),
|
| 79 |
+
RunSpec(
|
| 80 |
+
"S3",
|
| 81 |
+
"S",
|
| 82 |
+
"stop_gradient",
|
| 83 |
+
RUNS_ROOT / "e4_alignment/e4a_s3_stop_gradient_seed0",
|
| 84 |
+
False,
|
| 85 |
+
),
|
| 86 |
+
RunSpec(
|
| 87 |
+
"S3",
|
| 88 |
+
"D",
|
| 89 |
+
"batch_derangement",
|
| 90 |
+
RUNS_ROOT / "e4_mechanism_followup/e4f_s3_batch_derangement_seed0",
|
| 91 |
+
False,
|
| 92 |
+
),
|
| 93 |
+
RunSpec(
|
| 94 |
+
"S3",
|
| 95 |
+
"DD",
|
| 96 |
+
"stop_gradient_batch_derangement",
|
| 97 |
+
RUNS_ROOT / "tpami_confirmatory_20260720/tpami_s3_dd_seed0",
|
| 98 |
+
True,
|
| 99 |
+
),
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
CONTRASTS = (
|
| 103 |
+
("B-S", {"B": 1.0, "S": -1.0}, "aligned gate-gradient contribution"),
|
| 104 |
+
("S-DD", {"S": 1.0, "DD": -1.0}, "same-sample forward coupling"),
|
| 105 |
+
("D-DD", {"D": 1.0, "DD": -1.0}, "gate-gradient rescue under mismatch"),
|
| 106 |
+
("D-B", {"D": 1.0, "B": -1.0}, "donor mismatch residual cost"),
|
| 107 |
+
("DD-B", {"DD": 1.0, "B": -1.0}, "joint mismatch and detach cost"),
|
| 108 |
+
(
|
| 109 |
+
"interaction",
|
| 110 |
+
{"D": 1.0, "DD": -1.0, "B": -1.0, "S": 1.0},
|
| 111 |
+
"context dependence of gate gradient",
|
| 112 |
+
),
|
| 113 |
+
)
|
| 114 |
+
METRICS = ("top1", "top5", "nll")
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def parse_args() -> argparse.Namespace:
|
| 118 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 119 |
+
parser.add_argument("--output-dir", type=Path, default=DEFAULT_OUTPUT)
|
| 120 |
+
parser.add_argument(
|
| 121 |
+
"--check",
|
| 122 |
+
action="store_true",
|
| 123 |
+
help="Require regenerated artifacts to match the existing output.",
|
| 124 |
+
)
|
| 125 |
+
return parser.parse_args()
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def read_json(path: Path) -> dict[str, Any]:
|
| 129 |
+
value = json.loads(path.read_text(encoding="utf-8"))
|
| 130 |
+
if not isinstance(value, dict):
|
| 131 |
+
raise TypeError(f"expected a JSON object: {path}")
|
| 132 |
+
return value
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def stable_json(value: Any) -> str:
|
| 136 |
+
return json.dumps(
|
| 137 |
+
value, indent=2, sort_keys=True, allow_nan=False, ensure_ascii=False
|
| 138 |
+
) + "\n"
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def render_csv(rows: list[dict[str, Any]]) -> str:
|
| 142 |
+
if not rows:
|
| 143 |
+
raise ValueError("refusing to render empty CSV")
|
| 144 |
+
fields: list[str] = []
|
| 145 |
+
for row in rows:
|
| 146 |
+
for field in row:
|
| 147 |
+
if field not in fields:
|
| 148 |
+
fields.append(field)
|
| 149 |
+
stream = StringIO(newline="")
|
| 150 |
+
writer = csv.DictWriter(stream, fieldnames=fields, lineterminator="\n")
|
| 151 |
+
writer.writeheader()
|
| 152 |
+
writer.writerows(rows)
|
| 153 |
+
return stream.getvalue()
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def sha256_file(path: Path) -> str:
|
| 157 |
+
digest = hashlib.sha256()
|
| 158 |
+
with path.open("rb") as handle:
|
| 159 |
+
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
| 160 |
+
digest.update(chunk)
|
| 161 |
+
return digest.hexdigest()
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def validate_run(spec: RunSpec) -> dict[str, Any]:
|
| 165 |
+
official = spec.path / "official_eval"
|
| 166 |
+
result = validate_official_eval(
|
| 167 |
+
official,
|
| 168 |
+
checkpoint_path=spec.path / "checkpoint_last.pt",
|
| 169 |
+
require_check_certificate=True,
|
| 170 |
+
)
|
| 171 |
+
completion = result["training_completion"]
|
| 172 |
+
problems: list[str] = []
|
| 173 |
+
if result.get("status") != "complete" or result.get("partial_evaluation") is not False:
|
| 174 |
+
problems.append("official evaluation is incomplete")
|
| 175 |
+
if result.get("seed") != 0:
|
| 176 |
+
problems.append("training seed is not zero")
|
| 177 |
+
if result.get("checkpoint_epoch") != 299 or result.get("training_epochs") != 300:
|
| 178 |
+
problems.append("checkpoint is not fixed-last epoch 299/300")
|
| 179 |
+
if result["metrics"].get("samples") != 50_000:
|
| 180 |
+
problems.append("official evaluation is not the full 50,000-image validation set")
|
| 181 |
+
if completion.get("training_complete") is not True:
|
| 182 |
+
problems.append("training is not complete")
|
| 183 |
+
if completion.get("global_step") != 187_500:
|
| 184 |
+
problems.append("global step is not 187,500")
|
| 185 |
+
if completion.get("world_size") != 8:
|
| 186 |
+
problems.append("training world size is not eight")
|
| 187 |
+
checks = read_json(official / "checks.json")
|
| 188 |
+
if checks.get("status") != "passed":
|
| 189 |
+
problems.append("official certificate did not pass")
|
| 190 |
+
if problems:
|
| 191 |
+
raise RuntimeError(f"{spec.scale}/{spec.arm}: {'; '.join(problems)}")
|
| 192 |
+
return {
|
| 193 |
+
"result": result,
|
| 194 |
+
"checks": checks,
|
| 195 |
+
"config": read_json(official / "config.json"),
|
| 196 |
+
"diagnostics": read_json(official / "gate_diagnostics.json"),
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
def validate_pairing(validated: dict[tuple[str, str], dict[str, Any]]) -> None:
|
| 201 |
+
for scale in ("S1", "S3"):
|
| 202 |
+
d = validated[(scale, "D")]["result"]
|
| 203 |
+
dd = validated[(scale, "DD")]["result"]
|
| 204 |
+
d_gate = d["gate_intervention"]
|
| 205 |
+
dd_gate = dd["gate_intervention"]
|
| 206 |
+
manifest = d_gate["batch_derangement_manifest_sha256"]
|
| 207 |
+
if not manifest or manifest != dd_gate["batch_derangement_manifest_sha256"]:
|
| 208 |
+
raise RuntimeError(f"{scale}: D/DD donor manifests do not match")
|
| 209 |
+
if d["topology"] != dd["topology"]:
|
| 210 |
+
raise RuntimeError(f"{scale}: D/DD topology does not match")
|
| 211 |
+
if d_gate["components"] != {
|
| 212 |
+
"batch_derangement": True,
|
| 213 |
+
"channel_derangement": False,
|
| 214 |
+
"stops_gate_gradient": False,
|
| 215 |
+
}:
|
| 216 |
+
raise RuntimeError(f"{scale}: D intervention components are unexpected")
|
| 217 |
+
if dd_gate["components"] != {
|
| 218 |
+
"batch_derangement": True,
|
| 219 |
+
"channel_derangement": False,
|
| 220 |
+
"stops_gate_gradient": True,
|
| 221 |
+
}:
|
| 222 |
+
raise RuntimeError(f"{scale}: DD intervention components are unexpected")
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
def metric_rows(
|
| 226 |
+
validated: dict[tuple[str, str], dict[str, Any]]
|
| 227 |
+
) -> list[dict[str, Any]]:
|
| 228 |
+
rows: list[dict[str, Any]] = []
|
| 229 |
+
for spec in RUN_SPECS:
|
| 230 |
+
result = validated[(spec.scale, spec.arm)]["result"]
|
| 231 |
+
metrics = result["metrics"]
|
| 232 |
+
rows.append(
|
| 233 |
+
{
|
| 234 |
+
"scale": spec.scale,
|
| 235 |
+
"arm": spec.arm,
|
| 236 |
+
"label": spec.label,
|
| 237 |
+
"new_run": spec.new_run,
|
| 238 |
+
"top1": metrics["top1"],
|
| 239 |
+
"top5": metrics["top5"],
|
| 240 |
+
"nll": metrics["nll"],
|
| 241 |
+
"ece": metrics["ece"],
|
| 242 |
+
"samples": metrics["samples"],
|
| 243 |
+
"checkpoint_epoch": result["checkpoint_epoch"],
|
| 244 |
+
"global_step": result["training_completion"]["global_step"],
|
| 245 |
+
"certificate_status": validated[(spec.scale, spec.arm)]["checks"]["status"],
|
| 246 |
+
"run_path": str(spec.path),
|
| 247 |
+
}
|
| 248 |
+
)
|
| 249 |
+
return rows
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def diagnostic_rows(
|
| 253 |
+
validated: dict[tuple[str, str], dict[str, Any]]
|
| 254 |
+
) -> list[dict[str, Any]]:
|
| 255 |
+
rows: list[dict[str, Any]] = []
|
| 256 |
+
for spec in RUN_SPECS:
|
| 257 |
+
blocks = validated[(spec.scale, spec.arm)]["diagnostics"]["blocks"]
|
| 258 |
+
total = sum(int(block["element_count"]) for block in blocks)
|
| 259 |
+
coherence = [
|
| 260 |
+
float(block["gate_intervention"]["coherence"]["pearson"])
|
| 261 |
+
for block in blocks
|
| 262 |
+
]
|
| 263 |
+
rows.append(
|
| 264 |
+
{
|
| 265 |
+
"scale": spec.scale,
|
| 266 |
+
"arm": spec.arm,
|
| 267 |
+
"blocks": len(blocks),
|
| 268 |
+
"coherence_block_equal_mean": float(np.mean(coherence)),
|
| 269 |
+
"negative_element_fraction": sum(
|
| 270 |
+
int(block["negative_count"]) for block in blocks
|
| 271 |
+
)
|
| 272 |
+
/ total,
|
| 273 |
+
"active_0_to_6_element_fraction": sum(
|
| 274 |
+
int(block["active_0_to_6_count"]) for block in blocks
|
| 275 |
+
)
|
| 276 |
+
/ total,
|
| 277 |
+
"actual_clip_crossing_element_fraction": sum(
|
| 278 |
+
int(block["actual_clip_crossing_count"]) for block in blocks
|
| 279 |
+
)
|
| 280 |
+
/ total,
|
| 281 |
+
}
|
| 282 |
+
)
|
| 283 |
+
return rows
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
def load_series(spec: RunSpec) -> dict[str, np.ndarray]:
|
| 287 |
+
payload = np.load(spec.path / "official_eval/per_sample.npz")
|
| 288 |
+
return {
|
| 289 |
+
"sample_index": payload["sample_index"],
|
| 290 |
+
"target": payload["target"],
|
| 291 |
+
"top1": payload["correct"].astype(np.float64),
|
| 292 |
+
"top5": payload["top5_correct"].astype(np.float64),
|
| 293 |
+
"nll": payload["nll"].astype(np.float64),
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
def bootstrap_rows() -> list[dict[str, Any]]:
|
| 298 |
+
rows: list[dict[str, Any]] = []
|
| 299 |
+
for scale in ("S1", "S3"):
|
| 300 |
+
series = {
|
| 301 |
+
spec.arm: load_series(spec) for spec in RUN_SPECS if spec.scale == scale
|
| 302 |
+
}
|
| 303 |
+
reference = series["B"]
|
| 304 |
+
for arm, payload in series.items():
|
| 305 |
+
if not np.array_equal(payload["sample_index"], reference["sample_index"]):
|
| 306 |
+
raise RuntimeError(f"{scale}/{arm}: sample indices do not match")
|
| 307 |
+
if not np.array_equal(payload["target"], reference["target"]):
|
| 308 |
+
raise RuntimeError(f"{scale}/{arm}: targets do not match")
|
| 309 |
+
|
| 310 |
+
keys = [(arm, metric) for arm in ("B", "S", "D", "DD") for metric in METRICS]
|
| 311 |
+
values = np.stack([series[arm][metric] for arm, metric in keys], axis=1)
|
| 312 |
+
bootstrap = np.zeros((BOOTSTRAP_REPLICATES, len(keys)), dtype=np.float64)
|
| 313 |
+
rng = np.random.default_rng(BOOTSTRAP_SEED)
|
| 314 |
+
probability = np.full(50, 1.0 / 50.0, dtype=np.float64)
|
| 315 |
+
target = reference["target"]
|
| 316 |
+
for class_id in range(1000):
|
| 317 |
+
indices = np.flatnonzero(target == class_id)
|
| 318 |
+
if indices.size != 50:
|
| 319 |
+
raise RuntimeError(f"{scale}: class {class_id} does not have 50 images")
|
| 320 |
+
counts = rng.multinomial(
|
| 321 |
+
50, probability, size=BOOTSTRAP_REPLICATES
|
| 322 |
+
).astype(np.float64, copy=False)
|
| 323 |
+
bootstrap += counts @ values[indices]
|
| 324 |
+
bootstrap /= 50_000
|
| 325 |
+
column = {key: index for index, key in enumerate(keys)}
|
| 326 |
+
|
| 327 |
+
for contrast_id, coefficients, interpretation in CONTRASTS:
|
| 328 |
+
for metric in METRICS:
|
| 329 |
+
multiplier = 100.0 if metric in {"top1", "top5"} else 1.0
|
| 330 |
+
samples = multiplier * sum(
|
| 331 |
+
coefficient * bootstrap[:, column[(arm, metric)]]
|
| 332 |
+
for arm, coefficient in coefficients.items()
|
| 333 |
+
)
|
| 334 |
+
point = multiplier * sum(
|
| 335 |
+
coefficient * float(series[arm][metric].mean())
|
| 336 |
+
for arm, coefficient in coefficients.items()
|
| 337 |
+
)
|
| 338 |
+
low, high = np.percentile(samples, (2.5, 97.5))
|
| 339 |
+
rows.append(
|
| 340 |
+
{
|
| 341 |
+
"scale": scale,
|
| 342 |
+
"contrast": contrast_id,
|
| 343 |
+
"interpretation": interpretation,
|
| 344 |
+
"metric": metric,
|
| 345 |
+
"unit": "percentage_points"
|
| 346 |
+
if metric in {"top1", "top5"}
|
| 347 |
+
else "nats_per_image",
|
| 348 |
+
"point_difference": point,
|
| 349 |
+
"bootstrap_ci95_low": float(low),
|
| 350 |
+
"bootstrap_ci95_high": float(high),
|
| 351 |
+
"bootstrap_replicates": BOOTSTRAP_REPLICATES,
|
| 352 |
+
"bootstrap_seed": BOOTSTRAP_SEED,
|
| 353 |
+
"independent_unit": "validation_image",
|
| 354 |
+
}
|
| 355 |
+
)
|
| 356 |
+
return rows
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def source_hashes() -> str:
|
| 360 |
+
lines: list[str] = []
|
| 361 |
+
for spec in RUN_SPECS:
|
| 362 |
+
for name in (
|
| 363 |
+
"results.json",
|
| 364 |
+
"checks.json",
|
| 365 |
+
"config.json",
|
| 366 |
+
"gate_diagnostics.json",
|
| 367 |
+
"per_sample.npz",
|
| 368 |
+
):
|
| 369 |
+
path = spec.path / "official_eval" / name
|
| 370 |
+
lines.append(f"{sha256_file(path)} {path}")
|
| 371 |
+
return "\n".join(lines) + "\n"
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
def report_text(
|
| 375 |
+
metrics: list[dict[str, Any]],
|
| 376 |
+
contrasts: list[dict[str, Any]],
|
| 377 |
+
diagnostics: list[dict[str, Any]],
|
| 378 |
+
) -> str:
|
| 379 |
+
metric = {(row["scale"], row["arm"]): row for row in metrics}
|
| 380 |
+
contrast = {
|
| 381 |
+
(row["scale"], row["contrast"], row["metric"]): row for row in contrasts
|
| 382 |
+
}
|
| 383 |
+
diagnostic = {(row["scale"], row["arm"]): row for row in diagnostics}
|
| 384 |
+
|
| 385 |
+
lines = [
|
| 386 |
+
"# TPAMI seed-0 confirmatory ImageNet analysis",
|
| 387 |
+
"",
|
| 388 |
+
"Generated from fixed-last, full-ImageNet official evaluations with passed certificates.",
|
| 389 |
+
"",
|
| 390 |
+
"## Official metrics",
|
| 391 |
+
"",
|
| 392 |
+
"| Scale | Arm | Top-1 | Top-5 | NLL | ECE |",
|
| 393 |
+
"|---|---:|---:|---:|---:|---:|",
|
| 394 |
+
]
|
| 395 |
+
for scale in ("S1", "S3"):
|
| 396 |
+
for arm in ("B", "S", "D", "DD"):
|
| 397 |
+
row = metric[(scale, arm)]
|
| 398 |
+
lines.append(
|
| 399 |
+
f"| {scale} | {arm} | {row['top1']:.3f} | {row['top5']:.3f} | "
|
| 400 |
+
f"{row['nll']:.4f} | {row['ece']:.3f} |"
|
| 401 |
+
)
|
| 402 |
+
lines.extend(
|
| 403 |
+
[
|
| 404 |
+
"",
|
| 405 |
+
"## Registered Top-1 contrasts",
|
| 406 |
+
"",
|
| 407 |
+
"| Scale | B-S | S-DD | D-DD | D-B | Interaction |",
|
| 408 |
+
"|---|---:|---:|---:|---:|---:|",
|
| 409 |
+
]
|
| 410 |
+
)
|
| 411 |
+
for scale in ("S1", "S3"):
|
| 412 |
+
cells = []
|
| 413 |
+
for name in ("B-S", "S-DD", "D-DD", "D-B", "interaction"):
|
| 414 |
+
row = contrast[(scale, name, "top1")]
|
| 415 |
+
cells.append(
|
| 416 |
+
f"{row['point_difference']:+.3f} "
|
| 417 |
+
f"[{row['bootstrap_ci95_low']:+.3f}, {row['bootstrap_ci95_high']:+.3f}]"
|
| 418 |
+
)
|
| 419 |
+
lines.append(f"| {scale} | " + " | ".join(cells) + " |")
|
| 420 |
+
lines.extend(
|
| 421 |
+
[
|
| 422 |
+
"",
|
| 423 |
+
"Intervals are class-stratified paired bootstrap intervals over validation images. "
|
| 424 |
+
"They do not estimate training-seed uncertainty.",
|
| 425 |
+
"",
|
| 426 |
+
"## Gate diagnostics",
|
| 427 |
+
"",
|
| 428 |
+
"| Scale | Arm | Coherence | Negative % | Active % | Clip-crossing % |",
|
| 429 |
+
"|---|---:|---:|---:|---:|---:|",
|
| 430 |
+
]
|
| 431 |
+
)
|
| 432 |
+
for scale in ("S1", "S3"):
|
| 433 |
+
for arm in ("B", "S", "D", "DD"):
|
| 434 |
+
row = diagnostic[(scale, arm)]
|
| 435 |
+
lines.append(
|
| 436 |
+
f"| {scale} | {arm} | {row['coherence_block_equal_mean']:.4f} | "
|
| 437 |
+
f"{100 * row['negative_element_fraction']:.3f} | "
|
| 438 |
+
f"{100 * row['active_0_to_6_element_fraction']:.3f} | "
|
| 439 |
+
f"{100 * row['actual_clip_crossing_element_fraction']:.4f} |"
|
| 440 |
+
)
|
| 441 |
+
lines.extend(
|
| 442 |
+
[
|
| 443 |
+
"",
|
| 444 |
+
"## Interpretation",
|
| 445 |
+
"",
|
| 446 |
+
"1. S-DD is the cleanest available forward-coupling contrast: both detach the gate "
|
| 447 |
+
"branch, while only DD replaces the same-sample gate with a local-batch donor.",
|
| 448 |
+
"2. D-DD holds the donor intervention and topology fixed and changes the gate-gradient "
|
| 449 |
+
"path. Its large positive effect shows that optimization adapts substantially around "
|
| 450 |
+
"a mismatched forward gate.",
|
| 451 |
+
"3. B-S is positive but much smaller. The large positive interaction therefore shows "
|
| 452 |
+
"that gate-gradient value is context dependent, not an additive constant.",
|
| 453 |
+
"4. D remains far below B, so gradient adaptation only partially compensates for loss "
|
| 454 |
+
"of same-sample conditioning.",
|
| 455 |
+
"5. DD has ordinary-looking marginal gate-region fractions but collapses in accuracy; "
|
| 456 |
+
"marginal clipping/activation occupancy alone cannot explain the task value.",
|
| 457 |
+
"",
|
| 458 |
+
"## Claim boundary",
|
| 459 |
+
"",
|
| 460 |
+
"The panel supports a joint mechanism claim: GmNet's benefit depends primarily on "
|
| 461 |
+
"same-sample carrier-gate coupling, while the gate-gradient path supplies a smaller "
|
| 462 |
+
"aligned benefit and a much larger adaptive rescue under mismatch. It does not yet "
|
| 463 |
+
"support population-level training-seed significance, arbitrary globally independent "
|
| 464 |
+
"donors, or a causal spectral-mediation claim.",
|
| 465 |
+
"",
|
| 466 |
+
"## Remaining work",
|
| 467 |
+
"",
|
| 468 |
+
"- Run the registered DD order probes and matched B/S/D/DD spectral audit.",
|
| 469 |
+
"- Run additional training seeds only when population-level uncertainty is required.",
|
| 470 |
+
"- Treat ECE for collapsed DD models as non-comparable rather than improved calibration.",
|
| 471 |
+
"",
|
| 472 |
+
]
|
| 473 |
+
)
|
| 474 |
+
return "\n".join(lines)
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
def write_or_check(output_dir: Path, files: dict[str, str], check: bool) -> None:
|
| 478 |
+
if check:
|
| 479 |
+
for name, expected in files.items():
|
| 480 |
+
path = output_dir / name
|
| 481 |
+
if not path.is_file() or path.read_text(encoding="utf-8") != expected:
|
| 482 |
+
raise RuntimeError(f"artifact differs or is missing: {path}")
|
| 483 |
+
return
|
| 484 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 485 |
+
for name, content in files.items():
|
| 486 |
+
(output_dir / name).write_text(content, encoding="utf-8")
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
def main() -> None:
|
| 490 |
+
args = parse_args()
|
| 491 |
+
validated = {
|
| 492 |
+
(spec.scale, spec.arm): validate_run(spec) for spec in RUN_SPECS
|
| 493 |
+
}
|
| 494 |
+
validate_pairing(validated)
|
| 495 |
+
metrics = metric_rows(validated)
|
| 496 |
+
diagnostics = diagnostic_rows(validated)
|
| 497 |
+
contrasts = bootstrap_rows()
|
| 498 |
+
payload = {
|
| 499 |
+
"schema_version": 1,
|
| 500 |
+
"training_seed": 0,
|
| 501 |
+
"bootstrap": {
|
| 502 |
+
"replicates": BOOTSTRAP_REPLICATES,
|
| 503 |
+
"seed": BOOTSTRAP_SEED,
|
| 504 |
+
"scheme": "shared 50-draw resample within each of 1000 ImageNet classes",
|
| 505 |
+
"independent_unit": "validation_image",
|
| 506 |
+
},
|
| 507 |
+
"official_metrics": metrics,
|
| 508 |
+
"contrasts": contrasts,
|
| 509 |
+
"gate_diagnostics": diagnostics,
|
| 510 |
+
}
|
| 511 |
+
files = {
|
| 512 |
+
"REPORT.md": report_text(metrics, contrasts, diagnostics),
|
| 513 |
+
"official_metrics.csv": render_csv(metrics),
|
| 514 |
+
"registered_contrasts.csv": render_csv(contrasts),
|
| 515 |
+
"gate_diagnostics.csv": render_csv(diagnostics),
|
| 516 |
+
"results.json": stable_json(payload),
|
| 517 |
+
"source_artifacts.sha256": source_hashes(),
|
| 518 |
+
}
|
| 519 |
+
write_or_check(args.output_dir, files, args.check)
|
| 520 |
+
action = "verified" if args.check else "wrote"
|
| 521 |
+
print(
|
| 522 |
+
f"validated {len(RUN_SPECS)} runs and {action} {len(files)} artifacts "
|
| 523 |
+
f"in {args.output_dir}"
|
| 524 |
+
)
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
if __name__ == "__main__":
|
| 528 |
+
main()
|
gmnet/project/gmnet_tpami/scripts/upload_gmnet_backup.py
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Prepare, upload, and verify the curated GmNet journal backup."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import csv
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
from datetime import datetime, timezone
|
| 10 |
+
import hashlib
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
import shutil
|
| 15 |
+
from typing import Iterable
|
| 16 |
+
|
| 17 |
+
from huggingface_hub import HfApi, hf_hub_download
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
REPO_ID = "YFanwang/Backup"
|
| 21 |
+
REPO_TYPE = "dataset"
|
| 22 |
+
TOKEN_PATH = Path("/nfs/ywang29/hf_token.txt")
|
| 23 |
+
STAGING_ROOT = Path("/nfs/ywang29/GmNet/.backup_upload_gmnet_20260721")
|
| 24 |
+
UPLOAD_ROOT = STAGING_ROOT / "gmnet"
|
| 25 |
+
LATEST_SPECTRAL_RESULT = "matched_5arm_seed0_20260718.partial.715"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@dataclass(frozen=True)
|
| 29 |
+
class SourceSpec:
|
| 30 |
+
source: Path
|
| 31 |
+
destination: Path
|
| 32 |
+
category: str
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
SOURCE_SPECS = (
|
| 36 |
+
SourceSpec(Path("/root/gmnet_tpami"), Path("project/gmnet_tpami"), "project"),
|
| 37 |
+
SourceSpec(
|
| 38 |
+
Path("/nfs/ywang29/GmNet/journal_exp"),
|
| 39 |
+
Path("code/journal_exp"),
|
| 40 |
+
"frozen_code",
|
| 41 |
+
),
|
| 42 |
+
SourceSpec(
|
| 43 |
+
Path("/nfs/ywang29/GmNet/tpami_confirmatory_20260720"),
|
| 44 |
+
Path("code/tpami_confirmatory_20260720"),
|
| 45 |
+
"confirmatory_code",
|
| 46 |
+
),
|
| 47 |
+
SourceSpec(
|
| 48 |
+
Path("/nfs/ywang29/GmNet/release"), Path("code/original_release"), "release_code"
|
| 49 |
+
),
|
| 50 |
+
SourceSpec(
|
| 51 |
+
Path("/nfs/ywang29/GmNet/depoly"), Path("deploy"), "deployment"
|
| 52 |
+
),
|
| 53 |
+
SourceSpec(
|
| 54 |
+
Path("/nfs/ywang29/GmNet/local_results"),
|
| 55 |
+
Path("conclusions/local_results"),
|
| 56 |
+
"conclusions",
|
| 57 |
+
),
|
| 58 |
+
SourceSpec(Path("/nfs/ywang29/GmNet/runs"), Path("runs"), "runs"),
|
| 59 |
+
SourceSpec(
|
| 60 |
+
Path("/nfs/ywang29/GmNet/e4_spectral_audit"),
|
| 61 |
+
Path("spectral_audit"),
|
| 62 |
+
"spectral_audit",
|
| 63 |
+
),
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
LEGACY_ASSETS = (
|
| 67 |
+
"Effnet-main3.zip",
|
| 68 |
+
"acc_latency3.pdf",
|
| 69 |
+
"acc_latency3.png",
|
| 70 |
+
"extract_freq.py",
|
| 71 |
+
"frequency_band_0-10.png",
|
| 72 |
+
"frequency_band_0-15.png",
|
| 73 |
+
"frequency_band_0-20.png",
|
| 74 |
+
"frequency_band_10-20.png",
|
| 75 |
+
"frequency_band_15-30.png",
|
| 76 |
+
"frequency_band_15-50.png",
|
| 77 |
+
"frequency_band_20-50.png",
|
| 78 |
+
"frequency_band_20-50000.png",
|
| 79 |
+
"frequency_band_20-50000000.png",
|
| 80 |
+
"frequency_band_20-60.png",
|
| 81 |
+
"frequency_band_30-50.png",
|
| 82 |
+
"frequency_band_50-10000000.png",
|
| 83 |
+
"frequency_band_60-10000000.png",
|
| 84 |
+
"gmnet_s3.npy",
|
| 85 |
+
"gradcam_overlay.jpg",
|
| 86 |
+
"heat_map.py",
|
| 87 |
+
"high_frequency_image.png",
|
| 88 |
+
"low_frequency_image.png",
|
| 89 |
+
"plot.py",
|
| 90 |
+
"times.ttf",
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
SKIP_DIRECTORY_NAMES = {
|
| 94 |
+
".cache",
|
| 95 |
+
".git",
|
| 96 |
+
".pytest_cache",
|
| 97 |
+
"__pycache__",
|
| 98 |
+
"wandb",
|
| 99 |
+
}
|
| 100 |
+
SKIP_SUFFIXES = {".pyc", ".pyo"}
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def parse_args() -> argparse.Namespace:
|
| 104 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 105 |
+
parser.add_argument("action", choices=("prepare", "upload", "verify"))
|
| 106 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 107 |
+
return parser.parse_args()
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def read_token() -> str:
|
| 111 |
+
token = TOKEN_PATH.read_text(encoding="utf-8").strip()
|
| 112 |
+
if not token:
|
| 113 |
+
raise RuntimeError(f"empty Hugging Face token: {TOKEN_PATH}")
|
| 114 |
+
return token
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def should_include(spec: SourceSpec, relative: Path) -> bool:
|
| 118 |
+
if any(part in SKIP_DIRECTORY_NAMES for part in relative.parts):
|
| 119 |
+
return False
|
| 120 |
+
if relative.suffix in SKIP_SUFFIXES or relative.name.endswith(".lock"):
|
| 121 |
+
return False
|
| 122 |
+
if spec.category == "spectral_audit" and relative.parts:
|
| 123 |
+
if relative.parts[0] == "results":
|
| 124 |
+
return len(relative.parts) > 1 and relative.parts[1] == LATEST_SPECTRAL_RESULT
|
| 125 |
+
return True
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def iter_source_files(spec: SourceSpec) -> Iterable[tuple[Path, Path]]:
|
| 129 |
+
if not spec.source.is_dir():
|
| 130 |
+
raise FileNotFoundError(spec.source)
|
| 131 |
+
for root, directories, filenames in os.walk(spec.source, followlinks=False):
|
| 132 |
+
directories[:] = sorted(
|
| 133 |
+
name
|
| 134 |
+
for name in directories
|
| 135 |
+
if name not in SKIP_DIRECTORY_NAMES
|
| 136 |
+
and not (Path(root) / name).is_symlink()
|
| 137 |
+
)
|
| 138 |
+
for filename in sorted(filenames):
|
| 139 |
+
source = Path(root) / filename
|
| 140 |
+
if source.is_symlink() or not source.is_file():
|
| 141 |
+
continue
|
| 142 |
+
relative = source.relative_to(spec.source)
|
| 143 |
+
if should_include(spec, relative):
|
| 144 |
+
yield source, spec.destination / relative
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def iter_all_sources() -> Iterable[tuple[Path, Path, str]]:
|
| 148 |
+
seen: set[Path] = set()
|
| 149 |
+
for spec in SOURCE_SPECS:
|
| 150 |
+
for source, destination in iter_source_files(spec):
|
| 151 |
+
if destination in seen:
|
| 152 |
+
raise RuntimeError(f"duplicate backup destination: {destination}")
|
| 153 |
+
seen.add(destination)
|
| 154 |
+
yield source, destination, spec.category
|
| 155 |
+
legacy_root = Path("/nfs/ywang29/GmNet")
|
| 156 |
+
for name in LEGACY_ASSETS:
|
| 157 |
+
source = legacy_root / name
|
| 158 |
+
if not source.is_file():
|
| 159 |
+
raise FileNotFoundError(source)
|
| 160 |
+
destination = Path("legacy_assets") / name
|
| 161 |
+
if destination in seen:
|
| 162 |
+
raise RuntimeError(f"duplicate backup destination: {destination}")
|
| 163 |
+
seen.add(destination)
|
| 164 |
+
yield source, destination, "legacy_asset"
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def hash_and_scan(path: Path, token: bytes) -> tuple[str, int]:
|
| 168 |
+
digest = hashlib.sha256()
|
| 169 |
+
size = 0
|
| 170 |
+
overlap = b""
|
| 171 |
+
with path.open("rb") as handle:
|
| 172 |
+
for chunk in iter(lambda: handle.read(8 * 1024 * 1024), b""):
|
| 173 |
+
size += len(chunk)
|
| 174 |
+
digest.update(chunk)
|
| 175 |
+
if token in overlap + chunk:
|
| 176 |
+
raise RuntimeError(f"credential token found in selected source: {path}")
|
| 177 |
+
overlap = chunk[-max(0, len(token) - 1) :]
|
| 178 |
+
return digest.hexdigest(), size
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def link_or_copy(source: Path, destination: Path) -> None:
|
| 182 |
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
| 183 |
+
try:
|
| 184 |
+
os.link(source, destination)
|
| 185 |
+
except OSError:
|
| 186 |
+
shutil.copy2(source, destination)
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
def write_metadata(rows: list[dict[str, object]]) -> None:
|
| 190 |
+
fieldnames = ("path", "size_bytes", "sha256", "category", "source")
|
| 191 |
+
with (UPLOAD_ROOT / "MANIFEST.csv").open("w", encoding="utf-8", newline="") as handle:
|
| 192 |
+
writer = csv.DictWriter(handle, fieldnames=fieldnames, lineterminator="\n")
|
| 193 |
+
writer.writeheader()
|
| 194 |
+
writer.writerows(rows)
|
| 195 |
+
payload = {
|
| 196 |
+
"schema_version": 1,
|
| 197 |
+
"created_at_utc": datetime.now(timezone.utc).isoformat(),
|
| 198 |
+
"repo_id": REPO_ID,
|
| 199 |
+
"repo_type": REPO_TYPE,
|
| 200 |
+
"path_in_repo": "gmnet",
|
| 201 |
+
"file_count": len(rows),
|
| 202 |
+
"total_size_bytes": sum(int(row["size_bytes"]) for row in rows),
|
| 203 |
+
"checkpoint_count": sum(
|
| 204 |
+
1 for row in rows if str(row["path"]).endswith("/checkpoint_last.pt")
|
| 205 |
+
),
|
| 206 |
+
"files": rows,
|
| 207 |
+
"exclusions": [
|
| 208 |
+
"ImageNet/CIFAR datasets and sample images",
|
| 209 |
+
"W&B raw cache and symlinks",
|
| 210 |
+
"Python/Git/test caches and lock files",
|
| 211 |
+
"opaque legacy archive.tar.gz",
|
| 212 |
+
"spectral partial snapshots 702, 712, and 714; snapshot 715 is retained",
|
| 213 |
+
],
|
| 214 |
+
}
|
| 215 |
+
(UPLOAD_ROOT / "MANIFEST.json").write_text(
|
| 216 |
+
json.dumps(payload, indent=2, ensure_ascii=False, allow_nan=False) + "\n",
|
| 217 |
+
encoding="utf-8",
|
| 218 |
+
)
|
| 219 |
+
checksum_lines = [f"{row['sha256']} {row['path']}" for row in rows]
|
| 220 |
+
(UPLOAD_ROOT / "FILES.sha256").write_text(
|
| 221 |
+
"\n".join(checksum_lines) + "\n", encoding="utf-8"
|
| 222 |
+
)
|
| 223 |
+
readme = f"""# GmNet journal backup
|
| 224 |
+
|
| 225 |
+
This directory is a curated backup of the GmNet TPAMI extension as of
|
| 226 |
+
2026-07-21 UTC. It contains:
|
| 227 |
+
|
| 228 |
+
- journal plans, protocols, analysis scripts, and the paper source/reference;
|
| 229 |
+
- frozen training/evaluation code and the confirmatory code snapshot;
|
| 230 |
+
- all prepared deployment YAML and shell launch files;
|
| 231 |
+
- all local experiment conclusions and machine-readable summaries;
|
| 232 |
+
- all 21 completed ImageNet run checkpoints, configs, logs, and certified
|
| 233 |
+
fixed-last official evaluations;
|
| 234 |
+
- the latest matched five-arm spectral audit snapshot and its implementation;
|
| 235 |
+
- selected legacy analysis assets.
|
| 236 |
+
|
| 237 |
+
The payload contains {len(rows):,} source files totaling
|
| 238 |
+
{sum(int(row['size_bytes']) for row in rows):,} bytes before repository-side
|
| 239 |
+
storage. `MANIFEST.csv`, `MANIFEST.json`, and `FILES.sha256` record every source
|
| 240 |
+
path, size, and SHA256 digest.
|
| 241 |
+
|
| 242 |
+
Excluded content consists of datasets, W&B raw cache, transient caches/locks,
|
| 243 |
+
the opaque legacy archive, and three redundant spectral partial snapshots.
|
| 244 |
+
No Hugging Face token is stored in this directory.
|
| 245 |
+
"""
|
| 246 |
+
(UPLOAD_ROOT / "README.md").write_text(readme, encoding="utf-8")
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
def prepare() -> None:
|
| 250 |
+
if STAGING_ROOT.exists():
|
| 251 |
+
raise RuntimeError(
|
| 252 |
+
f"staging directory already exists; remove only after inspection: {STAGING_ROOT}"
|
| 253 |
+
)
|
| 254 |
+
UPLOAD_ROOT.mkdir(parents=True)
|
| 255 |
+
token = read_token().encode("utf-8")
|
| 256 |
+
rows: list[dict[str, object]] = []
|
| 257 |
+
for index, (source, destination, category) in enumerate(iter_all_sources(), start=1):
|
| 258 |
+
digest, size = hash_and_scan(source, token)
|
| 259 |
+
link_or_copy(source, UPLOAD_ROOT / destination)
|
| 260 |
+
rows.append(
|
| 261 |
+
{
|
| 262 |
+
"path": destination.as_posix(),
|
| 263 |
+
"size_bytes": size,
|
| 264 |
+
"sha256": digest,
|
| 265 |
+
"category": category,
|
| 266 |
+
"source": str(source),
|
| 267 |
+
}
|
| 268 |
+
)
|
| 269 |
+
if index % 100 == 0:
|
| 270 |
+
print(f"prepared {index} files", flush=True)
|
| 271 |
+
rows.sort(key=lambda row: str(row["path"]))
|
| 272 |
+
checkpoint_count = sum(
|
| 273 |
+
1 for row in rows if str(row["path"]).endswith("/checkpoint_last.pt")
|
| 274 |
+
)
|
| 275 |
+
if checkpoint_count != 21:
|
| 276 |
+
raise RuntimeError(f"expected 21 checkpoints, found {checkpoint_count}")
|
| 277 |
+
write_metadata(rows)
|
| 278 |
+
print(
|
| 279 |
+
f"prepared {len(rows)} files, {checkpoint_count} checkpoints, "
|
| 280 |
+
f"{sum(int(row['size_bytes']) for row in rows)} bytes in {UPLOAD_ROOT}"
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def upload(workers: int) -> None:
|
| 285 |
+
if not (UPLOAD_ROOT / "MANIFEST.json").is_file():
|
| 286 |
+
raise RuntimeError("run the prepare action first")
|
| 287 |
+
api = HfApi(token=read_token())
|
| 288 |
+
info = api.repo_info(REPO_ID, repo_type=REPO_TYPE)
|
| 289 |
+
if info.id != REPO_ID:
|
| 290 |
+
raise RuntimeError(f"unexpected repository identity: {info.id}")
|
| 291 |
+
api.upload_large_folder(
|
| 292 |
+
repo_id=REPO_ID,
|
| 293 |
+
repo_type=REPO_TYPE,
|
| 294 |
+
folder_path=STAGING_ROOT,
|
| 295 |
+
num_workers=workers,
|
| 296 |
+
print_report=True,
|
| 297 |
+
print_report_every=60,
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def verify() -> None:
|
| 302 |
+
local = json.loads((UPLOAD_ROOT / "MANIFEST.json").read_text(encoding="utf-8"))
|
| 303 |
+
expected = {"gmnet/" + row["path"]: row for row in local["files"]}
|
| 304 |
+
expected.update(
|
| 305 |
+
{
|
| 306 |
+
"gmnet/README.md": None,
|
| 307 |
+
"gmnet/MANIFEST.csv": None,
|
| 308 |
+
"gmnet/MANIFEST.json": None,
|
| 309 |
+
"gmnet/FILES.sha256": None,
|
| 310 |
+
}
|
| 311 |
+
)
|
| 312 |
+
api = HfApi(token=read_token())
|
| 313 |
+
remote_items = api.list_repo_tree(
|
| 314 |
+
REPO_ID,
|
| 315 |
+
path_in_repo="gmnet",
|
| 316 |
+
recursive=True,
|
| 317 |
+
expand=True,
|
| 318 |
+
repo_type=REPO_TYPE,
|
| 319 |
+
)
|
| 320 |
+
remote = {item.path: item for item in remote_items if hasattr(item, "size")}
|
| 321 |
+
missing = sorted(set(expected) - set(remote))
|
| 322 |
+
if missing:
|
| 323 |
+
raise RuntimeError(f"remote backup is missing {len(missing)} files: {missing[:10]}")
|
| 324 |
+
size_errors = []
|
| 325 |
+
for path, row in expected.items():
|
| 326 |
+
if row is not None and int(remote[path].size) != int(row["size_bytes"]):
|
| 327 |
+
size_errors.append((path, row["size_bytes"], remote[path].size))
|
| 328 |
+
if size_errors:
|
| 329 |
+
raise RuntimeError(f"remote file size mismatch: {size_errors[:10]}")
|
| 330 |
+
|
| 331 |
+
remote_manifest = Path(
|
| 332 |
+
hf_hub_download(
|
| 333 |
+
REPO_ID,
|
| 334 |
+
"gmnet/MANIFEST.json",
|
| 335 |
+
repo_type=REPO_TYPE,
|
| 336 |
+
token=read_token(),
|
| 337 |
+
force_download=True,
|
| 338 |
+
)
|
| 339 |
+
)
|
| 340 |
+
if sha256_file(remote_manifest) != sha256_file(UPLOAD_ROOT / "MANIFEST.json"):
|
| 341 |
+
raise RuntimeError("downloaded remote manifest does not match the local manifest")
|
| 342 |
+
print(
|
| 343 |
+
f"verified {len(expected)} remote files, {local['checkpoint_count']} checkpoints, "
|
| 344 |
+
f"and the downloaded manifest"
|
| 345 |
+
)
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def sha256_file(path: Path) -> str:
|
| 349 |
+
digest = hashlib.sha256()
|
| 350 |
+
with path.open("rb") as handle:
|
| 351 |
+
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
| 352 |
+
digest.update(chunk)
|
| 353 |
+
return digest.hexdigest()
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
def main() -> None:
|
| 357 |
+
args = parse_args()
|
| 358 |
+
if args.action == "prepare":
|
| 359 |
+
prepare()
|
| 360 |
+
elif args.action == "upload":
|
| 361 |
+
upload(args.workers)
|
| 362 |
+
else:
|
| 363 |
+
verify()
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
if __name__ == "__main__":
|
| 367 |
+
main()
|
gmnet/project/gmnet_tpami/tests/test_e4_imagenet_spectral_audit.py
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from collections import Counter
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import struct
|
| 7 |
+
import sys
|
| 8 |
+
from types import SimpleNamespace
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import pytest
|
| 12 |
+
import torch
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
SCRIPTS = Path("/root/gmnet_tpami/scripts")
|
| 16 |
+
if str(SCRIPTS) not in sys.path:
|
| 17 |
+
sys.path.insert(0, str(SCRIPTS))
|
| 18 |
+
|
| 19 |
+
import run_e4_imagenet_spectral_audit as audit
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_registered_subset_is_balanced_deterministic_and_tie_broken_by_path(
|
| 23 |
+
tmp_path: Path,
|
| 24 |
+
) -> None:
|
| 25 |
+
samples = []
|
| 26 |
+
for class_id in range(1000):
|
| 27 |
+
for sample in range(5):
|
| 28 |
+
path = tmp_path / f"c{class_id:04d}" / f"image_{4 - sample}.JPEG"
|
| 29 |
+
samples.append((str(path), class_id))
|
| 30 |
+
first = audit.build_spectral_subset(samples, tmp_path)
|
| 31 |
+
second = audit.build_spectral_subset(samples, tmp_path)
|
| 32 |
+
assert first == second
|
| 33 |
+
assert len(first) == 4096
|
| 34 |
+
assert len({row.canonical_index for row in first}) == 4096
|
| 35 |
+
assert Counter(Counter(row.class_id for row in first).values()) == Counter(
|
| 36 |
+
{4: 904, 5: 96}
|
| 37 |
+
)
|
| 38 |
+
text = audit.subset_manifest_text(first)
|
| 39 |
+
assert text.endswith("\n")
|
| 40 |
+
assert audit.sha256_bytes(text.encode("utf-8")) == audit.sha256_bytes(
|
| 41 |
+
audit.subset_manifest_text(second).encode("utf-8")
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_order_probe_uses_registered_uint64_little_endian_key() -> None:
|
| 46 |
+
indices = audit.ordered_canonical_indices(32, "salt1")
|
| 47 |
+
salt = b"gmnet-e4-order-sensitivity-1\0"
|
| 48 |
+
expected = sorted(
|
| 49 |
+
range(32),
|
| 50 |
+
key=lambda index: (
|
| 51 |
+
__import__("hashlib").sha256(salt + struct.pack("<Q", index)).digest(),
|
| 52 |
+
index,
|
| 53 |
+
),
|
| 54 |
+
)
|
| 55 |
+
assert indices == expected
|
| 56 |
+
assert audit.ordered_canonical_indices(32, "canonical") == list(range(32))
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
@pytest.mark.parametrize("basis", ["fft", "dct"])
|
| 60 |
+
def test_transforms_are_orthonormal_and_invertible(basis: str) -> None:
|
| 61 |
+
value = torch.randn(2, 3, 8, 8, dtype=torch.float64)
|
| 62 |
+
coefficients = audit.transform2(value, basis)
|
| 63 |
+
restored = audit.inverse_transform2(coefficients, basis)
|
| 64 |
+
assert torch.linalg.vector_norm(restored - value) / torch.linalg.vector_norm(value) < 1e-10
|
| 65 |
+
transformed_energy = audit.transform_energy(coefficients).sum()
|
| 66 |
+
assert abs(float(transformed_energy - value.square().sum())) / float(
|
| 67 |
+
value.square().sum()
|
| 68 |
+
) < 1e-10
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
@pytest.mark.parametrize("basis", ["fft", "dct"])
|
| 72 |
+
def test_normalized_spectrum_is_scale_invariant_and_orders_tones(basis: str) -> None:
|
| 73 |
+
grid = torch.arange(16, dtype=torch.float64)
|
| 74 |
+
low = torch.sin(2 * torch.pi * 2 * grid / 16)[None, None, None, :]
|
| 75 |
+
high = torch.sin(2 * torch.pi * 7 * grid / 16)[None, None, None, :]
|
| 76 |
+
low = low.expand(2, 3, 16, 16)
|
| 77 |
+
high = high.expand(2, 3, 16, 16)
|
| 78 |
+
low_accumulator = audit.NormalizedSpectrumAccumulator(basis)
|
| 79 |
+
scaled_accumulator = audit.NormalizedSpectrumAccumulator(basis)
|
| 80 |
+
high_accumulator = audit.NormalizedSpectrumAccumulator(basis)
|
| 81 |
+
slots = torch.arange(2)
|
| 82 |
+
weights = torch.tensor([0.5, 0.5], dtype=torch.float64)
|
| 83 |
+
low_accumulator.update(low, receiver_slots=slots, image_weights=weights)
|
| 84 |
+
scaled_accumulator.update(11.0 * low, receiver_slots=slots, image_weights=weights)
|
| 85 |
+
high_accumulator.update(high, receiver_slots=slots, image_weights=weights)
|
| 86 |
+
low_result, low_psd, _ = low_accumulator.compute()
|
| 87 |
+
scaled_result, scaled_psd, _ = scaled_accumulator.compute()
|
| 88 |
+
high_result, _, _ = high_accumulator.compute()
|
| 89 |
+
assert np.allclose(low_psd, scaled_psd, atol=1e-12)
|
| 90 |
+
assert high_result["spectral_centroid"] > low_result["spectral_centroid"]
|
| 91 |
+
assert np.isclose(
|
| 92 |
+
scaled_result["raw_centered_energy_mean_per_map"]
|
| 93 |
+
/ low_result["raw_centered_energy_mean_per_map"],
|
| 94 |
+
121.0,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
@pytest.mark.parametrize("basis", ["fft", "dct"])
|
| 99 |
+
def test_constant_gate_has_identity_transfer_and_zero_projection_residual(
|
| 100 |
+
basis: str,
|
| 101 |
+
) -> None:
|
| 102 |
+
carrier = torch.randn(3, 4, 8, 8, dtype=torch.float64)
|
| 103 |
+
gate = torch.full_like(carrier, 2.5)
|
| 104 |
+
accumulator = audit.OperatorMetricAccumulator(basis)
|
| 105 |
+
accumulator.update(
|
| 106 |
+
carrier, gate, carrier * gate, receiver_slots=torch.arange(3)
|
| 107 |
+
)
|
| 108 |
+
result, primary, _, per_image = accumulator.compute()
|
| 109 |
+
offdiag = primary.copy()
|
| 110 |
+
np.fill_diagonal(offdiag, 0.0)
|
| 111 |
+
assert offdiag.sum() / 4.0 <= 1e-6
|
| 112 |
+
assert np.allclose(np.diag(primary), 1.0, atol=1e-10)
|
| 113 |
+
assert np.allclose(per_image["projection_residual"], 0.0, atol=1e-10)
|
| 114 |
+
assert np.allclose(
|
| 115 |
+
per_image["projection_residual_conditional"], 0.0, atol=1e-10
|
| 116 |
+
)
|
| 117 |
+
assert np.array_equal(
|
| 118 |
+
per_image["projection_residual_conditional_valid_channels"],
|
| 119 |
+
np.full(carrier.shape[0], carrier.shape[1], dtype=np.int32),
|
| 120 |
+
)
|
| 121 |
+
assert np.array_equal(
|
| 122 |
+
per_image["constant_gate_count"],
|
| 123 |
+
np.full(carrier.shape[0], carrier.shape[1], dtype=np.int32),
|
| 124 |
+
)
|
| 125 |
+
assert np.allclose(per_image["constant_gate_fraction"], 1.0)
|
| 126 |
+
assert result["reconstruction_relative_l2_max"] <= 1e-10
|
| 127 |
+
assert result["parseval_relative_error_max"] <= 1e-10
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
@pytest.mark.parametrize("basis", ["fft", "dct"])
|
| 131 |
+
def test_suppressed_output_is_zero_not_invalid_residual(basis: str) -> None:
|
| 132 |
+
carrier = torch.randn(2, 3, 8, 8, dtype=torch.float64)
|
| 133 |
+
gate = torch.zeros_like(carrier)
|
| 134 |
+
accumulator = audit.OperatorMetricAccumulator(basis)
|
| 135 |
+
accumulator.update(carrier, gate, carrier * gate, receiver_slots=torch.arange(2))
|
| 136 |
+
result, primary, _, per_image = accumulator.compute()
|
| 137 |
+
assert result["suppressed_output_maps"] == carrier.shape[0] * carrier.shape[1]
|
| 138 |
+
assert np.allclose(per_image["projection_residual"], 0.0)
|
| 139 |
+
assert np.isnan(per_image["projection_residual_conditional"]).all()
|
| 140 |
+
assert np.array_equal(
|
| 141 |
+
per_image["projection_residual_conditional_valid_channels"],
|
| 142 |
+
np.zeros(carrier.shape[0], dtype=np.int32),
|
| 143 |
+
)
|
| 144 |
+
assert np.array_equal(
|
| 145 |
+
per_image["constant_gate_count"],
|
| 146 |
+
np.full(carrier.shape[0], carrier.shape[1], dtype=np.int32),
|
| 147 |
+
)
|
| 148 |
+
assert np.allclose(per_image["constant_gate_fraction"], 1.0)
|
| 149 |
+
assert result["projection_residual_conditional_nonsuppressed"]["count"] == 0
|
| 150 |
+
assert np.allclose(primary, 0.0)
|
| 151 |
+
assert result["transfer"]["m_off"] == 0.0
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def test_map_equal_coherence_keeps_identity_exact_and_excludes_constants() -> None:
|
| 155 |
+
carrier = torch.randn(2, 3, 8, 8)
|
| 156 |
+
carrier[:, -1] = 1.0
|
| 157 |
+
accumulator = audit.MapPearsonAccumulator()
|
| 158 |
+
accumulator.update(
|
| 159 |
+
carrier,
|
| 160 |
+
carrier.detach(),
|
| 161 |
+
identical=True,
|
| 162 |
+
receiver_slots=torch.arange(2),
|
| 163 |
+
)
|
| 164 |
+
result = accumulator.compute()
|
| 165 |
+
assert result["map_equal"]["mean"] == 1.0
|
| 166 |
+
assert result["map_equal"]["std"] == 0.0
|
| 167 |
+
assert result["valid_maps"] == 4
|
| 168 |
+
assert result["invalid_maps"] == 2
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def test_channel_midpoint_median_handles_even_odd_masked_and_all_invalid() -> None:
|
| 172 |
+
values = torch.tensor(
|
| 173 |
+
[
|
| 174 |
+
[0.0, 2.0, float("nan"), float("nan")],
|
| 175 |
+
[0.0, 2.0, 4.0, float("nan")],
|
| 176 |
+
[0.0, 2.0, 100.0, 200.0],
|
| 177 |
+
[float("nan"), float("inf"), float("nan"), float("nan")],
|
| 178 |
+
],
|
| 179 |
+
dtype=torch.float32,
|
| 180 |
+
)
|
| 181 |
+
valid = torch.tensor(
|
| 182 |
+
[
|
| 183 |
+
[True, True, True, True],
|
| 184 |
+
[True, True, True, True],
|
| 185 |
+
[True, True, False, False],
|
| 186 |
+
[True, True, True, True],
|
| 187 |
+
]
|
| 188 |
+
)
|
| 189 |
+
medians, counts = audit.per_image_channel_midpoint_median(values, valid)
|
| 190 |
+
|
| 191 |
+
assert medians.dtype == torch.float64
|
| 192 |
+
assert counts.tolist() == [2, 3, 2, 0]
|
| 193 |
+
assert medians[:3].tolist() == [1.0, 2.0, 1.0]
|
| 194 |
+
assert torch.isnan(medians[3])
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def test_batch_pairing_records_complete_bijections_for_256_and_80() -> None:
|
| 198 |
+
class Gate:
|
| 199 |
+
@staticmethod
|
| 200 |
+
def batch_derangement_shift(batch_size: int) -> int:
|
| 201 |
+
return 1 + 41041 % (batch_size - 1)
|
| 202 |
+
|
| 203 |
+
recorder = audit.BatchPairingRecorder(0, 1, 1)
|
| 204 |
+
recorder.update(Gate(), torch.arange(256))
|
| 205 |
+
recorder.update(Gate(), torch.arange(256, 336))
|
| 206 |
+
result = recorder.compute()
|
| 207 |
+
assert result["receiver_count"] == 336
|
| 208 |
+
assert result["donor_count"] == 336
|
| 209 |
+
assert result["bijection"] is True
|
| 210 |
+
assert result["fixed_points"] == 0
|
| 211 |
+
assert {row["local_batch_size"] for row in result["by_local_batch_size"]} == {
|
| 212 |
+
80,
|
| 213 |
+
256,
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def test_lowpass_self_test_is_double_precision_and_unclamped() -> None:
|
| 218 |
+
image = torch.rand(1, 3, 32, 32)
|
| 219 |
+
filtered, imaginary = audit.butterworth_lowpass_rgb(image, 0.5)
|
| 220 |
+
assert imaginary is not None and imaginary <= 1e-10
|
| 221 |
+
assert filtered.shape == image.shape
|
| 222 |
+
assert not torch.equal(filtered, image)
|
| 223 |
+
assert audit.run_numerical_self_tests(torch.device("cpu"))["passed"] is True
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
def test_image_equal_spectral_reduction_does_not_reweight_imbalanced_classes() -> None:
|
| 227 |
+
class_ids = np.asarray([0, 0, 0, 1], dtype=np.int64)
|
| 228 |
+
values = np.asarray([0.0, 0.0, 0.0, 1.0], dtype=np.float64)
|
| 229 |
+
block_values = np.stack((values, values * 2.0), axis=1)
|
| 230 |
+
|
| 231 |
+
assert float(audit.image_equal_mean(values)) == pytest.approx(0.25)
|
| 232 |
+
assert np.allclose(audit.image_equal_mean(block_values), [0.25, 0.5])
|
| 233 |
+
assert float(audit.class_equal_mean(values, class_ids)) == pytest.approx(0.5)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def test_installed_distribution_package_lock_is_sorted_and_self_hashed() -> None:
|
| 237 |
+
package_lock = audit.installed_distribution_package_lock()
|
| 238 |
+
entries = package_lock["entries"]
|
| 239 |
+
serialization = ("\n".join(entries) + "\n").encode("utf-8")
|
| 240 |
+
|
| 241 |
+
assert entries == sorted(set(entries))
|
| 242 |
+
assert package_lock["entry_count"] == len(entries)
|
| 243 |
+
assert package_lock["sha256"] == audit.sha256_bytes(serialization)
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
def test_output_minus_carrier_uses_paired_valid_channels() -> None:
|
| 247 |
+
grid = torch.arange(16, dtype=torch.float64)
|
| 248 |
+
low = torch.sin(2 * torch.pi * 2 * grid / 16).repeat(16, 1)
|
| 249 |
+
high = torch.sin(2 * torch.pi * 7 * grid / 16).repeat(16, 1)
|
| 250 |
+
carrier = torch.stack((2.0 + low, 2.0 + high))[None]
|
| 251 |
+
output = torch.stack((2.0 + high, torch.zeros_like(high)))[None]
|
| 252 |
+
gate = output / carrier
|
| 253 |
+
slots = torch.asarray([0])
|
| 254 |
+
|
| 255 |
+
operator = audit.OperatorMetricAccumulator("fft")
|
| 256 |
+
operator.update(carrier, gate, output, receiver_slots=slots)
|
| 257 |
+
_, _, _, paired = operator.compute()
|
| 258 |
+
|
| 259 |
+
carrier_spectrum = audit.NormalizedSpectrumAccumulator("fft")
|
| 260 |
+
output_spectrum = audit.NormalizedSpectrumAccumulator("fft")
|
| 261 |
+
carrier_spectrum.update(carrier, receiver_slots=slots)
|
| 262 |
+
output_spectrum.update(output, receiver_slots=slots)
|
| 263 |
+
_, _, carrier_image = carrier_spectrum.compute()
|
| 264 |
+
_, _, output_image = output_spectrum.compute()
|
| 265 |
+
marginal_delta = (
|
| 266 |
+
output_image["high_frequency_fraction"]
|
| 267 |
+
- carrier_image["high_frequency_fraction"]
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
assert paired["output_minus_carrier_valid_channels"].tolist() == [1]
|
| 271 |
+
assert paired["output_minus_carrier_high_fraction"][0] > 0.9
|
| 272 |
+
assert paired["output_minus_carrier_high_fraction"][0] > marginal_delta[0] + 0.4
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def test_all_constant_gate_and_suppressed_output_remain_a_valid_measurement() -> None:
|
| 276 |
+
carrier = torch.randn(2, 3, 8, 8, dtype=torch.float64)
|
| 277 |
+
gate = torch.zeros_like(carrier)
|
| 278 |
+
output = carrier * gate
|
| 279 |
+
slots = torch.arange(2)
|
| 280 |
+
rows = tuple(
|
| 281 |
+
audit.SubsetRow(
|
| 282 |
+
canonical_index=index,
|
| 283 |
+
relative_path=f"class{index}/image.JPEG",
|
| 284 |
+
class_id=index,
|
| 285 |
+
selection_sha256=f"{index + 1:064x}",
|
| 286 |
+
within_class_rank=1,
|
| 287 |
+
selection_kind="base4",
|
| 288 |
+
)
|
| 289 |
+
for index in range(2)
|
| 290 |
+
)
|
| 291 |
+
block = audit.BlockAudit(
|
| 292 |
+
module_name="stages.0.0",
|
| 293 |
+
global_block_index=0,
|
| 294 |
+
stage=1,
|
| 295 |
+
block=1,
|
| 296 |
+
gate=torch.nn.Identity(),
|
| 297 |
+
intervention="baseline",
|
| 298 |
+
)
|
| 299 |
+
weights = torch.full((2,), 0.5, dtype=torch.float64)
|
| 300 |
+
signals = {
|
| 301 |
+
"carrier": carrier,
|
| 302 |
+
"gate_input": carrier,
|
| 303 |
+
"gate_value": gate,
|
| 304 |
+
"gated_product": output,
|
| 305 |
+
"residual_delta": output - carrier,
|
| 306 |
+
}
|
| 307 |
+
for basis in ("fft", "dct"):
|
| 308 |
+
for signal, value in signals.items():
|
| 309 |
+
block.signal_spectra[(basis, signal)].update(
|
| 310 |
+
value, receiver_slots=slots, image_weights=weights
|
| 311 |
+
)
|
| 312 |
+
block.operators[basis].update(
|
| 313 |
+
carrier, gate, output, receiver_slots=slots
|
| 314 |
+
)
|
| 315 |
+
block.coherence_used.update(
|
| 316 |
+
carrier, carrier, identical=True, receiver_slots=slots
|
| 317 |
+
)
|
| 318 |
+
block.coherence_response.update(carrier, gate, receiver_slots=slots)
|
| 319 |
+
block.gate_diagnostics.append(
|
| 320 |
+
{
|
| 321 |
+
"receiver_slot": np.arange(2, dtype=np.int64),
|
| 322 |
+
"gate_mean": np.zeros(2),
|
| 323 |
+
"gate_cv": np.zeros(2),
|
| 324 |
+
"gate_zero_fraction": np.ones(2),
|
| 325 |
+
"gate_active_fraction": np.zeros(2),
|
| 326 |
+
"gate_clip_crossing_fraction": np.zeros(2),
|
| 327 |
+
}
|
| 328 |
+
)
|
| 329 |
+
block.gate_reconstruction_batches = 1
|
| 330 |
+
|
| 331 |
+
block_rows, stage_rows, per_image, transfer, _, summary = (
|
| 332 |
+
audit.finalize_spectral_collector(
|
| 333 |
+
SimpleNamespace(subset_rows=rows, blocks=[block])
|
| 334 |
+
)
|
| 335 |
+
)
|
| 336 |
+
for basis in ("fft", "dct"):
|
| 337 |
+
gate_row = next(
|
| 338 |
+
row
|
| 339 |
+
for row in block_rows
|
| 340 |
+
if row["basis"] == basis and row["signal"] == "gate_value"
|
| 341 |
+
)
|
| 342 |
+
output_row = next(
|
| 343 |
+
row
|
| 344 |
+
for row in block_rows
|
| 345 |
+
if row["basis"] == basis and row["signal"] == "gated_product"
|
| 346 |
+
)
|
| 347 |
+
assert gate_row["valid"] == 0
|
| 348 |
+
assert gate_row["invalid"] == carrier.numel() // (8 * 8)
|
| 349 |
+
assert gate_row["psd_high_fraction"] is None
|
| 350 |
+
assert gate_row["log10_centered_energy"] is None
|
| 351 |
+
assert gate_row["log10_centered_energy_valid"] == 0
|
| 352 |
+
assert gate_row["centered_rms"] == 0.0
|
| 353 |
+
assert output_row["jsd"] is None
|
| 354 |
+
assert output_row["jsd_valid_channels"] == 0
|
| 355 |
+
assert output_row["rho_response"] is None
|
| 356 |
+
assert output_row["m_res"] == 0.0
|
| 357 |
+
assert output_row["suppressed_fraction"] == 1.0
|
| 358 |
+
assert output_row["output_minus_carrier_high_fraction"] is None
|
| 359 |
+
assert output_row["output_minus_carrier_valid_channels"] == 0
|
| 360 |
+
assert np.isnan(
|
| 361 |
+
per_image[f"{basis}_output_minus_carrier_high_fraction"]
|
| 362 |
+
).all()
|
| 363 |
+
assert np.array_equal(
|
| 364 |
+
per_image[f"{basis}_output_minus_carrier_valid_channels"],
|
| 365 |
+
np.zeros((2, 1), dtype=np.int32),
|
| 366 |
+
)
|
| 367 |
+
assert np.array_equal(
|
| 368 |
+
per_image[f"{basis}_jsd_valid_channels"],
|
| 369 |
+
np.zeros((2, 1), dtype=np.int32),
|
| 370 |
+
)
|
| 371 |
+
assert np.allclose(transfer[f"{basis}_primary"], 0.0)
|
| 372 |
+
assert summary["output_minus_carrier"][basis][
|
| 373 |
+
"high_frequency_fraction_block_equal"
|
| 374 |
+
] is None
|
| 375 |
+
spectrum_summary, _, _ = block.signal_spectra[
|
| 376 |
+
(basis, "gate_value")
|
| 377 |
+
].compute()
|
| 378 |
+
assert spectrum_summary["normalized_spectrum_defined"] is False
|
| 379 |
+
assert spectrum_summary["radial_band_fractions"] == [None] * 4
|
| 380 |
+
assert any(row["psd_high_fraction"] is None for row in stage_rows)
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
def test_band_edges_source_fractions_and_strict_validity_boundary() -> None:
|
| 384 |
+
radius = np.asarray([0.0, 0.249, 0.25, 0.5, 0.75, 1.0])
|
| 385 |
+
masks = audit.radial_band_masks(radius)
|
| 386 |
+
assert audit.RADIAL_BAND_EDGES == (0.0, 0.25, 0.5, 0.75, 1.0)
|
| 387 |
+
assert np.array_equal(sum(mask.astype(np.int8) for mask in masks), np.ones(6))
|
| 388 |
+
assert masks[-1][-1]
|
| 389 |
+
|
| 390 |
+
valid_fraction, suppressed_fraction = audit.receiver_source_fractions(
|
| 391 |
+
np.asarray([[0, 0, 0, 0], [2, 1, 0, 1]]),
|
| 392 |
+
np.asarray([[0, 0, 0, 0], [1, 0, 0, 1]]),
|
| 393 |
+
np.asarray([8, 8]),
|
| 394 |
+
)
|
| 395 |
+
assert np.allclose(valid_fraction, [0.0, 0.5])
|
| 396 |
+
assert np.isnan(suppressed_fraction[0])
|
| 397 |
+
assert suppressed_fraction[1] == pytest.approx(0.5)
|
| 398 |
+
assert audit.source_validity_passes(np.asarray([100, 100, 100, 100]), 100)
|
| 399 |
+
assert not audit.source_validity_passes(np.asarray([99, 100, 100, 100]), 100)
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
def test_input_manifest_and_training_code_provenance_are_hard_frozen(
|
| 403 |
+
tmp_path: Path,
|
| 404 |
+
) -> None:
|
| 405 |
+
manifest_path = Path("/nfs/ywang29/GmNet/e4_spectral_audit/input_manifest.json")
|
| 406 |
+
manifest, manifest_hash = audit.load_input_manifest(manifest_path)
|
| 407 |
+
assert manifest_hash == audit.EXPECTED_INPUT_MANIFEST_SHA256
|
| 408 |
+
audit.validate_code_provenance(manifest)
|
| 409 |
+
|
| 410 |
+
altered = json.loads(json.dumps(manifest))
|
| 411 |
+
altered["description"] += " altered"
|
| 412 |
+
altered_path = tmp_path / "input_manifest.json"
|
| 413 |
+
altered_path.write_text(json.dumps(altered), encoding="utf-8")
|
| 414 |
+
with pytest.raises(ValueError, match="input manifest SHA256"):
|
| 415 |
+
audit.load_input_manifest(altered_path)
|
| 416 |
+
|
| 417 |
+
altered["code_provenance"]["audit_runtime_code_sha256"] = "0" * 64
|
| 418 |
+
with pytest.raises(ValueError, match="code provenance"):
|
| 419 |
+
audit.validate_code_provenance(altered)
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
def test_check_only_runner_identity_is_fail_closed() -> None:
|
| 423 |
+
current = audit.file_sha256(Path(audit.__file__).resolve())
|
| 424 |
+
assert audit.validate_runner_identity(
|
| 425 |
+
{"hashes": {"runner_sha256": current}}
|
| 426 |
+
) == current
|
| 427 |
+
with pytest.raises(RuntimeError, match="current runner SHA256"):
|
| 428 |
+
audit.validate_runner_identity(
|
| 429 |
+
{"hashes": {"runner_sha256": "0" * 64}}
|
| 430 |
+
)
|
gmnet/spectral_audit/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# E4 ImageNet Matched Spectral Audit
|
| 2 |
+
|
| 3 |
+
This directory is an external deployment and evidence package. It does not modify
|
| 4 |
+
the frozen `/nfs/ywang29/GmNet/journal_exp` experiment source, configs, manifests,
|
| 5 |
+
or completed checkpoints.
|
| 6 |
+
|
| 7 |
+
## Package Status
|
| 8 |
+
|
| 9 |
+
The package is `ready_not_submitted`. No formal result directory or root
|
| 10 |
+
`COMPLETE` exists yet. Frozen executable identities are:
|
| 11 |
+
|
| 12 |
+
```text
|
| 13 |
+
runner 2b56465319e651716170fbaa58d43f14924d70f694b0a273ab63255c2697edfe
|
| 14 |
+
tests 0d520eca7baeec28932fb98fa6b2522207ea434264009f8daadd5d86f65b7004
|
| 15 |
+
aggregator 9027155739ccbeba1150d5bdaa6d94930d8169ed4d4edb5c5fe2af2bd655b5e5
|
| 16 |
+
YAML 696d3c198cb9bde125fb726b75daac9703136f50ad7dab76a891767de85d87c3
|
| 17 |
+
manifest 4ff8001c29a89bdc68c9c3578e354e9808223d6143c9663df8b64130f1e26578
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
The runner test suite is copied to `tests/test_e4_imagenet_spectral_audit.py`.
|
| 21 |
+
It passes 21 tests under `-W error`; the aggregator passes 30 deterministic
|
| 22 |
+
self-tests. Local smoke output remains `PARTIAL` and is not scientific evidence.
|
| 23 |
+
|
| 24 |
+
## Purpose
|
| 25 |
+
|
| 26 |
+
Run one post-hoc measurement protocol on the fixed-last seed-0 checkpoints:
|
| 27 |
+
|
| 28 |
+
| Arm | Intervention | GPU | Official Top-1 |
|
| 29 |
+
|---|---|---:|---:|
|
| 30 |
+
| B | current baseline | 0 | 78.798 |
|
| 31 |
+
| D | batch derangement | 1 | 54.362 |
|
| 32 |
+
| S | stop-gradient | 2 | 76.774 |
|
| 33 |
+
| C | channel derangement | 3 | 77.794 |
|
| 34 |
+
| SC | stop-gradient + channel derangement | 4 | 69.508 |
|
| 35 |
+
|
| 36 |
+
A single launch task requests the original 8 x A100-80GB resource envelope.
|
| 37 |
+
GPUs 0-4 run the five canonical arms; GPUs 5-6 run the two registered D order
|
| 38 |
+
probes; GPU 7 runs the B order-invariance control. Every task is an independent
|
| 39 |
+
single-GPU process. This preserves canonical per-task batch size 256 and avoids
|
| 40 |
+
mixing DDP ordering with the batch-derangement intervention.
|
| 41 |
+
|
| 42 |
+
## Frozen Measurement Contract
|
| 43 |
+
|
| 44 |
+
- Docker image: PyTorch `2.9.0`, Python 3.12, CUDA 13.0, matching official eval.
|
| 45 |
+
- Dataset: the registered ImageNet archive is downloaded from S3 and validated at
|
| 46 |
+
`/tmp/gmnet_data/imagenet-1k` before any audit process starts.
|
| 47 |
+
- Inference: float32, batch size 256, 50,000 canonical validation images for every
|
| 48 |
+
low-pass condition, including the 80-image tail batch.
|
| 49 |
+
- Spectral block subset: 4,096 receiver identities are generated once from the
|
| 50 |
+
canonical 50K validation index, frozen under `protocol/`, and hashed in
|
| 51 |
+
`input_manifest.json` before formal launch. The wrapper verifies and copies
|
| 52 |
+
the same bytes into the partial result root; all eight tasks receive that one
|
| 53 |
+
read-only manifest. No task selects receivers after observing activations.
|
| 54 |
+
- Low-pass grid: `0.125,0.25,0.5,0.75` under one explicitly recorded transform
|
| 55 |
+
definition, plus a separate true `unfiltered` bypass.
|
| 56 |
+
- Accuracy replay: `unfiltered` is a true filter-bypass condition. A Butterworth
|
| 57 |
+
cutoff of 1 is not treated as mathematical identity. The bypass replay
|
| 58 |
+
must exactly reproduce each arm's registered 50K correct counts, Top-1, and
|
| 59 |
+
Top-5 before the aggregate is accepted.
|
| 60 |
+
- Inputs: all checkpoint, config, official-result, and official-check files are
|
| 61 |
+
checked against hashes in `input_manifest.json` before launch.
|
| 62 |
+
|
| 63 |
+
The current audit source is frozen by the mechanism-followup code manifest at
|
| 64 |
+
`f6bd434a...`. B/D/SC were trained with that source. S/C were trained with the
|
| 65 |
+
earlier alignment source `4a62bc48...`; the later source added D/SC without
|
| 66 |
+
changing the registered S/C forward semantics. The old alignment generator's
|
| 67 |
+
`--check` cannot pass against the newer source by construction, so it is not
|
| 68 |
+
used as a runtime gate. Instead, the old code-manifest hash, S/C checkpoint and
|
| 69 |
+
certificate hashes, intervention identity, and shared channel-permutation hash
|
| 70 |
+
are verified. Before data staging, the formal PyTorch 2.9 container must also
|
| 71 |
+
reproduce bitwise-equal B/S/C forward values, input gradients, and parameter
|
| 72 |
+
gradients between the frozen `4a62bc48...` snapshot and `f6bd434a...` runtime.
|
| 73 |
+
Exact unfiltered 50K replay under `f6bd434a...` is the second mandatory
|
| 74 |
+
behavioral-equivalence gate before cross-arm spectral results are accepted.
|
| 75 |
+
|
| 76 |
+
The LongLive `init_run.sh` export block is copied verbatim into
|
| 77 |
+
`scripts/run_parallel_5arms.sh`. `scripts/static_check.py` compares both blocks and
|
| 78 |
+
fails if any environment line changes.
|
| 79 |
+
|
| 80 |
+
## Spectral Claim Boundary
|
| 81 |
+
|
| 82 |
+
The formal acceptance gate covers matched preprocessing, identical image sets,
|
| 83 |
+
the unfiltered accuracy replay, low-pass curves, and the runner's registered block
|
| 84 |
+
statistics. These measurements test whether accuracy loss can be explained by an
|
| 85 |
+
undifferentiated loss or increase of spectral energy.
|
| 86 |
+
|
| 87 |
+
`projection_residual` and `offdiag_transfer` are required for the formal
|
| 88 |
+
matched-mixing decision. `projection_residual` quantifies centered output energy
|
| 89 |
+
left after the registered per-image/channel scalar carrier projection.
|
| 90 |
+
`offdiag_transfer` is computed from row-normalized 4x4 cross-band transfer after
|
| 91 |
+
freezing the realized gate. Their outputs must record the estimator, orthonormal
|
| 92 |
+
transform normalization, valid-channel rule, and block-equal aggregation. FFT is
|
| 93 |
+
primary and orthonormal DCT-II is the required boundary-condition check. Missing
|
| 94 |
+
transfer, either basis, or estimator metadata prevents the root `COMPLETE` marker
|
| 95 |
+
and forbids a matched-total-mixing claim.
|
| 96 |
+
|
| 97 |
+
Stage summaries must say whether they are block-equal or element-weighted. The
|
| 98 |
+
paper-facing default is a block-equal mean plus range; silent pooling across all
|
| 99 |
+
activation elements is not accepted.
|
| 100 |
+
|
| 101 |
+
## Deployment Flow
|
| 102 |
+
|
| 103 |
+
The formal runner is packaged at:
|
| 104 |
+
|
| 105 |
+
```text
|
| 106 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/code/run_e4_imagenet_spectral_audit.py
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
After freezing that file, generate and verify the YAML without submitting it:
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
python3 /nfs/ywang29/GmNet/e4_spectral_audit/scripts/generate_deploy.py
|
| 113 |
+
python3 /nfs/ywang29/GmNet/e4_spectral_audit/scripts/generate_deploy.py --check
|
| 114 |
+
python3 /nfs/ywang29/GmNet/e4_spectral_audit/scripts/static_check.py --require-generated
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
The generated launch input is:
|
| 118 |
+
|
| 119 |
+
```text
|
| 120 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/e4_matched_spectral_5arms_seed0.yaml
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
The generator never invokes a launch command. Its manifest records
|
| 124 |
+
`launchjob_submitted_by_generator: false` at:
|
| 125 |
+
|
| 126 |
+
```text
|
| 127 |
+
/nfs/ywang29/GmNet/depoly/e4_imagenet_spectral_20260718/deploy_manifest.json
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Failure and Output Policy
|
| 131 |
+
|
| 132 |
+
The wrapper takes a nonblocking batch lock, refuses to overwrite a formal output,
|
| 133 |
+
and writes to a unique `.partial.*` directory. Before measurement, the formal
|
| 134 |
+
PyTorch 2.9 environment must reproduce the frozen S/C source-equivalence test;
|
| 135 |
+
that evidence is verified and copied into the partial result root. All eight runner
|
| 136 |
+
processes must then exit successfully and pass their own `--check-only` validation,
|
| 137 |
+
with the runner hash verified both before and after measurement.
|
| 138 |
+
|
| 139 |
+
An independent cross-task aggregator next validates the eight task artifacts and
|
| 140 |
+
deterministically rebuilds the root tables. The wrapper reopens those aggregate
|
| 141 |
+
outputs through a separate aggregator `--check-only` pass and verifies the bound
|
| 142 |
+
runner/aggregator hashes plus the aggregate source-artifact manifest. The aggregator
|
| 143 |
+
never writes root `COMPLETE`. Only after both aggregate passes grant formal and order
|
| 144 |
+
completion does the wrapper write that marker and atomically rename the partial
|
| 145 |
+
directory to:
|
| 146 |
+
|
| 147 |
+
```text
|
| 148 |
+
/nfs/ywang29/GmNet/e4_spectral_audit/results/matched_5arm_seed0_20260718
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
Failed partial directories are intentionally retained for diagnosis and are not
|
| 152 |
+
accepted as evidence.
|
gmnet/spectral_audit/input_manifest.json
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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md",
|
| 7 |
+
"sha256": "b66f0aa2f620135584483fb0057fe6fec9a55b4b501b08fd26065034a892b4a2"
|
| 8 |
+
},
|
| 9 |
+
"description": "Read-only matched post-hoc spectral audit of the five E4 fixed-last checkpoints.",
|
| 10 |
+
"dataset": {
|
| 11 |
+
"runtime_root": "/tmp/gmnet_data/imagenet-1k",
|
| 12 |
+
"source_archive_uri": "s3://snap-research-cv-code/ywang29/datasets/imagenet-1k/imagenet-1k.tar",
|
| 13 |
+
"expected_archive_bytes": 161381969920,
|
| 14 |
+
"expected_train_samples": 1281167,
|
| 15 |
+
"expected_val_samples": 50000,
|
| 16 |
+
"canonical_manifest_sha256": "bb70bc9f530db6bb24f70e648624b35281bfbc76a57775d589a2e0209dd98661",
|
| 17 |
+
"evaluation_manifest_sha256": "ad38432b1881feafb4f2f90a6379c74268c1a67c3e0d07c6a7d869132233b585",
|
| 18 |
+
"class_to_idx_sha256": "2312848f9b87eb0d5afd5c3cd09fc3191dadfb5948dc7912639683c2bc5e5f1f",
|
| 19 |
+
"val_sample_index_sha256": "5ed16b5cd3ebd64e90cd7a8380b4e19d4c0d82eedcca3489dfa29313ce88d6f6",
|
| 20 |
+
"val_sampled_content_sha256": "d80a57419bc9396df7c01e29a2b17698c02c3a9a68dc4006a1fe87ef129ed166",
|
| 21 |
+
"val_sampled_content_samples": 1000
|
| 22 |
+
},
|
| 23 |
+
"runtime": {
|
| 24 |
+
"python": "3.12.10",
|
| 25 |
+
"torch": "2.9.0+cu130",
|
| 26 |
+
"torchvision": "0.24.0+cu130",
|
| 27 |
+
"docker_image": "763104351884.dkr.ecr.us-west-2.amazonaws.com/pytorch-training:2.9.0-gpu-py312-cu130-ubuntu22.04-ec2",
|
| 28 |
+
"gpus_requested": 8,
|
| 29 |
+
"canonical_arms": 5,
|
| 30 |
+
"parallel_tasks": 8,
|
| 31 |
+
"canonical_batch_size": 256,
|
| 32 |
+
"workers_per_arm": 8,
|
| 33 |
+
"spectral_samples": 4096,
|
| 34 |
+
"max_eval_samples": 50000,
|
| 35 |
+
"lowpass_cutoffs": [0.125, 0.25, 0.5, 0.75],
|
| 36 |
+
"inference_precision": "float32"
|
| 37 |
+
},
|
| 38 |
+
"spectral_subset": {
|
| 39 |
+
"artifact_path": "/nfs/ywang29/GmNet/e4_spectral_audit/protocol/subset_manifest.jsonl",
|
| 40 |
+
"sha256": "52a3e937d8862b19d6352e60833a864aa5bea376436acd2290415cac58232adb",
|
| 41 |
+
"frozen_from_val_sample_index_sha256": "5ed16b5cd3ebd64e90cd7a8380b4e19d4c0d82eedcca3489dfa29313ce88d6f6",
|
| 42 |
+
"num_samples": 4096,
|
| 43 |
+
"path_encoding": "UTF-8",
|
| 44 |
+
"path_separator": "0x00",
|
| 45 |
+
"within_class_salt": "gmnet-e4-spectral-v1",
|
| 46 |
+
"within_class_key": "SHA256(UTF8(salt) || 0x00 || UTF8(canonical_relative_path))",
|
| 47 |
+
"within_class_tie_breaker": "canonical_relative_path ascending",
|
| 48 |
+
"base_samples_per_class": 4,
|
| 49 |
+
"extra_class_count": 96,
|
| 50 |
+
"extra_class_salt": "gmnet-e4-spectral-extra-v1",
|
| 51 |
+
"extra_class_id_encoding": "ASCII(f\"{zero_based_imagefolder_class_id:04d}\")",
|
| 52 |
+
"extra_class_key": "SHA256(UTF8(salt) || 0x00 || ASCII_4DIGIT_CLASS_ID)",
|
| 53 |
+
"extra_class_tie_breaker": "zero_based_imagefolder_class_id ascending",
|
| 54 |
+
"expected_class_histogram": {"classes_with_4": 904, "classes_with_5": 96}
|
| 55 |
+
},
|
| 56 |
+
"order_encoding": {
|
| 57 |
+
"canonical_index": "zero-based ImageFolder validation index",
|
| 58 |
+
"key": "SHA256(UTF8(order_salt) || 0x00 || UINT64_LE(canonical_index))",
|
| 59 |
+
"index_encoding": "exactly 8 unsigned little-endian bytes",
|
| 60 |
+
"sort_tuple": ["digest ascending", "canonical_index ascending"]
|
| 61 |
+
},
|
| 62 |
+
"lowpass": {
|
| 63 |
+
"unfiltered_condition": "true transform bypass",
|
| 64 |
+
"official_preprocess": "bicubic Resize(256), CenterCrop(224), float RGB [0,1]",
|
| 65 |
+
"filter_position": "after crop and before ImageNet mean/std normalization",
|
| 66 |
+
"transform": "orthonormal 2D FFT per RGB channel",
|
| 67 |
+
"normalized_radius": "sqrt(fx^2 + fy^2) / sqrt(0.5)",
|
| 68 |
+
"response": "order-4 Butterworth amplitude H_c(r)=(1+(r/c)^8)^(-1/2)",
|
| 69 |
+
"inverse": "real inverse without clipping, min-max rescaling, or quantization",
|
| 70 |
+
"cutoffs": [0.125, 0.25, 0.5, 0.75],
|
| 71 |
+
"images_per_condition": 50000
|
| 72 |
+
},
|
| 73 |
+
"code_provenance": {
|
| 74 |
+
"audit_runtime_code_sha256": "f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9",
|
| 75 |
+
"audit_runtime_manifest": "/nfs/ywang29/GmNet/journal_exp/configs/code_manifests/e4_mechanism_followup_20260717.json",
|
| 76 |
+
"audit_runtime_manifest_sha256": "e354339142ffc72e669234a9f297113a64e5294ce8ff37dd658e62f723f0b239",
|
| 77 |
+
"alignment_training_code_sha256": "4a62bc48370247d882196cd9afc1a0f1629a5bbfd522c3f599ffaf0c1187641f",
|
| 78 |
+
"alignment_training_manifest": "/nfs/ywang29/GmNet/journal_exp/configs/code_manifests/e4_alignment_20260716.json",
|
| 79 |
+
"alignment_training_manifest_sha256": "fa1a6ba00c82619dbd51b9af61489a34326b635978d83ef948584e45f93cddbc",
|
| 80 |
+
"alignment_source_snapshot_manifest": "/nfs/ywang29/GmNet/e4_spectral_audit/source_snapshots/alignment_4a62/source_manifest.json",
|
| 81 |
+
"alignment_source_snapshot_manifest_sha256": "f590f522f8e9181eaa26b1688ed5d59a0598b9d4188fcd10f14516d24b070b19",
|
| 82 |
+
"alignment_source_gmnet_sha256": "5291156084aaf72936d1f8896057e7e606f74ef05aed856df4940e4838dbe3ac",
|
| 83 |
+
"audit_runtime_gmnet_sha256": "8446a0ed7d6863f81e88929f3277d363c961372210279de7d0e770f636852f3c",
|
| 84 |
+
"source_equivalence_boundary": "S/C were trained under 4a62; B/D/SC and the audit runtime use f6bd. Exact 50K official replay is required before cross-arm spectral interpretation."
|
| 85 |
+
},
|
| 86 |
+
"topology": {
|
| 87 |
+
"parameter_count": 7791544,
|
| 88 |
+
"state_tensor_count": 365,
|
| 89 |
+
"model_state_schema_sha256": "352cb771eaf4123fb9364dfd25d0151f9c2e6fa5493b989759091819f8981c99"
|
| 90 |
+
},
|
| 91 |
+
"order_probes": [
|
| 92 |
+
{
|
| 93 |
+
"task_id": "D_order1",
|
| 94 |
+
"arm": "D",
|
| 95 |
+
"runner_order": "salt1",
|
| 96 |
+
"order_salt": "gmnet-e4-order-sensitivity-1",
|
| 97 |
+
"run_lowpass": false,
|
| 98 |
+
"gpu": 5
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"task_id": "D_order2",
|
| 102 |
+
"arm": "D",
|
| 103 |
+
"runner_order": "salt2",
|
| 104 |
+
"order_salt": "gmnet-e4-order-sensitivity-2",
|
| 105 |
+
"run_lowpass": false,
|
| 106 |
+
"gpu": 6
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"task_id": "B_order1",
|
| 110 |
+
"arm": "B",
|
| 111 |
+
"runner_order": "salt1",
|
| 112 |
+
"order_salt": "gmnet-e4-order-sensitivity-1",
|
| 113 |
+
"run_lowpass": false,
|
| 114 |
+
"gpu": 7
|
| 115 |
+
}
|
| 116 |
+
],
|
| 117 |
+
"arms": [
|
| 118 |
+
{
|
| 119 |
+
"arm": "B",
|
| 120 |
+
"label": "current_baseline",
|
| 121 |
+
"gate_intervention": "baseline",
|
| 122 |
+
"training_code_sha256": "f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9",
|
| 123 |
+
"run_name": "e4f_s3_current_baseline_seed0",
|
| 124 |
+
"run_dir": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0",
|
| 125 |
+
"checkpoint": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0/checkpoint_last.pt",
|
| 126 |
+
"checkpoint_sha256": "090116608a567152d232255e5d96d6f1611154d508e5727bbdf84781d1b532c8",
|
| 127 |
+
"config_source": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0/config_source.yaml",
|
| 128 |
+
"config_source_sha256": "bd9bf41321c332a5d4b997eae909d31e97f56a2d9f1e68a22abb454cdbd4038a",
|
| 129 |
+
"official_results": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0/official_eval/results.json",
|
| 130 |
+
"official_results_sha256": "deddb2e0ab300e1f79775ae7d4c4e18186763277b948781e735dc73dc646577b",
|
| 131 |
+
"official_checks": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0/official_eval/checks.json",
|
| 132 |
+
"official_checks_sha256": "9bf3bd38df34c3e6af9e05a6b691d7bf1b904fbcd53d53b21e42e89efea285a1",
|
| 133 |
+
"official_per_sample": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_current_baseline_seed0/official_eval/per_sample.npz",
|
| 134 |
+
"official_per_sample_sha256": "69a811c873e3c1264a6240ca6c087b440f9e22fd42bc7d65e34e9ddd53a8f01a",
|
| 135 |
+
"official_top1": 78.798,
|
| 136 |
+
"official_top1_correct": 39399,
|
| 137 |
+
"official_top5": 94.4,
|
| 138 |
+
"official_top5_correct": 47200
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"arm": "D",
|
| 142 |
+
"label": "batch_derangement",
|
| 143 |
+
"gate_intervention": "batch_derangement",
|
| 144 |
+
"training_code_sha256": "f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9",
|
| 145 |
+
"run_name": "e4f_s3_batch_derangement_seed0",
|
| 146 |
+
"run_dir": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0",
|
| 147 |
+
"checkpoint": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0/checkpoint_last.pt",
|
| 148 |
+
"checkpoint_sha256": "d07bc844c1b2a678fc1e8baacf1fe7518a7b7d1ab9858cbdd6512fe00e4361a0",
|
| 149 |
+
"config_source": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0/config_source.yaml",
|
| 150 |
+
"config_source_sha256": "cded9dc356656ba449968dde2f15a12b01090a6f8b982418bfa7ed79670f178e",
|
| 151 |
+
"official_results": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0/official_eval/results.json",
|
| 152 |
+
"official_results_sha256": "8e78f9b435f95e2e3f200bec8776c16c4b60bb28b2eff554c2105926b77b9341",
|
| 153 |
+
"official_checks": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0/official_eval/checks.json",
|
| 154 |
+
"official_checks_sha256": "8dce527f3694c938ef74f40116fb7e649a9444c406e5bcf8ddab27960737baba",
|
| 155 |
+
"official_per_sample": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_batch_derangement_seed0/official_eval/per_sample.npz",
|
| 156 |
+
"official_per_sample_sha256": "d1759183022dce6170d1f1dc33de98abe2626133877fe3b77512b83e4ed40223",
|
| 157 |
+
"official_top1": 54.362,
|
| 158 |
+
"official_top1_correct": 27181,
|
| 159 |
+
"official_top5": 77.34,
|
| 160 |
+
"official_top5_correct": 38670
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"arm": "S",
|
| 164 |
+
"label": "stop_gradient",
|
| 165 |
+
"gate_intervention": "stop_gradient",
|
| 166 |
+
"training_code_sha256": "4a62bc48370247d882196cd9afc1a0f1629a5bbfd522c3f599ffaf0c1187641f",
|
| 167 |
+
"run_name": "e4a_s3_stop_gradient_seed0",
|
| 168 |
+
"run_dir": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0",
|
| 169 |
+
"checkpoint": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0/checkpoint_last.pt",
|
| 170 |
+
"checkpoint_sha256": "786526f3f4d55cac7656b2cce770c4192177f28a06e9362c8473248f32a81326",
|
| 171 |
+
"config_source": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0/config_source.yaml",
|
| 172 |
+
"config_source_sha256": "bbd70c5304808e192f62ae4778047362f10a42ba8b7cdf430a5e0dd8cb650a10",
|
| 173 |
+
"official_results": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0/official_eval/results.json",
|
| 174 |
+
"official_results_sha256": "bc89d402149c7238b56aa188d24001902e1e891061b08cf6d7a3eb11f4098031",
|
| 175 |
+
"official_checks": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0/official_eval/checks.json",
|
| 176 |
+
"official_checks_sha256": "98ff97ac63929e80f0a61d9e9b1f72bb88e0190fcc21afa50eb7e8b14f777669",
|
| 177 |
+
"official_per_sample": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_stop_gradient_seed0/official_eval/per_sample.npz",
|
| 178 |
+
"official_per_sample_sha256": "b5b28bf491c8cf9fa1c730fea115507581537104606d58052cb6cf4b78d03e41",
|
| 179 |
+
"official_top1": 76.774,
|
| 180 |
+
"official_top1_correct": 38387,
|
| 181 |
+
"official_top5": 93.358,
|
| 182 |
+
"official_top5_correct": 46679
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"arm": "C",
|
| 186 |
+
"label": "channel_derangement",
|
| 187 |
+
"gate_intervention": "channel_derangement",
|
| 188 |
+
"training_code_sha256": "4a62bc48370247d882196cd9afc1a0f1629a5bbfd522c3f599ffaf0c1187641f",
|
| 189 |
+
"run_name": "e4a_s3_channel_derangement_seed0",
|
| 190 |
+
"run_dir": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0",
|
| 191 |
+
"checkpoint": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0/checkpoint_last.pt",
|
| 192 |
+
"checkpoint_sha256": "e21cddc22c53f880a8357b009652beadfacec8723ef0aad2a93bb5a8caf346b7",
|
| 193 |
+
"config_source": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0/config_source.yaml",
|
| 194 |
+
"config_source_sha256": "65f7b7429ed529bd30ec9e69837a4996d62a803a44b3b77b1ba3fd9e76ad845b",
|
| 195 |
+
"official_results": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0/official_eval/results.json",
|
| 196 |
+
"official_results_sha256": "dd81aec890b9ba79b8a8d3cf2427f81d583615e61f839407093083c96dec5a8a",
|
| 197 |
+
"official_checks": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0/official_eval/checks.json",
|
| 198 |
+
"official_checks_sha256": "48f295fd10cc9f16b4695750f442d4570cd600cecdb4e9962fc6975fcc188305",
|
| 199 |
+
"official_per_sample": "/nfs/ywang29/GmNet/runs/e4_alignment/e4a_s3_channel_derangement_seed0/official_eval/per_sample.npz",
|
| 200 |
+
"official_per_sample_sha256": "9d3d0ee3934210732b87002b44d2e626306f8a50712b89cfc59d689286608712",
|
| 201 |
+
"official_top1": 77.794,
|
| 202 |
+
"official_top1_correct": 38897,
|
| 203 |
+
"official_top5": 93.906,
|
| 204 |
+
"official_top5_correct": 46953
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"arm": "SC",
|
| 208 |
+
"label": "stopgrad_channel_derangement",
|
| 209 |
+
"gate_intervention": "stop_gradient_channel_derangement",
|
| 210 |
+
"training_code_sha256": "f6bd434a2ac86c772f2e23683431f3bb7ccb06f539558682a3bea6464bacebf9",
|
| 211 |
+
"run_name": "e4f_s3_stopgrad_channel_derangement_seed0",
|
| 212 |
+
"run_dir": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0",
|
| 213 |
+
"checkpoint": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0/checkpoint_last.pt",
|
| 214 |
+
"checkpoint_sha256": "918925152daae6a1039f91690ee9d634296b18a08be7800e8db4c2315ac175be",
|
| 215 |
+
"config_source": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0/config_source.yaml",
|
| 216 |
+
"config_source_sha256": "bba389430f64af8c28c7bab402a3506a8a4b16aed65bd025934e0a7f4936836a",
|
| 217 |
+
"official_results": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0/official_eval/results.json",
|
| 218 |
+
"official_results_sha256": "a3fe2e0f8696427238aa48d6ffa9b8a21c5b97b1b2e400b93e6b88cd001e0da9",
|
| 219 |
+
"official_checks": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0/official_eval/checks.json",
|
| 220 |
+
"official_checks_sha256": "7bbfe3aeeb9a2e6307f3afd8799216b2a1a7557fc6bb78b6726edc0ccff19c2c",
|
| 221 |
+
"official_per_sample": "/nfs/ywang29/GmNet/runs/e4_mechanism_followup/e4f_s3_stopgrad_channel_derangement_seed0/official_eval/per_sample.npz",
|
| 222 |
+
"official_per_sample_sha256": "bcbdb7c095335a61eb58157ac550adbfe93f160e2392147b00546bc5df4b7c6e",
|
| 223 |
+
"official_top1": 69.508,
|
| 224 |
+
"official_top1_correct": 34754,
|
| 225 |
+
"official_top5": 88.894,
|
| 226 |
+
"official_top5_correct": 44447
|
| 227 |
+
}
|
| 228 |
+
]
|
| 229 |
+
}
|