技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
classification【数据与研究】Guides Attention-Gated Networks ultrasound classification workflows, including Sononet training, evaluation, HDF5 data layout, and attention overlays.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for ultrasound scan-plane classification tasks in
Attention-Gated Networks. It covers Sononet, Sononet2, Sononet Grid Attention,
FeedForwardClassifier, AggregatedClassifier, the HDF5 ultrasound loader,
classification training/testing scripts, and attention overlay export.
../../scripts/check_env.py --repo-root /path/to/Attention-Gated-Networks --mode classification.Use this route when the user asks to:
sononet, sononet2, and sononet_grid_attention;aggregated_classifier, deep supervision, or attention aggregation;us HDF5 dataset layout;Route 3D segmentation, NIfTI validation, and multi-attention U-Net feature-map
exports to ../segmentation/SKILL.md instead.
Install the repository with CUDA-enabled PyTorch and the legacy
torchsample dependency. Then run:
python ../../scripts/check_env.py --repo-root /path/to/Attention-Gated-Networks --mode classification
Prepare an ultrasound HDF5 file with x_train, p_train, x_val, p_val,
x_test, p_test, and label_names. See data-layout.md.
Copy a Sononet config and replace its dataset path. The source configs use
model.output_nc=14, input_nc=1, tensor_dim='2D', and gpu_ids=[0].
Train with the bundled replacement when real data is available:
Relative config paths are resolved from the explicit --repo-root; relative
data_path values are resolved from the config file's parent. The HDF5 data
file and any checkpoint/weights must already exist outside this skill. Bundled
runners and check_env.py --config ... reject missing or private /vol/...
paths before constructing a dataset.
python scripts/run_classifier.py --repo-root /path/to/Attention-Gated-Networks --config path/to/config.json --mode train
Evaluate a checkpoint with the bundled replacement:
python scripts/run_classifier.py --repo-root /path/to/Attention-Gated-Networks --config path/to/config.json --mode test
For attention models, use model_type='sononet_grid_attention' and read
workflows.md before choosing aggregation_mode and
aggregation.
Export a safe synthetic overlay, or adapt the command for a real 2D input:
python scripts/export_attention_overlay.py \
--repo-root /path/to/Attention-Gated-Networks \
--config configs/config_sononet_grid_att_8.json \
--output-dir /tmp/ag-net-attention
.cuda().AggregatedClassifier is for multiple-output attention models. Plain
Sononet classifiers use FeedForwardClassifier.The source train_classifaction.py contains a 10-hour sleep after the final
epoch's updates. It is retained in the source checkout for provenance; use the
bundled runner when a bounded run without that hold is required.
Training writes checkpoints and logs below the configured checkpoint directory
and experiment name. Testing writes accumulated metrics and a test_result.pkl
inside the model save directory. The bundled attention helper writes overlay
PNGs and .npy arrays to the requested output directory.