
Claude Skills by wenmin-wu
github.com/wenmin-wuEncode the empirical per-position event rate as a soft prior over slice index by binning normalized slice location and looking up a precomputed weight vector — adds class-aware spatial context to a per-slice classifier without changing the model
Pad 3D volumes with fewer slices than required by duplicating existing slices with slight brightness variation via convertScaleAbs
Encode game state as a Super Mini Map (SMM) with separate binary channels for players, ball, and ownership, bit-packed for efficient transfer in RL training
Cyclic cosine annealing LR that produces M diverse snapshots from a single training run for free ensembling
Aggregate patch-level count-regression predictions into image-level totals by multiplying each prediction by a boolean mask (x * (x > tau)) instead of rounding, retaining fractional evidence above threshold while killing background noise
Turn sparse single-frame event labels (impacts, collisions, goals) into a usable detector training set by stamping the positive label onto a ±k-frame window around each event, then dropping any frame that contains no positives — gives the detector enough positive samples without changing the original annotation
Split large-image segmentation data into train/val by spatial rectangle regions with border buffer exclusion to prevent patch leakage
Compute normalized spectral band ratios (NDWI, CCCI, NDVI) from multispectral imagery and threshold for binary segmentation of water, vegetation, or other targets
Keras callback implementing Stochastic Weight Averaging (SWA) — running mean of model weights over final training epochs
Stratifies cross-validation folds by output sequence length to ensure balanced length distributions across train/val splits.
Normalize raw stroke coordinates to 0-255 range, resample at uniform arc-length spacing, then apply Ramer-Douglas-Peucker simplification
Render stroke sequences to grayscale images with temporal intensity encoding where earlier strokes are brighter and later strokes fade to encode drawing order
Serialize structured ground truth (chart data, table rows, form fields) as special-token-delimited sequences for generative vision-language model training
Add random temporal offset to the center frame during training to augment temporal diversity in video-based models
Pad batch sequence lengths to multiples of 8 for efficient tensor core utilization on GPUs, with -100 masking for label padding
Compiles a PyTorch model to a TensorRT FP16 engine via torch_tensorrt for 2-5x inference speedup, saved as reusable TorchScript.
Applies geometric and color augmentations at inference time and averages predictions to reduce variance.
Assembles N extracted tiles into a sqrt(N) x sqrt(N) mosaic image for single-forward-pass CNN inference on whole slide images.
Selects the top-N most informative tiles from a gigapixel whole slide image by ranking on pixel intensity sum, keeping tiles with the most tissue content.
Pre-shard TFRecords into N files each balanced along 3 axes (patient, target, image-count), then KFold over file indices for leak-free triple-stratified folds
Extract volumetric features from 3D segmentation masks including scan/tumor pixel ratios, tumor percentage, and tumor centroid coordinates
Tversky loss with independent alpha/beta constants to separately penalize false positives and false negatives in imbalanced segmentation.
Train segmentation with BCE loss first for stable convergence, then fine-tune with Lovasz-hinge on raw logits for IoU-optimal predictions
Chain a study-level classifier with an image-level detector, merging class probabilities and bounding boxes into a unified prediction
Use a lightweight slice-classifier to find the Z-range containing an organ in a CT volume, then crop and trilinear-resample that sub-volume into a fixed shape for a heavier 3D classifier — replaces "use the whole volume" with "use only the relevant slab" at a fraction of the FLOPs
Efficiently sample N evenly-spaced frames from a video using OpenCV grab/retrieve pattern with optional resize for batch face detection or classification
Extracts calibrated yes/no probabilities from a VQA model by masking all logits except yes/no token variants and renormalizing via softmax.
Combines gradual learning rate warmup with cosine annealing decay for stable fine-tuning of pretrained models.
Propagates image-level multi-labels to individual instances as weak supervision for instance-level training.
BCE loss with per-class asymmetric positive/negative weights to match competition metrics or handle class imbalance in multilabel classification.
Ensemble predictions from heterogeneous vision-language models by blending their output embeddings with fixed scalar weights in embedding space
Convert bounding boxes between YOLO (normalized center), VOC (absolute corners), and COCO (absolute xywh) formats with image dimension scaling
Load large LLMs with 4-bit NF4 quantization and optional double quantization via BitsAndBytes to reduce GPU memory by 4x while preserving inference quality
Shared-backbone neural network with actor (policy) and critic (value) heads for grid-based game agent RL training
Dynamically reduce max_tokens and batch size as wall-clock time approaches a cutoff to ensure all inputs get processed
Ensemble multi-model LLM predictions using weighted combination of average probability, cross-model agreement ratio, and max confidence
Parse sequential yes/no answers to build inclusion/exclusion sets, then apply compound boolean filters to narrow a candidate list
Steers LLM output format by injecting a partial assistant response into the chat template before generation, forcing structured output without fine-tuning.
Batch-compute perplexity for multiple texts using a causal LM with proper padding, shifted labels, and pad-token masking for efficient GPU utilization
Force-clamp free-form LLM output to binary yes/no with keyword matching and a fallback default for constrained environments
Hierarchical binary search over entity space by asking category, region, then first-letter questions to narrow candidates before guessing
Extract final numeric answers from LaTeX \boxed{} notation in LLM math reasoning output, scanning matches in reverse for robustness
Per-agent COLLECT/DEPOSIT state machine driven by cargo thresholds with greedy neighbor selection for resource collection games
Execute Python code blocks from LLM math responses in a sandbox, then double-weight code-derived answers in majority voting
Fine-tune an instruct LLM on a single text field containing prompt+answer using TRL's DataCollatorForCompletionOnlyLM, which masks the loss to only the answer tokens by detecting a response template string at collation time
Uses primary model predictions only when confidence exceeds a threshold, falling back to a backup ensemble otherwise.
Embed an enumerated list plus a counting/identity instruction to derail LLM judges into meta-answering instead of scoring
Single agent entry point that dispatches between multiple roles (ask/answer/guess) based on turn type, combining heuristic and LLM-based strategies
Enumerate all factorial permutations in batches with LLM scoring, tracking the running best and early-stopping when score crosses a known optimality threshold
Inject fake (user, assistant) turn pairs before the real prompt to steer the LLM into a specific output format