wenmin-wu/ds-skills/2d-to-3d-model-conversion
Claude Code and agent skill by wenmin-wu/ds-skills
- community
Checking that the SKILL.md file is still in the repository.
Converts a pretrained 2D CNN into a 3D CNN by recursively replacing Conv2d/BN2d/Pool2d layers and inflating kernel weights along the depth axis.
Install
npx vskill@latest install wenmin-wu/ds-skills/2d-to-3d-model-conversionSKILL.md
2D to 3D Model Conversion
Overview
Pretrained 3D CNNs are scarce, but pretrained 2D models (ImageNet) are abundant. This technique recursively walks a 2D model, replaces Conv2d with Conv3d, BatchNorm2d with BatchNorm3d, and pooling layers with their 3D counterparts. Crucially, 2D kernel weights are inflated by repeating along the new depth dimension, preserving learned spatial features. This gives 3D volumetric models (CT, MRI) a strong initialization without training from scratch.
Quick Start
Workflow
- Load a pretrained 2D model (ResNet, EfficientNet, etc.)
- Call
convert_3d(model)to recursively replace all 2D layers with 3D equivalents - Inflate Conv2d weights by repeating along the kernel depth dimension
- Attach a new classification/segmentation head for your 3D task
- Fine-tune on volumetric data (CT scans, MRI volumes)
Key Decisions
- Weight inflation: Repeating weights along depth preserves spatial features; averaging is an alternative
- Input channels: First conv may need adjustment if input has 1 channel (grayscale CT) vs 3 (RGB)
- Pooling: AdaptiveAvgPool2d must also be converted to AdaptiveAvgPool3d
- When to use: Medical imaging (CT, MRI), video classification, any 3D volumetric task
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/2d-to-3d-model-conversion/SKILL.md
Popularity
- 7-day trend score
- 0
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/2d-to-3d-model-conversion)