VictorButoi / FleXray
git clone https://github.com/VictorButoi/FleXray.git
v1.0.2 · 28d ago
FleXray: Universal Clinical X-ray Segmentation
—
stars, 24h
—
stars, 7 days
+104
stars, 30 days · #2,205
104
★ total
17
forks · 1 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguagePython
LicenseMIT
Created2026-09-22 (28d ago)
Last push27d ago
Watchers4
OwnerUser
GitHub topics
Links
- GitHub: github.com/VictorButoi/FleXray
- Homepage: https://flexray.csail.mit.edu/
- Releases · Issues · Hacker News mentions
README excerpt
# FleXray: Universal Clinical X-ray Segmentation 💪 ### Paper · Project Page Victor Ion Butoi, Vivek Gopalakrishnan, John V. Guttag, Adrian V. Dalca, Neel Dey FleXray (pip package `flexray`, imported as `fxr`) is a command-line tool and Python package for segmenting anatomy in X-ray images. The quickest path is to install the package, run `flexify` on an image or folder of images, and inspect the saved NumPy arrays. FleXray can also train new full-body X-ray segmentation models. Training combines **2D X-ray segmentation data** (including generated/FluXray samples) with **CT segmentation volumes rendered to DRRs** during training. ## What FleXray Does FleXray is a segmentation model that outputs anatomical segmentations for arbitrary X-rays in common image formats such as PNG, JPEG, TIFF, and BMP, plus DICOM (`pip install flexray[dicom]`). The pretrained weights live on our Hugging Face page, `VictorButoi/flexray`. For every input image, FleXray writes three `.npy` arrays: - Thresholded segmentation masks for each anatomical label. - Per-channel probabilities that show model confidence. - Raw logits for developers who need the unprocessed model scores. It also writes one `label_names.json` naming those channels in order. ## Install FleXray FleXray targets Python 3.10+. The PyPI package name is `flexray` (the import package is `fxr`) and the default install is inference-focused: [code] ## Predict From The Command Line From the terminal, run prediction at one of four quality levels. These are the same Low / Normal / High / X-High modes as the browser demo: [code] `--input` also accepts a directory, in which case every supported image in it is predicted. `--model-id` defaults to `VictorButoi/flexray`, one Hugging Face repository that holds the flagship and its four ensemble members under `members/` (listed in its `ensemble.json`). Pass `--subfolder` to run one member on its own, `--revision` to pin a repository commit, or repeat `--model-id` to average bundles from several repositories: [code] By default, every model label is written. Pass `--binary LABEL` to restrict the output to one anatomical label, for example `--binary femurs`. Masks use `--threshold 0.5` by default. For more documentation around command-line usage, see `docs/inference.md`. ## Understand The Output Files For an input named `image.png`, `flexify` writes: - `image_masks.npy`: thresholded segmentation masks. These are `uint8` arrays where each channel is a predicted anatomical mask. - `image_probabilities.npy`: model confidence per channel. These are `float32` arrays with values after the selected probability conversion mode. - `image_logits.npy`: raw model scores before probability conversion. These are mostly useful for developers and debugging. All three arrays are channel-first with shape `CxHxW`, where `C` is the number of model output labels and `H`/`W` come from the bundle's preprocessing size. With `--binary LABEL`, `C` is 1. The CLI writes `.npy` arrays and does n