计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
portrait-workflows【效率与协作】Run U-2-Net portrait drawing, own-image face-crop portrait inference, and portrait/original compositing workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is portrait drawing/generation with the U-2-Net portrait checkpoint, own-photo face-crop portrait inference, Haar-cascade handling, or portrait/original composite images with explicit blur and blend controls.
scripts/portrait_infer.py for portrait-set and own-image portrait maps.scripts/portrait_composite.py for Gaussian-blurred original plus portrait-map composites.u2net_portrait.pth-compatible weights with --weights; pretrained portrait weights are not bundled.portrait_infer.py --mode portrait-set. Inputs should already be split/cropped portrait images, commonly 512x512.portrait_infer.py --mode own-images. It uses the bundled Haar cascade by default, selects the largest face, crops/pads/resizes to 512, and falls back to the whole image if no face is found.portrait_composite.py --sigma 20 --alpha 0.5 or other explicit values. It writes *_sigma_<sigma>_alpha_<alpha>_composite.png with numeric punctuation sanitized for portability.--allow-random-weights-for-smoke --max-images 1 --device cpu only to verify imports, preprocessing, forward pass, and output writing. Do not treat random-weight outputs as portrait quality evidence.For own photos, high-quality portrait drawing requires the head region to be close to or larger than 512x512 and the head background to be relatively clear. Small, blurry, occluded, profile, crowded, or cluttered photos may run but usually produce weak portraits.
salient-object-inference.model-architecture.data-and-training.Portrait-set inference:
python scripts/portrait_infer.py \
--weights PATH_TO_WEIGHTS/u2net_portrait.pth \
--input-dir INPUT_PORTRAITS \
--output-dir PORTRAIT_RESULTS \
--mode portrait-set \
--device auto
Own-image inference with the bundled cascade:
python scripts/portrait_infer.py \
--weights PATH_TO_WEIGHTS/u2net_portrait.pth \
--input-dir OWN_IMAGES \
--output-dir YOUR_PORTRAIT_RESULTS \
--mode own-images \
--device auto
Composite with README-style parameters:
python scripts/portrait_composite.py \
--weights PATH_TO_WEIGHTS/u2net_portrait.pth \
--input-dir OWN_IMAGES \
--output-dir COMPOSITE_RESULTS \
--sigma 20 \
--alpha 0.5 \
--device auto