skills/cv/cumulative-sum-channel/SKILL.md
Add a cumulative sum channel along the vertical axis to capture directional structural trends in grayscale images for segmentation
npx skillsauth add wenmin-wu/ds-skills cv-cumulative-sum-channelInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
For images with directional structure (seismic sections, depth profiles, medical slices), a cumulative sum along the vertical axis encodes positional context that a CNN would otherwise need many layers to learn. Mean-subtract first to center around zero, then cumsum to create a gradient-like channel that captures trends. Normalize by standard deviation to keep values in a stable range.
import numpy as np
def add_cumsum_channel(img, border=5):
center_mean = img[border:-border, border:-border].mean()
csum = (img.astype(np.float32) - center_mean).cumsum(axis=0)
csum -= csum[border:-border, border:-border].mean()
csum /= max(1e-3, csum[border:-border, border:-border].std())
return csum
# Stack as additional channel
images_2ch = np.zeros((N, H, W, 2), dtype=np.float32)
for i in range(N):
images_2ch[i, ..., 0] = images[i].squeeze() / 255.0
images_2ch[i, ..., 1] = add_cumsum_channel(images[i].squeeze())
axis=1 for horizontaldata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF