skills/cv/multichannel-to-rgb-adaptation/SKILL.md
Composites multi-channel imagery (microscopy, satellite) into 3-channel RGB for pretrained CNN backbones.
npx skillsauth add wenmin-wu/ds-skills cv-multichannel-to-rgb-adaptationInstall 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.
Pretrained ImageNet backbones expect 3-channel RGB input. When working with multi-channel data (fluorescence microscopy, satellite multispectral, medical imaging), composite or select channels into a 3-channel image. Handles bit-depth normalization (16-bit to 8-bit) and channel selection strategy.
import cv2
import numpy as np
def multichannel_to_rgb(channels, bit_depth=16):
"""Composite multi-channel images to 3-channel RGB.
Args:
channels: dict of {"red": array, "green": array, "blue": array, ...}
bit_depth: source bit depth (8 or 16)
"""
r = channels["red"]
g = channels["green"]
b = channels["blue"]
if bit_depth == 16:
r = (r / 256).astype(np.uint8)
g = (g / 256).astype(np.uint8)
b = (b / 256).astype(np.uint8)
return np.dstack([r, g, b])
def load_hpa_rgby(image_dir, image_id):
"""Load HPA-style RGBY channels into RGB."""
colors = ["red", "green", "blue", "yellow"]
channels = {}
for c in colors:
path = f"{image_dir}/{image_id}_{c}.png"
channels[c] = cv2.imread(path, cv2.IMREAD_UNCHANGED)
# Option: blend yellow into red+green
return multichannel_to_rgb(channels, bit_depth=16)
data-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