For overview about NemaSize, see ../README.md#overview-of-nemasize.
This guide is for end users. You do not need to install Python, CUDA, PyTorch, or any other dependencies. Only Docker is needed.
- System requirements
- Pre-flight checklist
- Install Docker
- (GPU users only) Verify GPU access
- Pull the NemaSize image
- Prepare your data
- Run the pipeline
- Understand the outputs
- Updating to new versions
- Troubleshooting
- FAQ
- Reporting issues
| Requirement | Value |
|---|---|
| OS | Windows 10/11, macOS 11+, or Linux (kernel 4.x+) |
| RAM | 8 GB (16 GB recommended for large datasets) |
| Disk | 5 GB free (image + outputs) |
| Internet | Required once for image download (~0.9 GB) |
| GPU | Not required |
| Requirement | Value |
|---|---|
| GPU | NVIDIA GPU with ≥4 GB VRAM (8 GB recommended) |
| Driver | NVIDIA driver ≥ 525.x (any driver from 2023 onward supports CUDA 12.1) |
| Disk | 12 GB free (image is ~9.2 GB) |
| Internet | Required once for image download (~4 GB) |
Apple Silicon Macs (M1/M2/M3): the CPU image works but runs through Rosetta emulation (≈2× slower than a native amd64 CPU). The GPU image is NVIDIA-only; no Mac Metal/MPS support.
Before installing, verify the following on your machine. Each is a one-line command — run them in order.
# 1. Confirm 64-bit Windows 10/11
[System.Environment]::OSVersion.Version
[System.Environment]::Is64BitOperatingSystem # must print: True
# 2. Confirm virtualization is enabled (required for Docker Desktop)
Get-ComputerInfo -Property "HyperVRequirementVirtualizationFirmwareEnabled"
# Expect: True. If False, enable VT-x / AMD-V in BIOS.
# 3. (GPU users) Confirm NVIDIA driver
nvidia-smi
# Expect: a table showing your GPU, driver version, and (top-right)
# the maximum supported CUDA version. That number must be ≥ 12.1.
# If "command not found" or version is too old, see "Installing or
# updating the NVIDIA driver" below.# 1. Confirm OS version (need 11+)
sw_vers
# 2. Confirm chip type
uname -m # x86_64 (Intel) or arm64 (Apple Silicon)# 1. Confirm kernel + distro
uname -r ; cat /etc/os-release | head -3
# 2. Confirm 64-bit
uname -m # must be x86_64
# 3. (GPU users) Confirm NVIDIA driver
nvidia-smiIf any check fails, fix it before proceeding.
The GPU image targets CUDA 12.1, which requires NVIDIA driver version ≥ 525.60.13 (Linux) or ≥ 528.33 (Windows). Any driver released from early 2023 onward will work; newer drivers are backward-compatible. You do NOT need to install the CUDA Toolkit on the host — only the driver. CUDA itself ships inside the Docker image.
How to read nvidia-smi: the top-right cell shows the maximum CUDA
version your driver supports. As long as that number is ≥ 12.1,
you're fine — even if it says 12.4, 13.x, etc.
- Identify your GPU (Start → Device Manager → Display adapters), or run:
Get-CimInstance Win32_VideoController | Select-Object Name, DriverVersion
- Download the Game Ready or Studio driver from
https://www.nvidia.com/Download/index.aspx:
- Product Type: GeForce / RTX / Quadro / Tesla (whichever matches)
- Operating System: Windows 11 64-bit (or Windows 10 64-bit)
- Download Type: Studio Driver (more stable) or Game Ready Driver
- Run the installer (accept the default "Express" install).
- Restart Windows.
- Re-run
nvidia-smi— it should now print the driver table.
Tip: if you already have GeForce Experience or NVIDIA App installed, just open it → Drivers tab → Check for updates.
# Easiest: use the distro-managed driver (works for most users)
sudo apt-get update
ubuntu-drivers devices # see what's recommended
sudo ubuntu-drivers autoinstall # install the recommended driver
sudo reboot
nvidia-smi # verify after rebootIf ubuntu-drivers isn't available (Debian, RHEL, etc.), follow NVIDIA's
official guide for your distro:
https://www.nvidia.com/en-us/drivers/unix/
Use the official NVIDIA CUDA repository (driver only): https://developer.nvidia.com/cuda-downloads → choose your distro → follow the "driver" install path (skip the toolkit).
NVIDIA drivers are not supported on macOS — Apple removed CUDA
compatibility in 2018. Use the CPU image (zihaojohnli/nemasize:cpu)
instead.
That's a separate issue (NVIDIA Container Toolkit / Docker Desktop GPU support), not a driver problem — see Section 4.
- Download Docker Desktop from https://www.docker.com/products/docker-desktop/
- Run the installer (accept defaults — WSL2 backend on Windows).
- Restart your computer if prompted.
- Launch Docker Desktop. Wait for the whale icon in the system tray to turn solid (~30 s).
sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl enable --now docker
sudo usermod -aG docker $USER # so you can run docker without sudo
# Log out and back in for the group change to take effectdocker --version
docker run --rm hello-worldYou should see a "Hello from Docker!" message. If yes, proceed.
The container needs to see your GPU through Docker's NVIDIA runtime.
Docker Desktop ≥ 4.27 includes NVIDIA Container Toolkit support natively. Just verify:
docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smiYou should see the same GPU table that nvidia-smi prints on the host.
You must install the NVIDIA Container Toolkit separately:
distribution=$(. /etc/os-release; echo $ID$VERSION_ID)
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smiIf the GPU shows up inside the test container, you're ready.
| Tag | Size (download / disk) | Use when |
|---|---|---|
zihaojohnli/nemasize:cpu |
~0.9 GB / ~2.5 GB | No GPU, or just trying things out |
zihaojohnli/nemasize:gpu |
~4 GB / ~9.2 GB | NVIDIA GPU available; 5–20× faster |
zihaojohnli/nemasize:1.0.0-cpu |
same as :cpu |
Reproducibility — pin this exact build |
zihaojohnli/nemasize:1.0.0-gpu |
same as :gpu |
Reproducibility — pin this exact build |
zihaojohnli/nemasize:latest |
same as :cpu |
Default; equivalent to :cpu |
For published research, ALWAYS use a versioned tag (e.g.
1.0.0-cpu) so your analysis is reproducible. The moving tags (:cpu,:gpu,:latest) will change when new builds are pushed.
docker pull zihaojohnli/nemasize:cpu # CPU users
# OR
docker pull zihaojohnli/nemasize:gpu # GPU usersThis is a one-time download. Verify:
docker images zihaojohnli/nemasizeThe pipeline expects a single project folder with raw images in a
raw_images/ subdirectory:
my_experiment/
└── raw_images/
├── plate_001.tif
├── plate_002.tif
├── plate_003.tif
└── ...
Supported image formats: .tif, .tiff, .png, .jpg, .jpeg
(case-insensitive).
Image content expectations:
- One well per image with square aspect ratio
- The detector was trained at ~2× magnification; very different magnifications may need a custom-trained model
You do NOT need to:
- Pre-process, normalize, or convert image formats
- Create empty output folders (the pipeline creates them)
- Sort or rename files
The container reads from / writes to the project folder via a "bind mount"
(-v <host>:<container>). Outputs land directly back on your disk.
Linux / macOS:
docker run --rm \
-v "$(pwd)/my_experiment:/data" \
zihaojohnli/nemasize:cpu \
/dataWindows (PowerShell):
docker run --rm `
-v "${PWD}\my_experiment:/data" `
zihaojohnli/nemasize:cpu `
/dataWindows (cmd.exe):
docker run --rm -v "%cd%\my_experiment:/data" zihaojohnli/nemasize:cpu /dataAdd --gpus all and use the :gpu tag:
docker run --rm --gpus all \
-v "$(pwd)/my_experiment:/data" \
zihaojohnli/nemasize:gpu \
/data| Flag | Meaning |
|---|---|
--rm |
Remove the container automatically when it exits (image stays). |
-v HOST:/data |
Mount your project folder into the container at /data. |
--gpus all |
Make all NVIDIA GPUs visible inside the container. |
zihaojohnli/nemasize:cpu |
The image to run. |
/data |
The argument passed to the pipeline (project root). |
The container prints a tqdm progress bar for each stage. Output is
streamed live (line-buffered), so you can monitor it directly.
Press Ctrl+C. The container shuts down cleanly; partial output stays on
disk and can be inspected.
After a successful run, your project folder will look like:
my_experiment/
├── raw_images/ (unchanged input)
├── inference_rois/
│ ├── images/ (cropped per-worm ROIs, .png)
│ └── roi_catalog.json (ROI geometry for mapping back to full-well images)
└── NemaSize_output/
└── skeleton/
├── worm_sizes.csv ★ main results table
└── contour_skeleton_txt/
└── <image>_roi_<n>.txt per-worm contour + skeleton coords
See ../README.md §5. Outputs for the full output
schema (worm_sizes.csv columns, the .txt contour/skeleton format,
roi_catalog.json, and visual QC options).
When a new version is released:
docker pull zihaojohnli/nemasize:cpu # or :gpuDocker downloads only changed layers, so updates are usually small (tens of MB) unless model weights or CUDA were updated.
To roll back to a specific version:
docker pull zihaojohnli/nemasize:1.0.0-cpu
docker run --rm -v "$(pwd)/my_experiment:/data" \
zihaojohnli/nemasize:1.0.0-cpu /dataDocker Desktop isn't running. Launch it and wait for the whale icon to turn solid.
Container writes as root by default. Use:
docker run --rm --user $(id -u):$(id -g) -v "$(pwd)/my_experiment:/data" \
zihaojohnli/nemasize:cpu /data- Windows: update Docker Desktop and your NVIDIA driver, then restart.
- Linux: install nvidia-container-toolkit (Section 4).
Your bind mount is wrong. The folder you mount must contain a
raw_images/ subdirectory. Run ls /path/to/my_experiment and confirm
it's there.
The path in your -v flag has unquoted spaces or backslashes. Wrap the
whole path in double quotes as shown in Section 7.
Your GPU has less VRAM than the model needs (~2 GB combined). Use the CPU image instead, or upgrade the GPU.
- Confirm input images contain C. elegans worms at roughly the magnification expected by the model.
- Open a few
inference_rois/images/*.pngfiles — do they show individual centered worms? If not, the detector misfired. - Spot-check
worm_sizes.csv— areLength_umvalues in a plausible range (adult worms are typically ~1000µm)? Implausible values usually mean the segmentation collapsed or merged multiple worms. - Report unusual cases to the maintainer (Section 12).
Docker Hub may rate-limit anonymous pulls. Run docker login with a free
Docker Hub account; signed-in pulls are faster and have higher quotas.
You're on Apple Silicon (arm64). The image will still run via emulation — this is just an informational warning, not an error.
Q: Do I need to install Python, CUDA, PyTorch? A: No. Everything is inside the container.
Q: Can I run multiple experiments in parallel?
A: Yes. Each docker run is isolated. Use different host folders for each
run. On a single GPU, only one container can use it at full speed at once.
Q: Are my images uploaded anywhere? A: No. The container has no network access to your data. All processing happens locally on your machine; only the image download uses the internet (one time).
Q: Can I use my own trained models instead of the bundled ones? A: Yes — override them at runtime:
docker run --rm \
-v "$(pwd)/my_experiment:/data" \
-v "$(pwd)/my_models:/models" \
zihaojohnli/nemasize:cpu \
/data --detect-model /models/my_detect.pt --seg-model /models/my_seg.ptQ: How do I cite NemaSize? A: See ../README.md#citation for the citation and BibTeX/DOI details.
Q: Does it work on Singularity / Apptainer (HPC clusters)? A: Yes. Convert with:
singularity pull nemasize_cpu.sif docker://zihaojohnli/nemasize:cpu
singularity run --bind /path/to/my_experiment:/data nemasize_cpu.sif /dataQ: Can I use this with Nextflow / Snakemake?
A: Yes. The image includes procps for process metric collection. Example
Nextflow process:
process NEMASIZE {
container 'zihaojohnli/nemasize:cpu'
input:
path project_dir
output:
path "${project_dir}/NemaSize_output/skeleton/*.csv"
script:
"/opt/nemasize/run_pipeline.py ${project_dir}"
}When something doesn't work, please collect and send:
- Image tag you ran: e.g.
zihaojohnli/nemasize:1.0.0-cpu - Full error output from your terminal
- Output of:
docker --version docker info | grep -E "Server Version|Operating System|Architecture" docker image inspect zihaojohnli/nemasize:cpu --format "{{.Id}} {{.Os}}/{{.Architecture}}"
- A small example dataset that reproduces the problem (1–3 images are usually enough), or a description of the input characteristics.
Send to Zihao (John) Li lizihaojohn@outlook.com (cc Erik C. Andersen erik.andersen@gmail.com).
Last updated: July 2026 · Version 1.0.0