Skip to content

Getting started

This page walks you from an empty environment to a first PCA plot of your own images.

  • Python 3.12 or newer.
  • Hardware: any CPU works; an NVIDIA GPU is strongly recommended for speed. See Best practices - performance for sizing.
  • OS: Linux, macOS, Windows.

Install the published package with pip.

Terminal window
pip install phenome

PyTorch and the Jupyter packages used by the notebooks are included. Pass device to speed up the computation using the GPU.

phenome[full] adds TorchDR and PyKeOps for large GPU analyses. Turn GPU dimensionality reduction on with PhenoMe(..., use_gpu_for_dr=True). It does not move embeddings onto the GPU by itself:

Terminal window
pip install "phenome[full]"

Verify:

Terminal window
python3 -c '
import torch, phenome
print(f"PhenoMe {phenome.__version__} is ready!")
print("GPU:", torch.cuda.is_available(),
f"({torch.cuda.get_device_name(0)})" if torch.cuda.is_available() else "(CPU-only mode)")
'
Install troubleshooting (click to expand)
Symptom Suggestion
torch not found or wrong CUDA Reinstall torch from PyTorch get started; match driver and wheel.
Import works but GPU not used import torch; print(torch.cuda.is_available()); ensure device is passed into PhenoMe(...).

More in the FAQ - installation.

Regenerating the figures in the paper uses a separate environment. See Paper reproducibility.

The snippet below runs the full pipeline on a folder of images. You can run this in a Python script or a Jupyter Notebook cell.

  1. Set up and start

    Load an AI vision model (DINOv2 by default) and create the pipeline.

    import torch
    from phenome import PhenoMe, load_dinov2_model
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    wrapper = load_dinov2_model(model_name="dinov2_vitb14_reg", device=device)
    pheno = PhenoMe(device=device)
  2. Find your images

    A simple folder is fine. For grouped experiments (conditions, drugs, time points) add labels via folder patterns or spreadsheets.

    pheno.find_files("path/to/your/images")
  3. Extract embeddings (AI descriptions) and properties

    pheno.process_images(wrapper)
    pheno.compute_properties(property_preset="intensity")
  4. Visualize your results

    pheno.plot_pca()

    To color points, pass a key from pheno.get_available_metadata_keys(). For example, after a folder pattern or spreadsheet created condition, call pheno.plot_pca(color_by="condition"). Add seed=42 to PhenoMe only when you want a reproducible run.

Pick the card that matches your next goal. Each links to the most relevant guide, reference, or notebook - no duplicates of the quickstart above.