How epics-lab/untrained-cnn works
un-CNN is a Python library that converts structural MRI scans into fixed-length feature vectors using a randomly initialized, untrained 3D CNN. The principal workflow loads and resizes each NIfTI scan, constructs one of two three-channel preprocessing variants, batches scans, and runs the frozen model to produce a NumPy feature matrix for downstream analysis. The README also documents preprocessing with TurboPrep and experimental architecture evaluation; the implementation details for those notebook experiments were not sampled.
Main entry points: uncnn.py Dataset and loader · Untrained CNN Project.ipynb Architecture experiments
Components 14
MRI preprocessing
- Load and resize
uncnn.py - Robust channels
uncnn.py - Rank-Sobel channels
uncnn.py
Feature extraction
- extract_features
uncnn.py - Dataset and loader
uncnn.py - load_model
uncnn.py - UnCNN
uncnn.py - Feature matrix
uncnn.py
Research evaluation
- Architecture experiments
Untrained CNN Project.ipynb - Random Forest evaluation
Other components
- Library user
- MRI scans
- TurboPrep
- Downstream ML
Connections 16
- Library user → extract_features: calls
- MRI scans → Load and resize: loads
- TurboPrep → MRI scans: preprocesses
- extract_features → Dataset and loader: creates
- Dataset and loader → Robust channels: selects config
- Dataset and loader → Rank-Sobel channels: selects config
- Robust channels → Load and resize: loads volume
- Rank-Sobel channels → Load and resize: loads volume
- Dataset and loader → load_model: loads if needed
- Dataset and loader → UnCNN: batches inputs
- load_model → UnCNN: initializes
- UnCNN → Feature matrix: extracts features
- extract_features → Feature matrix: returns matrix
- Feature matrix → Downstream ML: provides features
- Architecture experiments → Random Forest evaluation: evaluates designs
- Random Forest evaluation → Downstream ML: uses models