--- library_name: pytorch license: other pipeline_tag: image-segmentation tags: - medical-imaging - chest-xray - anycxr - segmentation --- # AnyCXR Anatomical segmentation of chest radiographs across frontal, lateral, and oblique acquisition views. This repository provides four model families, each as an inference checkpoint and a full training checkpoint: **eight checkpoint files** in total. [Project and source code](https://github.com/Advanced-AI-in-Medicine-and-Physics-Lab/AnyCXR) · [Paper](https://arxiv.org/abs/2512.17263) ## Current general-purpose model The recommended joint-view checkpoint was refreshed on **2026-11-03** with the selected model trained with 2D augmentation (selected epoch 96). It supports the same 54 channels and all nine nominal view groups. The frontal, lateral, and oblique specialist files remain available as separate models. Earlier checkpoints remain in repository history. Matching standalone inference code is now included under [runtime/](runtime/README.md). No generator or training workspace is required for inference. ```bash hf download agaresd/anychest --include "inference/all_views.pt" "runtime/*" class_names.json checkpoints.json SHA256SUMS --local-dir ./AnyCXR python -m pip install ./AnyCXR/runtime anycxr --checkpoint ./AnyCXR/inference/all_views.pt --input-path /path/to/image.png --view PA --device cuda:0 --output-dir ./seg_output ``` Use `--device cpu` for CPU inference. The command also accepts JPEG, DICOM and 2D NIfTI (`.nii`/`.nii.gz`; `SimpleITK` is required for medical-image inputs). Supply the acquisition view explicitly. See the runtime guide for normalization, orientation, native probability grid and independent-channel mask handling. ## Checkpoints | Model family | Supported nominal views | Inference | Full training | | --- | --- | --- | --- | | Frontal | AP, PA | [ap_pa.pt](inference/ap_pa.pt) | [ap_pa.pt](full/ap_pa.pt) | | Lateral | LA | [la.pt](inference/la.pt) | [la.pt](full/la.pt) | | Oblique | 22.5°, 45°, 67.5°, 112.5°, 135°, 157.5° | [ob.pt](inference/ob.pt) | [ob.pt](full/ob.pt) | | All views | AP, PA, LA and the six oblique groups | [all_views.pt](inference/all_views.pt) | [all_views.pt](full/all_views.pt) | The model architecture is ConvNeXt V2 Large with CAS-lite and AMFS, with JTR disabled. All four model families use **54 independent anatomical channels**, 384 × 384 inputs, and a native 96 × 96 output grid. Class order, normalization, supported views, artifact formats, byte sizes, and SHA-256 checksums are recorded in [class_names.json](class_names.json), [checkpoints.json](checkpoints.json), and [SHA256SUMS](SHA256SUMS). ## Download ```bash hf download agaresd/anychest --include "inference/*" checkpoints.json class_names.json SHA256SUMS --local-dir ./weights ``` To obtain full checkpoints instead, select `full/*`. An individual file can be downloaded with: ```bash hf download agaresd/anychest inference/all_views.pt --local-dir ./weights ``` ## Choosing an artifact **Inference** files contain model weights and the metadata needed to construct the matching architecture. **Full** files retain model, optimizer, learning-rate scheduler, configuration, and per-rank random-number state for further training. Full files are selected best-epoch checkpoints, rather than final last-epoch states; extending a completed phase requires an explicit new training phase or budget. The refreshed full all-view file omits private experiment configuration while retaining model, optimizer, scheduler, early-stopping, cursor and per-rank RNG states, and includes its backbone configuration. It is intended for compatible further training; it is not advertised as an exact replay of the private training workspace. These ConvNeXt V2 artifact formats differ from the legacy bundle retained at the repository root. They require matching architecture and checkpoint-loading code; they must not be passed to a loader that only supports the legacy bundle. Inference and training entry points are maintained in the linked project repository; checkpoint availability here does not by itself establish compatibility with every released CLI version. ## Acquisition views and evaluation scope Supply the acquisition view explicitly; it is not inferred automatically from the image. Lateral and oblique source groups are nominal acquisition buckets and do not establish precisely calibrated physical azimuths. The frontal checkpoint remains the selected frontal model. The joint model offers a single set of weights spanning all supported groups; it is not claimed to outperform every specialist on every view. Checkpoint selection used development evaluation. Available historical evaluation includes patient overlap/development exposure and small lateral/oblique subsets. It does not establish independent clinical segmentation performance. No source medical images or reference masks are distributed in this release. ## Legacy files The existing root-level `anychest_inference_bundle.pt` and `anychest_reference.json` remain available for the legacy inference workflow. They are separate artifacts from the eight files listed above. ## Citation Please cite the [AnyCXR preprint, arXiv:2512.17263](https://arxiv.org/abs/2512.17263).