FAQ¶
Frequently asked questions about SLEAP-NN.
General¶
What is SLEAP-NN?
SLEAP-NN is the PyTorch-based neural network backend for SLEAP. It handles training and inference for animal pose estimation models.
How is SLEAP-NN different from SLEAP?
- SLEAP (<v1.5): TensorFlow backend, GUI labeling tool
- SLEAP-NN: PyTorch backend, CLI-focused, faster training, multi-GPU support. This is currently the neural network backend for SLEAP (>=v1.5)
Can I use my existing SLEAP data?
Yes! SLEAP-NN reads .slp and .pkg.slp files created by SLEAP.
Migrating from SLEAP <=v1.4¶
Can I use my SLEAP <=v1.4 trained models?
Yes, but only UNet backbone models. Load them like any other model:
The directory should containbest_model.h5 and training_config.json.
Can I convert SLEAP config files?
Yes:
What features are new in SLEAP-NN?
- Multi-GPU training (DDP)
- Swin Transformer and ConvNeXt backbones
- ONNX/TensorRT export
- Faster augmentation (Skia backend)
- Better WandB integration
GPU & Hardware¶
SLEAP-NN uses PyTorch, so it runs on any system where PyTorch is supported. This includes NVIDIA CUDA GPUs, Apple Silicon via MPS, and AMD GPUs via ROCm (with caveats).
General Questions¶
Do I need a GPU?
GPUs significantly speed up training and inference but aren't required. CPU-only works but is much slower.
- Training: GPU strongly recommended (10-100x faster)
- Inference: GPU recommended for real-time or large-scale processing
- Labeling: CPU is fine for the labeling GUI
How much VRAM do I need?
| VRAM | Recommendation |
|---|---|
| < 6 GB | Generally insufficient; frequent out-of-memory errors |
| 8–12 GB | Minimum recommended for smooth training |
| 24–48 GB | Ideal for large models, multi-animal projects, or hyperparameter sweeps |
Tips for limited VRAM:
- Reduce batch size:
trainer_config.train_data_loader.batch_size: 2 - Scale down images:
data_config.preprocessing.scale: 0.5 - Use smaller backbones:
model_config.backbone_config.unet.filters: 16
Which GPU should I buy?
| Budget | Recommendation |
|---|---|
| Budget | RTX 3060 12GB (~$300) - Great entry point |
| Mid-range | RTX 4070 Super 12GB, RTX 4080 16GB |
| High-end | RTX 4090 24GB, RTX 5090 32GB |
| Workstation | RTX A5000 24GB, A6000 48GB |
The RTX 3060 12GB is often recommended as a cost-effective option that handles most SLEAP workloads well.
NVIDIA GPUs (Recommended)¶
Which NVIDIA GPUs are supported?
SLEAP-NN works with most NVIDIA GPUs that support CUDA. Here's our compatibility matrix:
| GPU Series | VRAM | Status | Notes |
|---|---|---|---|
| RTX 50-series (5090, 5080, etc.) | 16-32 GB | Tested ✓ | Requires CUDA 12.8+, PyTorch 2.6+ |
| RTX 40-series (4090, 4080, 4070, etc.) | 8-24 GB | Tested ✓ | Excellent performance |
| RTX 30-series (3090, 3080, 3070, 3060) | 8-24 GB | Works | Should work with standard installation |
| RTX 20-series (2080, 2070, 2060) | 6-11 GB | Works | VRAM may limit larger models |
| GTX 10-series (1080, 1070, etc.) | 4-11 GB | Limited | May need older PyTorch; limited VRAM |
| Workstation (A6000, A5000, RTX 6000) | 24-48 GB | Tested ✓ | Excellent for large-scale training |
| Data center (A100, H100) | 40-80 GB | Works | Overkill for most users |
Which CUDA version do I need?
PyTorch 2.10 supports CUDA 12.6, 12.8, and 13.0. Use --torch-backend auto to auto-detect:
For RTX 50-series (Blackwell) GPUs: You need CUDA 12.8 or higher and driver R570+. These GPUs have compute capability 10.0/12.0 which requires the latest PyTorch builds.
For older GPUs (GTX 10-series, Quadro P-series): You may need to use older PyTorch versions or export to ONNX for CPU inference, as newer PyTorch versions have dropped support for Pascal architecture (compute capability 6.x).
How do I check if my GPU is working?
This shows GPU details and runs diagnostic tests. You should see your GPU listed with CUDA support enabled.You can also verify PyTorch GPU access:
Apple Silicon (M1/M2/M3/M4)¶
Does SLEAP-NN work on Apple Silicon Macs?
Yes, SLEAP-NN works on M1/M2/M3/M4 Macs using the MPS (Metal Performance Shaders) backend.
Performance notes:
- MPS is slower than CUDA for training (expect 2-5x slower for large models)
- Inference works well for moderate workloads
- Good choice for users who don't need industrial-scale speed
- Unified memory helps avoid traditional VRAM limits
To use MPS:
Why is training slow on my Mac?
Apple Silicon MPS is not as optimized as NVIDIA CUDA for deep learning. This is expected.
Tips for better performance:
- Use smaller batch sizes (memory is shared with system)
- Consider using a smaller backbone (UNet instead of Swin Transformer)
- For production training, consider cloud GPU services (Colab, Lambda Labs, etc.)
AMD GPUs¶
Can I use an AMD GPU?
PyTorch supports AMD GPUs via ROCm on Linux, but SLEAP-NN has not been tested on AMD hardware.
If you want to try:
- ROCm is only available on Linux (not Windows or macOS)
- You'll need to install PyTorch with ROCm support manually
- Some CUDA-specific operations may not work
- We cannot provide support for ROCm-related issues
We recommend NVIDIA GPUs for the most reliable experience.
Troubleshooting¶
Out of GPU memory (CUDA OOM)
Common solutions:
- Reduce batch size:
trainer_config.train_data_loader.batch_size: 2 - Scale down images:
data_config.preprocessing.scale: 0.5 - Limit instances during inference:
--max_instances 5 - Use disk caching:
data_config.data_pipeline_fw: torch_dataset_cache_img_disk - Close other GPU applications
Check current GPU memory usage:
GPU not detected
- Verify NVIDIA drivers are installed:
nvidia-smi - Check CUDA installation:
nvcc --version - Verify PyTorch sees the GPU:
- Reinstall with correct CUDA version:
CUDA kernel not compatible with compute capability
This error means your GPU architecture isn't supported by the installed PyTorch/CUDA version.
For very new GPUs (RTX 50-series): Update to PyTorch 2.6+ with CUDA 12.8+
For older GPUs (GTX 10-series, Quadro P-series): These GPUs use Pascal architecture (compute capability 6.x) which has been dropped from newer PyTorch versions. Options:
- Use an older PyTorch version
- Export model to ONNX and run inference on CPU
- Use a newer GPU
Installation¶
Which Python version should I use?
Python 3.11, 3.12, or 3.13. Python 3.14 is not yet supported.
Training¶
How much training data do I need?
- Minimum: 50-100 labeled frames
- Good: 200-500 labeled frames
- Better: 1000+ for complex scenarios
More diverse poses and scenarios improve generalization.
How do I know when training is done?
- Enable early stopping (default)
- Watch validation loss plateau
- Use WandB for detailed monitoring
Can I resume training?
Yes:
Make suretrainer_config.seed matches the original run (default: 42) so the train/val split stays the same. A mismatched seed will produce a different split and may leak training data into validation.
How do I use multiple GPUs?
See the Multi-GPU Training Guide for detailed setup and troubleshooting.Inference¶
How do I speed up inference?
- Increase batch size:
--batch_size 8 - Use GPU:
--device cuda - Export to TensorRT:
sleap-nn export+sleap-nn predict
Models¶
Which model type should I use?
| Scenario | Model |
|---|---|
| One animal | Single Instance |
| Multiple, not touching | Top-Down |
| Multiple, overlapping | Bottom-Up |
| Known identities | Multi-Class |
Which backbone should I use?
- UNet: Most flexible, works for any resolution
- ConvNeXt: Good with pretrained weights
- Swin Transformer: Best for large images, highest memory
What is sigma in the config?
Sigma controls the Gaussian spread for confidence maps: - Larger (5-10): Easier to learn, less precise - Smaller (1-3): More precise, harder to learn
Troubleshooting¶
Training is very slow
- Enable caching:
data_config.data_pipeline_fw: torch_dataset_cache_img_memory - Reduce image size:
data_config.preprocessing.scale: 0.5 - Check GPU is being used:
sleap-nn system - See GPU & Hardware for more hardware-related troubleshooting
Poor predictions
- Check training loss - did it converge?
- Verify preprocessing matches training
- Add more training data
- See Post-Processing Filters for post-processing filters