cnn3d

Trains a compact residual 3D CNN for voxel-level classification and regression on volumetric neuroimaging data.

89|5|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill cnn3d-cuhk-aim-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cnn3d
Source: https://github.com/CUHK-AIM-Group/NeuroDiscovery/tree/main/skills/cnn3d
Command: npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill cnn3d-cuhk-aim-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, torch, scikit-learn, pandas, and includes scripts (resource) components.

What problem does it solve? Applying deep learning to whole-brain MRI volumes requires a well-defined model, a strict input contract, and reproducible cross-validated training. This Skill provides a canonical compact residual 3D CNN (VoxelCNN3D) with a fixed NPZ input format and checkpointing so voxel-level classification and regression experiments run consistently. ## Core Features & Use Cases - Voxel-level classification and regression: Train a residual 3D CNN on structural MRI, fMRI summaries, statistical maps, or other aligned volumetric data. - Cross-validated training with provenance: Produces predictions.csv, fold_assignments.csv, metrics.json, per-fold checkpoints, and run manifests for reproducibility. - Strict input contract: Accepts a single .npz file with X [subjects, channels, depth, height, width], y, and optional subject_id, enforcing consistent orientation, voxel size, and normalization. - Use Case: A researcher with skull-stripped, normalized sMRI volumes for 200 subjects wants to classify diagnosis groups; they package the volumes into an NPZ and run the reference training script with 5-fold cross-validation on a CUDA device. ## Quick Start Ask the AI to train the cnn3d model on your prepared volumes.npz file for classification with 5-fold cross-validation and save outputs to a run directory.

Frequently Asked Questions about cnn3d

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train a 3D CNN on MRI volumes for classification?

Package your volumes into an NPZ file with X shaped [subjects, channels, depth, height, width] and labels y, then run the train_reference.py script with --task classification, --folds 5, and --device cuda. Outputs include predictions.csv, metrics.json, and per-fold checkpoints.

What input format does a 3D CNN for neuroimaging expect?

This model expects a single .npz file containing X as a float array [subjects, channels, depth, height, width], y as a label array, and an optional subject_id array. All subjects must share the same orientation, voxel size, grid, crop, and intensity normalization.

Can a 3D CNN do regression on brain imaging data?

Yes, the same VoxelCNN3D model supports regression by passing --task regression to the training script. Typical settings use more base channels, around 100 epochs, a learning rate of 0.0003, and weight decay of 0.0001.

When should I use NeuroSTORM instead of a compact 3D CNN?

Use NeuroSTORM when the request explicitly targets NeuroSTORM, SwiFT, or the upstream multi-model fMRI platform, since it is a separate model skill with its own external repository. The cnn3d skill covers single-model voxel-level classification and regression on aligned volumes.

Why must preprocessing be frozen before cross-validation in neuroimaging?

Site harmonization, augmentation, and intensity transforms must not use held-out subjects, otherwise information leaks across folds and inflates metrics. Freeze all preprocessing before splitting so fold assignments remain unbiased.