计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
inference-and-evaluation【效率与协作】Use the MedicalDetectionToolkit Predictor, post-processing, Evaluator, and plotting contracts to run bounded inference, consolidate detections, score ROI/patient results, and inspect saved outputs.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this node after a valid experiment configuration, data-loader batch, model output, or saved prediction pickle exists. It explains the source-backed prediction/evaluation pipeline; it does not provide a checkpoint, dataset, trained-model performance claim, or a replacement for the legacy CUDA path.
The operating facts below were distilled from the repository's predictor, evaluator, plotting, execution, defaults, and README evidence. Public signatures were inspected with a modern isolated stack; that inspection did not prove the historical custom CUDA operators or model inference.
cf.dim, cf.class_dict, cf.patch_size, cf.batch_size, cf.fold_dir, cf.test_n_epochs, cf.test_aug, cf.wcs_iou, cf.merge_2D_to_3D_preds, cf.merge_3D_iou, cf.ap_match_ious, cf.report_score_level, cf.min_det_thresh, and output paths. Route configuration questions to configuration-and-experiments and batch/patch shape questions to data-and-preprocessing.Predictor(cf, net, logger, mode='val') for patient validation/monitoring, mode='test' for checkpoint inference, and mode='analysis' only for load_saved_predictions in exec.py's analysis branch. See prediction workflows.predict_test_set collects epochs and XY mirrors, writes raw_pred_boxes_list.pickle or raw_pred_boxes_hold_out_list.pickle, and optionally applies WBC and 2D-to-3D merging. Use load_saved_predictions(apply_wbc=True) for repeatable analysis without a network forward. See consolidation.Evaluator.evaluate_predictions matches det boxes to gt boxes class-by-class at each configured IoU, creates the internal dataframe, and then return_metrics computes ROI AP and patient AP/AUC. Validate records with scripts/validate_evaluation_records.py before expensive analysis; see evaluation.score_test_df writes fold dataframes/results text and aggregates all fold pickles when available. Hold-out analysis calls utils.exp_utils.create_csv_output; monitoring/curves use monitoring and outputs. Do not interpret a plot or score as a performance guarantee without dataset and checkpoint provenance.A patient result is [boxes_by_batch_instance, pid]. boxes_by_batch_instance is a list of lists; 3D uses one dummy batch instance, while unmerged 2D uses one list per slice/batch element. Each detection box needs box_type: 'det', box_coords ([y1, x1, y2, x2] or [y1, x1, y2, x2, z1, z2]), box_score in the model's confidence scale (normally [0, 1]), and integer box_pred_class_id. Ground truth entries use box_type: 'gt', box_coords, and box_label. Raw patch detections additionally carry patch_id, box_patch_center_factor, and box_n_overlaps; WBC consumes these and emits consolidated detections.
A batch passed to predict_patient must include model input data, pid, original_img_shape, and patient targets/labels when validation needs ground truth; patched batches additionally include patch_crop_coords. Prediction outputs contain boxes, seg_preds, and (in validation) monitor_values. Segmentation averaging is implemented in tiling, but instance/semantic segmentation evaluation is explicitly not implemented by Evaluator.
wcs_iou, n_ens, patch-center/overlap weights, and 2D-to-3D connected-slice merging.scripts/validate_wbc_inputs.py for small, dependency-free structural checks on WBC inputs and scripts/validate_evaluation_records.py for dependency-free record checks. They never download models, import the checkout, or run inference.Stop and fix the input rather than silently continuing when patient IDs, batch-instance nesting, class IDs, coordinate dimensionality, box_type, or required patch metadata disagree. Stop before claiming a result when epoch ranking/checkpoints are missing, fold counts do not match, custom CUDA imports fail, or metric inputs contain only one patient class for AUC. Keep raw pickle outputs immutable while experimenting with WBC/thresholds so analysis remains reproducible.