Feature Extraction
Use this sub-skill when a task is about turning CLAM patch-coordinate .h5 files into slide-level feature bags, choosing resnet50_trunc, uni_v1, or conch_v1, setting checkpoint environment variables, or aligning downstream embed_dim values with extracted features.
Route First
- If the user still needs WSI segmentation, patch coordinates, process lists, or presets, read
../wsi-preprocessing/SKILL.mdfirst. - If the user already has feature
.ptfiles and is configuring splits, training, evaluation, or model checkpoints, read../training-evaluation/SKILL.md. - If the user is configuring attention heatmaps or visualizing trained CLAM checkpoints, read
../heatmap-visualization/SKILL.md. - If the user asks why feature extraction failed, start with
references/troubleshooting.md, then inspect the workflow or encoder reference that matches the symptom.
Reference Map
- Read
references/workflows.mdfor the fastextract_features_fp.pyworkflow, required inputs, command syntax, output layout, and downstreamdata_root_direxpectations. - Read
references/encoder-reference.mdto choose betweenresnet50_trunc,uni_v1, andconch_v1, including checkpoint variables, feature dimensions, and batch-size implications. - Read
references/legacy-pipeline.mdonly for older saved-patch.h5projects that usedextract_features.pyinstead of the current fast coordinate-based pipeline. - Read
references/troubleshooting.mdto diagnose coordinate-file,csv_path, slide-extension, OpenSlide, checkpoint, auto-skip, batch-size, andembed_dimfailures. - Run
scripts/clam_feature_command_builder.pybefore a heavy extraction job to validate safe CLI options and print anextract_features_fp.pycommand plus expected outputs without opening slides, loading checkpoints, or downloading weights.
Default Workflow
- Confirm
data_h5_dir/patches/<slide_id>.h5exists from the fast CLAM patching workflow and contains coordinate data rather than saved image patches. - Confirm
csv_pathhas aslide_idcolumn whose values match both coordinate files and slide files after applying--slide_ext. - Pick an encoder in
references/encoder-reference.md; setUNI_CKPT_PATHorCONCH_CKPT_PATHbefore using UNI or CONCH. - Use the bundled command builder to produce a safe command and inspect naming assumptions.
- Run CLAM feature extraction with
extract_features_fp.py, then point downstream training/evaluation at the parent feature root described inreferences/workflows.md.
