Get PyTorch Connectomics running in 5 minutes! 🚀
- Install PyTorch Connectomics (2-3 minutes)
- Run a demo to verify installation (30 seconds)
- Try a tutorial with real data (optional)
curl -fsSL https://raw.githubusercontent.com/zudi-lin/pytorch_connectomics/v2.0/quickstart.sh | bashThat's it! The script will:
- ✅ Install conda (if needed)
- ✅ Detect your CUDA version
- ✅ Install PyTorch + PyTorch Connectomics
- ✅ Verify installation
Time: 2-3 minutes
# Clone repository
git clone https://github.com/zudi-lin/pytorch_connectomics.git
cd pytorch_connectomics
# Run installer
python install.py
# Activate environment
conda activate pytcTime: 2-3 minutes
# Create conda environment
conda create -n pytc python=3.10 -y
conda activate pytc
# Install pre-built packages (avoids compilation)
conda install -c conda-forge numpy=1.23 h5py cython connected-components-3d mahotas -y
# Install PyTorch (adjust for your CUDA version)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
# Install PyTorch Connectomics
git clone https://github.com/zudi-lin/pytorch_connectomics.git
cd pytorch_connectomics
pip install -e . --no-build-isolationTime: 3-5 minutes
conda activate pytc
python scripts/main.py --demoThis creates synthetic data and trains a small model for 5 epochs. If this works, your installation is successful! ✅
Expected output:
🎯 PyTorch Connectomics Demo Mode
...
✅ DEMO COMPLETED SUCCESSFULLY!
Your installation is working correctly! 🎉
The Lucchi++ dataset contains mitochondria segmentation data from EM images.
# Download from HuggingFace (recommended)
mkdir -p datasets/
wget https://huggingface.co/datasets/pytc/tutorial/resolve/main/lucchi%2B%2B.zip
unzip lucchi++.zip -d datasets/
rm lucchi++.zipSize: ~100 MB
# Quick test (1 batch, ~30 seconds)
python scripts/main.py --config tutorials/monai_lucchi++.yaml --fast-dev-run
# Full training (~2 hours on GPU)
python scripts/main.py --config tutorials/monai_lucchi++.yaml# Launch TensorBoard (in a separate terminal)
tensorboard --logdir outputs/lucchi++_monai_unet
# Open browser to http://localhost:6006Solution:
conda activate pytc
pip install -e . --no-build-isolationSolution: Reduce batch size in config:
python scripts/main.py --config tutorials/lucchi.yaml data.dataloader.batch_size=1Solution 1: Install CPU-only version:
python install.py --cpu-onlySolution 2: Load CUDA module (HPC clusters):
module load cuda/12.1
python install.py --cuda 12.1- 📚 Full Documentation: connectomics.readthedocs.io
- 📖 Developer Guide: .claude/CLAUDE.md
- 🎯 More Tutorials: See
tutorials/directory
- 💬 Slack Community: Join here
- 🐛 Report Issues: GitHub Issues
- 📧 Email: See README for contact info
Train on your own data:
# Create a config file (e.g., my_config.yaml)
# See tutorials/*.yaml for examples
python scripts/main.py --config my_config.yamlUse different models:
# In your config file:
model:
architecture: mednext # Try MedNeXt (state-of-the-art)
mednext_size: S # S, B, M, or L
deep_supervision: trueDistributed training:
system:
training:
num_gpus: 4 # Automatically uses DDP- Start small: Use
--fast-dev-runto test configs quickly - Monitor training: Always use TensorBoard to watch loss curves
- GPU memory: Start with small batch sizes, increase gradually
- Ask questions: Join our Slack community - we're friendly! 😊
Now that you're set up, explore:
- Different architectures: MONAI models, MedNeXt
- Advanced features: Mixed precision, deep supervision
- Custom data: HDF5, TIFF, Zarr formats
- Deployment: Docker/Singularity containers
Happy segmenting! 🔬🧠