技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-preparation【数据与研究】Prepare, validate, and troubleshoot rPPG-Toolbox raw datasets, face-cropped NPY caches, labels, file lists, splits, and dataset-loader integrations.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a Researcher must turn a supported raw dataset into aligned,
face-cropped, resized, normalized, chunked cache clips, or must audit an existing
cache without access to the original checkout. This skill covers dataset discovery,
preprocessing configuration, cache/file-list contracts, and loader extension points.
It does not cover trainer/model internals or metric interpretation. Use the
evaluation-and-visualization sub-skill for metrics and the supervised-models
sub-skill for trainer configuration.
CACHED_PATH and FILE_LIST_PATH.scripts/validate_preprocessed_data.py in read-only
mode before loading it. A normal NPY cache contains paired *_input*.npy and
*_label*.npy files and a CSV whose required column is input_files.DO_PREPROCESS: true reads raw data and writes cache files; after a successful
build, set it to false for training/evaluation. With preprocessing disabled,
missing CACHED_PATH is an error; a missing file list may trigger retroactive
reconstruction from raw identifiers and cached input names.DATA_PATH, CACHED_PATH, FILE_LIST_PATH,
BEGIN, END, and DATA_FORMAT. Use BEGIN=0, END=1 for all data. For
subject-aware loaders, fractional boundaries select whole sorted subjects, not
arbitrary clips. Avoid leakage by keeping a subject in one split.DATA_TYPE values Raw, DiffNormalized, and/or
Standardized; choose one LABEL_TYPE from Raw, DiffNormalized, or
Standardized. DO_CHUNK with CHUNK_LENGTH keeps only complete chunks; the
remainder is discarded. DO_CHUNK: false emits one variable-length clip.CROP_FACE.DO_CROP_FACE, BACKEND (HC or
Y5F), USE_LARGE_FACE_BOX, LARGE_BOX_COEF, and detection settings. Set
RESIZE.W/H. Confirm the detector on representative frames before a full build.BaseLoader.preprocess crops/resizes, transforms, normalizes labels,
chunks, and saves. Check paired names, finite values, frame/label lengths, and
file-list coverage before using the cache.Standard BaseLoader.save/save_multi_process names outputs
<source-id>_input<k>.npy and <source-id>_label<k>.npy. An input NPY is normally
rank 4 (D,H,W,C) on disk: temporal depth, height, width, channels (NDHWC).
The matching label is normally rank 1 (D,); D must equal the input temporal
length. BaseLoader.__getitem__ casts both to float32. For DATA_FORMAT=NDCHW
it returns (D,C,H,W); for NCDHW, (C,D,H,W); for NDHWC, it leaves the
stored array unchanged. Do not confuse the on-disk NDHWC contract with the
post-loader tensor layout.
The loader returns (data, label, filename, chunk_id). filename is derived from
the cache filename before the final _inputN suffix and chunk_id is the numeric
chunk suffix. load_preprocessed_data reads input_files, sorts paths, and derives
labels by replacing input with label; therefore use unambiguous cache names and
never mix unrelated input/label roots.
BP4DPlusBigSmallLoader is a deliberate exception: it writes a pickle input
containing two arrays (big and small streams), with a paired NPY label of shape
(D,49), and supports NDCHW, NCDHW, and NDHWC for each stream. The supplied
validator audits the standard NPY contract, not pickle contents; audit BigSmall
streams with a loader-aware check and confirm fold membership separately.
HC uses OpenCV Haar Cascade on the first frame by default; Y5F uses the bundled
YOLO5Face implementation and checkpoint and can use CPU or one CUDA device. A
missed detection falls back to a full-frame box; multiple HC detections choose the
largest. Dynamic detection samples every DYNAMIC_DETECTION_FREQUENCY frames;
USE_MEDIAN_FACE_BOX can replace all sampled boxes with their median. Large-box
expansion can help motion videos but may include background and is clipped during
cropping. Resize uses OpenCV area interpolation.
The source implementation currently addresses the HC XML through a relative repository dataset path, which is unsafe when the process runs outside the repository root. A portable runtime must resolve the cascade from an installed/package resource or an explicit user-supplied resource path, verify that OpenCV loaded it, and pass an absolute resolved path; never ask a downstream agent to depend on a source checkout or current working directory. Y5F likewise requires its model YAML/checkpoint resources to be packaged or explicitly staged; no download or credential step is part of this skill.
Safe operations are read-only layout/cache validation, deterministic CSV inspection,
small dry-run probes, and writes into an explicitly chosen cache directory. Treat
full video decoding, face detection, pseudo-label generation, and multiprocessing
as costly. BaseLoader.multi_process_manager can spawn up to eight workers by
default, each decoding and holding arrays; reduce concurrency for memory-limited
systems. Do not overwrite a known-good cache, mutate raw files, run training, fetch
datasets/checkpoints, or infer metrics here. Motion-augmented data must already be
prepared by the external MA-rPPG Video Toolbox; this repository only reads its NPY
frames when DATA_AUG contains Motion.
For detailed layouts, loader tails, formats, and caveats, read
references/data-formats.md. For an actionable build
sequence and custom split/fold guidance, read references/workflows.md.
For failures, read references/troubleshooting.md.
Use python scripts/validate_preprocessed_data.py --help before auditing a cache.