Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
inference-and-deployment【部署与运维】Use DLTK's TensorFlow 1.x prediction, full-volume sliding-window assembly, crop averaging, metrics, and metadata-preserving medical-image deployment workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this route when the task is to run prediction with an exported DLTK model, assemble patch predictions into a full volume, average stochastic crops, calculate segmentation metrics, or write a NIfTI result. This is an operating guide for DLTK 0.2.1's TensorFlow 1.x graph-execution deployment path.
tensorflow.contrib.predictor.from_saved_model; do not claim that a modern TF2 installation provides this predictor or that these recipes are TF2-compatible.[batch, spatial..., channels]; a full-volume application adds a dummy batch dimension.inference-and-deployment/), run python scripts/sliding_window_plan.py --help, then provide spatial --input-shape, --window-shape, and --output-shape. The helper performs validation without importing TensorFlow, reading data, or contacting a network.python scripts/sliding_window_smoke.py. It exercises the native test shape plus output-smaller, overlapping, and batched assembly using constant synthetic predictions; it does not load a model or dataset.batch_size, and explicit stride before session execution. A malformed output/window combination can fail in padding or produce empty slices and a zero division counter.sliding_window_segmentation_inference as an averaging assembler: it runs each patch, adds each output to the corresponding output slice, increments a separate coverage counter, and returns sum / counter for each requested op. It returns a list in ops_list order, not class labels.[batch, spatial..., classes] probability or logit result with np.argmax(result, axis=-1). For probabilities, averaging overlapping patches before argmax is the DLTK MRBrainS pattern. For logits, a numerically stable softmax is useful when probabilities are needed, but argmax is unchanged.dice returns NaN for a class with no predicted and no reference voxels; np.nanmean(dice[1:]) is an application policy, not a universal score.CopyInformation from the source image, and only then write the requested .nii/.nii.gz. A shape or direction/spacing mismatch must be diagnosed rather than silently discarded.See troubleshooting.md before changing geometry, predictor access, export discovery, or metric handling.