wenmin-wu/ds-skills/bce-dice-combined-loss
Claude Code and agent skill by wenmin-wu/ds-skills
- community
Checking that the SKILL.md file is still in the repository.
Combines BCE-with-logits and soft Dice loss with configurable weights for binary and multilabel segmentation training.
Install
npx vskill@latest install wenmin-wu/ds-skills/bce-dice-combined-lossSKILL.md
The same SKILL.md was published earlier as majiayu000/claude-skill-registry-data/bce-dice-combined-loss.
BCE + Dice Combined Loss
Overview
BCE loss optimizes per-pixel accuracy but struggles with class imbalance in segmentation (background dominates). Dice loss directly optimizes the Dice coefficient (F1 score) and handles imbalance well, but has noisy gradients. Combining both gives stable training from BCE while pushing toward high Dice overlap. This is the standard loss for medical image segmentation tasks.
Quick Start
Workflow
- Compute BCE with logits loss (handles numerical stability internally)
- Compute soft Dice loss from sigmoid probabilities
- Combine with configurable weights (default 1:1)
- Backpropagate the combined loss
Key Decisions
- Weight ratio: 1:1 is standard; increase Dice weight (e.g., 1:2) if IoU/Dice metric matters more
- Smooth factor: 1.0 prevents division by zero; lower (0.01) for sharper gradients
- Multilabel: Apply per-channel, then average across classes
- vs Focal + Dice: Use Focal instead of BCE when many easy negatives dominate
- vs Lovasz: Lovasz loss directly optimizes IoU but is slower; combine with BCE similarly
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cv/bce-dice-combined-loss/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 4
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/wenmin-wu/ds-skills/bce-dice-combined-loss)