
Claude Skills by wenmin-wu
github.com/wenmin-wuConverts a pretrained 2D CNN into a 3D CNN by recursively replacing Conv2d/BN2d/Pool2d layers and inflating kernel weights along the depth axis.
Select center slices from a 3D volume and zero-pad along depth when the scan has fewer slices than the target count
3D ResNet encoder extracts volumetric features, pools depth dimension, then feeds into a 2D UNet/FPN decoder for segmentation
Applies Mixup augmentation to 3D volumetric images and their segmentation masks, interpolating both inputs and loss targets.
Tiles 3D volumes into overlapping patches for inference and averages overlapping regions to produce seamless predictions.
Applies albumentations augmentations to object detection data while preserving bbox-label correspondence via BboxParams.
Resample a 3D medical volume to a fixed network input shape using physical voxel spacing (dz, dy, dx), correcting the Z dimension by the dz/dy ratio so anisotropic CT scans (1mm in-plane, 5mm slice) end up anatomically isotropic before trilinear interpolation
ArcFace angular margin loss layer for learning discriminative embeddings — used in image retrieval, product matching, and face recognition
Show-Attend-Tell decoder: Bahdanau additive attention over CNN spatial features driving a gated LSTMCell for autoregressive image-to-sequence generation.
All-vs-all contrastive loss comparing every pair in a batch (N^2 pairs) with margin and compactification regularizer
Wrap albumentations bbox transforms in a 10-attempt retry loop that re-rolls the augmentation when all boxes get cropped out, preventing empty-target samples from poisoning the detection loss with NaN gradients
Interpolate missing bounding boxes across video frames using bidirectional pandas interpolation to maintain smooth tracking through occlusions
Combines BCE-with-logits and soft Dice loss with configurable weights for binary and multilabel segmentation training.
Replace a pretrained ResNet's conv1 with a wider input conv to accept stacked BEV raster channels (semantic map + agent history) while keeping downstream weights
Two-stage CT classifier where a 2D CNN dumps per-slice features once, then a bidirectional GRU runs over the slice sequence to produce both per-slice predictions (TimeDistributed head) and an exam-level prediction (avg+max pooled head) — turns expensive 3D CNN training into cheap sequence modeling
Crops uninformative black or dark borders from images by deriving a binary mask from the grayscale channel and trimming rows/columns.
Detect all-black DICOM/MRI slices (mean==0) and replace them by randomly sampling a non-black slice from the same series
Fuse low-resolution multispectral bands with a high-resolution panchromatic band using the Brovey transform to produce sharp multi-band imagery
Select a fixed number of Z-slices centered around the volume midpoint for memory-efficient 2.5D input from 3D CT/MRI stacks
Score each face in a video as anomalous by computing L2 distance from the embedding centroid of all faces, then convert to probability via logistic function
Memory-efficient Keras generator that streams sharded CSV files in chunks, renders strokes to images on-the-fly, and yields batches for training on datasets too large for memory
Compute pairwise cosine similarity on GPU in fixed-size chunks to avoid OOM, transferring only threshold-passing results to CPU
Dynamically undersample majority class each epoch with per-class keep probabilities for stochastic balance
Sample training patches from large images using per-class area-fraction thresholds to ensure each patch contains meaningful object coverage
Manual stable diffusion inference loop with classifier-free guidance that interpolates between unconditional and conditional noise predictions for controllable image generation
Uses a binary classifier's probability to gate object detector outputs in three tiers: keep detections, append a no-finding box, or replace all detections.
Scores image aesthetic quality by passing L2-normalized CLIP ViT-L/14 embeddings through a trained MLP regressor head.
Generate descriptive text prompts from images by combining BLIP captioning with CLIP cosine similarity against curated label banks for medium, movement, and flavor attributes
Strips the global pool and FC head from a pretrained CNN to expose spatial feature maps (H x W x C) for attention-based decoding.
Fuse CNN image features with a small tabular MLP branch via concat before a final classifier, training both branches end-to-end
Extract per-frame CNN features then classify the temporal sequence with stacked GRU layers and a boolean mask for variable-length video inputs
Convert per-instance RLE or polygon annotations to COCO JSON format for seamless use with Detectron2 and MMDetection
Match two unequal-length point sets by enumerating which points to drop from the longer set, searching over deletion combinations
Passes N tiles independently through a shared CNN backbone, concatenates their feature maps spatially, then pools for classification — a lightweight multi-instance learning approach.
Assigns multiple labels per sample using a confidence threshold on sigmoid outputs with a fallback negative class.
Extracts object centers from 3D segmentation masks using connected-component labeling and centroid computation.
Stack 1D convolutions for local feature extraction before bidirectional LSTMs to classify variable-length stroke sequences into hundreds of doodle categories
Stratify train/validation split by binned mask coverage percentage to ensure balanced foreground representation in segmentation tasks
Drop false-positive detections by requiring matched per-frame box counts across paired synchronized camera views (Endzone vs Sideline) — if both views see the same scene at the same instant, true events should appear in both
Detect inverted CT slice ordering by comparing ImagePositionPatient[2] (the Z coordinate) of the first and last DICOM slice in a series, flipping the volume along axis 0 when needed so every patient ends up in canonical head→feet order
Add a cumulative sum channel along the vertical axis to capture directional structural trends in grayscale images for segmentation
Fuses 3D object detections from multiple models by clustering nearby predictions with DBSCAN and taking cluster centroids.
Run DeepSort on per-frame detections then overwrite each track cluster's label with the most common mapped label across the track's lifetime
Custom Detectron2 data mapper with photometric augmentations that properly transforms images, bounding boxes, and instance masks in sync
Partition a large dataset into N balanced shards using integer key modulo arithmetic for reproducible, class-interleaved splits across CSV files
Dice coefficient loss for pixel-level segmentation that directly optimizes the overlap between predicted and ground-truth masks.
Fix pixel overflow artifacts in 12-bit unsigned DICOM files where values wrap around at 4096
Normalize DICOM pixel values using frequency-equalized histogram bins for globally consistent non-linear intensity mapping
Convert raw DICOM pixel arrays to Hounsfield Units using per-slice RescaleSlope/RescaleIntercept, with outside-scanner clamping
Order DICOM slices into a coherent 3D volume by sorting on ImagePositionPatient[2] (the Z coordinate in patient space), with a filename-integer fallback for series whose tag is missing — never trust filename alphabetical order, never trust InstanceNumber