Cumulative Sum Channel
SkillMediaAdd a cumulative sum channel along the vertical axis to capture directional structural trends in grayscale images for segmentation
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Cumulative Sum Channel skill
What this skill tells your AI
The instructions your AI receives, as published by wenmin-wu/ds-skills in skills/cv/cumulative-sum-channel/SKILL.md and read by ahel’s review.
Overview
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.
Quick Start
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())
Workflow
- Compute center-region mean of grayscale image (exclude border pixels)
- Subtract mean and compute cumulative sum along vertical axis
- Re-center and normalize by center-region standard deviation
- Stack as additional input channel alongside the original image
Key Decisions
- Border exclusion: ignores edge artifacts when computing statistics
- Vertical axis: captures top-to-bottom structure; use
axis=1for horizontal - Normalization: prevents cumsum values from dominating pixel values in the network
- When useful: seismic data, depth profiles, cross-section images — any domain with vertical gradients
References
Signals
- GitHub stars
- 60
- Forks
- 4
- Last commit
- Apr 2026
Advanced
- Catalog kind
- skill
- Gateway key
cv-cumulative-sum-channel- Source
- github.com/wenmin-wu/ds-skills