计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
losses-and-metrics【效率与协作】Operate MedicalZooPytorch loss and metric APIs for segmentation criteria, shape contracts, tuple returns, and safe smoke checks.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is to select, instantiate, debug, or smoke-test MedicalZooPytorch loss objects exposed through lib.losses3D.
[N, C, D, H, W] and integer label targets shaped [N, D, H, W] unless the API reference says a raw PyTorch loss requires same-shaped targets.classes argument to the model output channel count.criterion(output, target) to return (loss_tensor, per_channel_dice_like). DiceLoss, GeneralizedDiceLoss, BCEDiceLoss, and DiceLoss2D satisfy that shape of contract; scalar-only losses require a trainer adaptation owned by segmentation-workflows.create_loss(name, ...) is case-sensitive and does not expose every constructor option. Instantiate classes directly when class count, skip_index_after, tag coefficients, contrastive embeddings, or 2D Dice behavior matters.Run the bundled deterministic smoke check after making the MedicalZooPytorch package importable:
python sub-skills/losses-and-metrics/scripts/smoke_losses.py
python sub-skills/losses-and-metrics/scripts/smoke_losses.py --cuda
The script uses tiny synthetic tensors, validates tuple versus scalar return contracts, exercises representative factory/manual loss paths, and confirms unsupported factory names fail with guidance.