--- license: agpl-3.0 library_name: monai pipeline_tag: image-segmentation tags: - pytorch - unet - 3d-segmentation - microscopy - light-sheet-microscopy - neuroscience - axon-segmentation - synthetic-data - domain-randomization metrics: - dice --- # AxonSynth Pretrained three-class 3D U-Net for axon segmentation in light-sheet microscopy, trained on domain-randomized synthetic images. **Code, environment, and documentation:** [github.com/lincbrain/axonsynth](https://github.com/lincbrain/axonsynth) ## Model - **Architecture:** MONAI 3D U-Net, approximately 4.8 million parameters. - **Classes:** background, axon shell, and axon interior. - **Training patches:** 128 × 128 × 128 voxels at 0.8 µm isotropic resolution. - **Checkpoint:** `best_model.pt`, the main three-class model selected at epoch 136. Binary axon foreground probability is calculated by summing the shell and interior probabilities. ## Download Using the Hugging Face CLI: ```bash hf download edziocodes/axonsynth best_model.pt --local-dir weights ``` ## Run inference Clone the [code repository](https://github.com/lincbrain/axonsynth) and create its environment: ```bash conda env create -f environment.yml conda activate axonsynth ``` From the code repository root, run inference on a volume prepared at **0.8 µm isotropic resolution in model axis order**. See the repository README for preparation instructions. ```bash python inference/infer_lsm.py \ --input prepared_0p8um.nii.gz \ --checkpoint weights/best_model.pt \ --output-dir predictions \ --segmentation-mode three_class_shell_interior \ --stitch-device cpu \ --output-profile binary_focused \ --threshold 0.5 \ --require-cuda ``` This command saves the normalized input, foreground probability, binary mask, and inference settings. The threshold is configurable. ## Evaluation To compare a prediction against a dense ground-truth volume of the same shape, run from the code repository root: ```bash python tools/evaluate_lsm_case.py \ --predictions-dir predictions \ --prefix prepared_0p8um \ --gt-path ground_truth.nii.gz \ --threshold 0.5 ``` This writes `metrics.json`, `summary.txt`, and true-positive/false-positive/false-negative overlay images to `evaluation/`. The underlying reusable metric functions are in [`paper_analysis/metrics.py`](https://github.com/lincbrain/axonsynth/blob/main/paper_analysis/metrics.py). ## License This model checkpoint is released under the **GNU Affero General Public License v3.0 (AGPL-3.0)**. See [LICENSE](LICENSE) for the full terms. The source code is available in the [AxonSynth GitHub repository](https://github.com/lincbrain/axonsynth) under the same license.