# OutOfMemoryError: CUDA out of memory TotalSegmentator

**URL:** <https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697>\
**Category:** Support\
**Created:** [March 31, 2023, 1:57pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697 "2023-03-31T13:57:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![NicoV](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@NicoV](https://discourse.slicer.org/u/NicoV)\
**Post date:** [March 31, 2023, 1:57pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/1 "2023-03-31T13:57:14Z")

</div>

Operating system: Windows 10  
Slicer version: 5.2.2  
Expected behavior: TotalSegmentator full resolution segmentation with GPU 8Gb (NVIDIA)  
Actual behavior: semgmentation fails due to “OutOfMemoryError: CUDA out of memory”, seems to result from preprocessing crop of CT images (509 in that case). Lower croping makes the process succeed (around 250).  
How does it work and is it possible to edit this parameter in TotalSegmentator.  
One 16 Gb GPU is best but we can read that 8Gb is also sufficient (our IT dept did not offer the first one…).  
Thank you for your help,  
nicolas

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [April 2, 2023, 1:03pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/2 "2023-04-02T13:03:28Z")

</div>

Does it work with the CTs from the Sample datasets?

---

<div class="post-metadata">

**Author:** ![NicoV](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@NicoV](https://discourse.slicer.org/u/NicoV)\
**Post date:** [April 4, 2023, 10:48am UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/3 "2023-04-04T10:48:19Z")

</div>

Hi Rudolf,

Yes ! thanks for the tip.

As consequence, the resolution is lowered with this CT (2.2 vs 0.9 mm). With the high resolution of segmentation (1.5mm vs 3mm), it could be worth being quantified, nevertheless.

Anyway, we are not blocked anymore and that is the most important, I would say!

Nevertheless, do you have any clue on how the resampling operate within TotalSegmentator?

Thank a lot for your help and answering,

Best regards,

Nicolas

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 4, 2023, 1:06pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/4 "2023-04-04T13:06:58Z")

</div>

You can crop and/or resample the volume on the CPU using **Crop volume** module before you run Total Segmentator on it.

---

<div class="post-metadata">

**Author:** ![NicoV](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@NicoV](https://discourse.slicer.org/u/NicoV)\
**Post date:** [April 4, 2023, 2:29pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/5 "2023-04-04T14:29:51Z")

</div>

Thanks Andras,

It works pretty well and ensure to perform TotalSegmentator on the high-resolution CT (relatively).

And this remains a quick pre-processing step.

Best regards,

nicolas

---

<div class="post-metadata">

**Author:** ![NicoV](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@NicoV](https://discourse.slicer.org/u/NicoV)\
**Post date:** [April 4, 2023, 2:59pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/6 "2023-04-04T14:59:45Z")

</div>

Concerning TotalSegmentator, just a quick wondering, any idea why the sternum is not included?

BR,

NV

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [April 4, 2023, 4:10pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/7 "2023-04-04T16:10:28Z")

</div>

There is a preview circulating with sternum already, it will probably soon be integrated.  
Best, r

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 4, 2023, 4:16pm UTC](https://discourse.slicer.org/t/outofmemoryerror-cuda-out-of-memory-totalsegmentator/28697/8 "2023-04-04T16:16:58Z")

</div>

The latest TotalSegmentator model includes the sternum, but I don’t think it has been publicly released yet.
