--- license: apache-2.0 library_name: onnx tags: [medical-imaging, ct, segmentation, totalsegmentator, nnunet, webgpu, onnxruntime-web] --- # TotalSegmentator `total` (3 mm and 1.5 mm organs), ONNX rewritten for WebGPU Weights of **TotalSegmentator** (Wasserthal J, et al. *TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images.* Radiol Artif Intell. 2023;5(5):e230024; https://github.com/wasserth/TotalSegmentator, Apache-2.0), taken from the ONNX export **TS-Portable** (https://huggingface.co/sigjhl/ts-portable, revision `6f2de64246c72c2078d84a54567cfe19c8120562`, `fp32/`, Apache-2.0). This repository redistributes them under the same licence with the graph rewritten so that ONNX Runtime Web's WebGPU execution provider runs them fast. Weights are unchanged except for reordering. Used by the image station of Nuclear Medicine Explained (https://nuclearmedicineexplained.com), where the CT is segmented entirely in the user's browser and never uploaded. **For research and education only. Not a medical device.** ## Changes (script: `araclar/yardimci/onnx_convtranspose_webgpu.py --conv2d --bas`) 1. `ConvTranspose` (kernel = stride = 2, no padding) → `MatMul` + reshape/transpose (non-overlapping 3D depth-to-space). 2. 3D `Conv` → one 2D `Conv` over depth slices concatenated along channels (onnxruntime-web 1.31 runs 3D conv with a naive kernel). 3. Output head: `Softmax` over classes, then the probabilities of the classes listed in input `secili` (int64), the background, and the maximum over the classes in input `diger` (int64) → output `olasilik` [1, S + 2, Z, Y, X]. Batch size is fixed to 1. ## Verification ONNX Runtime (CPU), random input, original vs rewritten logits: max |Δ| 3.7e-4 (scale 129, 3 mm) and 4.7e-5 (scale 27, 1.5 mm), arg-max agreement 100 %; output head vs NumPy softmax/selection: max |Δ| < 1e-6. In the browser (Apple M6, WebGPU), on TCIA PSMA-PET-CT-Lesions v2 CTs (CC BY 4.0): voxel agreement with the WebAssembly path 99.999 %, organ Dice 0.9994-1.0; against the TotalSegmentator 1.5 mm CLI: liver 0.984, aorta 0.949, spleen 0.969, kidneys 0.955, bladder 0.972, heart 0.964. ## Files (SHA-256) ``` 57a9bf3ff76e7d5a8d8be546f8d493133a6cebb29a40001c0073c958d35d1435 total_3mm_297_webgpu2d_bas.onnx a7e48c6213157d14858c9b0520d0cd75d5a3237f52c78f103cdc0ab7f8793aa2 total_1p5mm_291_organs_webgpu2d_bas.onnx ```