Skip to content

Add MorphEm inference wrapper - #188

Open
helia77 wants to merge 8 commits into
mainfrom
feature/morphem_inference
Open

helia77 wants to merge 8 commits into
mainfrom
feature/morphem_inference

Conversation

@helia77

@helia77 helia77 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What this does

Adds the MorphEm algorithm in Bilayers: a self-supervised ViT-Small feature extractor for single-cell microscopy images (CHAMMI benchmark).

Includes:

  • Dockerfile: multi-stage build, pixi env (Python 3.11 CPU). MorphEm weights baked into the image.
  • morphem_inference.py: CLI wrapper. One file = one object; Requires to input extra info:
    • --concatenated: whether the image is a horizontal CHAMMI-75 (H, W*C) strip.
    • --num_channels: number of image channels.
      each object split into num_channels planes. Applies the model card's preprocessing, runs each channel through in batch_size chunks, and writes a feature table (O objects × num_channels·384) as .pkl or .csv.
  • config.yaml: Bilayers config describing I/O and params (--num_channels, --batch_size, --concatenated, --output_format) for the UI and CLI, matching the schema.
  • pixi.toml + pixi.lock: define and pin the environment (Python 3.11, pytorch-cpu, etc.).

Notes

  1. Python/pip shims added so calls dispatch into the pixi env, addressing the SHELL-in-pixi-images issue (SHELL in pixi-based images needs docker format #182).
  2. compileall regex skips 3.12+ intrinsics files (py31x_intrinsics.py) that a Python 3.11 interpreter can't byte-compile.
  3. Pinned fastapi==0.112.2 / starlette==0.38.2 alongside the Gradio 4.44.1 helper libs in Gradio.Dockerfile.
  4. CPU-only for now (TODO: Add GPU support).

@helia77
helia77 requested a review from gnodar01 July 27, 2026 19:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant