计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
preprocessing【效率与协作】Operate Photo2Cartoon face alignment, crop, segmentation-mask, alpha, and whitening preprocessing contracts.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task needs the Photo2Cartoon preprocessing contract: face landmark detection, largest-face selection, eye-corner rotation alignment, expanded square face crop, TensorFlow segmentation-mask handling, RGBA composition, or white-background compositing before training or portrait inference.
Preprocess.process, FaceDetect.align, crop expansion ratios, detector selection (dlib or sfd), segmentation graph tensor names, and alpha-mask semantics.portrait-inference.data-and-training.uint8 with shape H x W x 3; convert OpenCV BGR inputs to RGB before calling preprocessing.seg_model_384.pb and is expected beside the preprocessing utilities in a repo checkout. It is not bundled in this skill.detector='dlib' is the default; detector='sfd' may be useful when installed and supported by the local face_alignment package. Use device='cuda' only when the detector stack and PyTorch/TensorFlow stack are GPU-compatible.python scripts/preprocess_contract_check.py --help
python scripts/preprocess_contract_check.py --repo-root /path/to/photo2cartoon-checkout
--execute only after assets/dependencies are verified:python scripts/build_preprocess_command.py \
--repo-root /path/to/photo2cartoon-checkout \
--data-path /path/to/raw-portrait-folder \
--save-path /path/to/preprocessed-output-folder
Preprocess.process(image) returns None when no face landmarks are detected.Hc x Wc x 4 uint8-style RGBA array: first three channels are the aligned/cropped RGB face, and channel 4 is the resized segmentation alpha mask.255) before inserting the visible source pixels, so border padding is expected for near-edge faces.mask = alpha[:, :, None] / 255.0 and face * mask + (1 - mask) * 255.Read references/preprocessing-pipeline.md for the exact algorithm and API patterns. Read references/troubleshooting.md for missing assets, TensorFlow compatibility, detector installation, no/multiple-face handling, crop padding, and alpha-mask shape failures.