# Monai Label in 3d slicer -auto segmentation is not working for loaded data

**URL:** https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122
**Category:** Support
**Tags:** feature, monailabel
**Created:** [June 19, 2023, 2:04pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122 "2023-06-19T14:04:40Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![linda\_varghese](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/linda_varghese/32/66243_2.png) [@linda\_varghese](https://discourse.slicer.org/u/linda_varghese)
#### Post date: [June 19, 2023, 2:04pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/1 "2023-06-19T14:04:41Z")

</div>

Hi Team,  
I am facing trouble to get the model to run on auto segmentation,I tried with the sample datatsets with segmentation-spleen model and even on deepedit model,in both case autosegmentation is not showing any models.  
As of now my aim is to automate the segmentation of liver,hepatic vein and portal vein.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/7/b73f0f5d2f51bf4c7bac28b4609f452a8095c900.png)

---

<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: [June 19, 2023, 2:57pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/2 "2023-06-19T14:57:43Z")

</div>

The standard MONAILabel radiology app works in 3D Slicer 3.2.2, provided you have a GPU on the server computer and enough VRAM on the NVIDIA GPU.

I used:

```auto
monailabel start_server --app MONAILabel/sample-apps/radiology --studies c:/Data/Task06_Lung/imagesTr --conf models segmentation

```

Make sure you install MONAILabel correctly, maybe restart from scratch and [follow our recipe](https://projectweek.na-mic.org/PW37_2022_Virtual/Projects/MONAILabelLung/MONAILabel_Installation.html)  
Work on small or resampled datasets.

Using the pre-trained “segmentation” model on an AWS server with an A10G GPU (24GB):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/d/dd12be24855298f7ba43607b0a62f8809db6fafa.png)

You would have to invest more training for better results.

MONAILabel version: 0.7.0rc7+2.g943d545  
Numpy version: 1.23.5  
Pytorch version: 1.13.1+cu117  
MONAILabel rev id: 943d545efdc6e3d6a50f959b1d7dd1b19d80e372

---

<div class="post-metadata">

### Author: ![linda\_varghese](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/linda_varghese/32/66243_2.png) [@linda\_varghese](https://discourse.slicer.org/u/linda_varghese)
#### Post date: [June 23, 2023, 12:04pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/3 "2023-06-23T12:04:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/a/8ad4d9453d57be0fa090f7a16ceb659676da2ebe.png)  
I had re installed Monai again with different with different version but again auto segmentation was disable

---

<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: [June 23, 2023, 12:27pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/4 "2023-06-23T12:27:13Z")

</div>

What are your system specifications, Linda?

---

<div class="post-metadata">

### Author: ![linda\_varghese](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/linda_varghese/32/66243_2.png) [@linda\_varghese](https://discourse.slicer.org/u/linda_varghese)
#### Post date: [June 23, 2023, 12:35pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/5 "2023-06-23T12:35:45Z")

</div>

AMD Ryzen 5 PRO 5675U with Radeon Graphics 2.30 GHz  
64-bit operating system, x64-based processor

---

<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: [June 23, 2023, 1:37pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/6 "2023-06-23T13:37:25Z")

</div>

I have never got MONAILabel running on a non-NVIDIA GPU or an NVIDIA GPU with less than 6 GB of VRAM.  
Your non-display of the auto-segmentation model may be connected to that fact. You should be able to get TotalSegmentator (see your other thread) up and running if you install Pytorch (from the Pytorch extension) in **CPU** mode.  
But the best thing would be to upgrade your hardware or use a cloud server.

---

<div class="post-metadata">

### Author: ![Ylim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ylim/32/68611_2.png) [@Ylim](https://discourse.slicer.org/u/Ylim)
#### Post date: [September 1, 2023, 12:56am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/7 "2023-09-01T00:56:21Z")

</div>

> [@rbumm](#):
>
> n-NVIDIA GPU or an NVIDIA GPU with less than 6 GB of VRAM.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/3/f333a5fff257d061f841046b16db394355f96554.jpeg)

Hi, using pycharm and slicer 5.2.2, i7 and rts3070 laptop (ram of 8gb?)  
I do need that the source volume cannot be chosen/shown, device is CPU and the auto seg cannot be run?

Please advise. Thanks.

---

<div class="post-metadata">

### Author: ![Ylim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ylim/32/68611_2.png) [@Ylim](https://discourse.slicer.org/u/Ylim)
#### Post date: [September 1, 2023, 1:02am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/8 "2023-09-01T01:02:13Z")

</div>

Resolved. Graphics Settings and Slicer.

---

<div class="post-metadata">

### Author: ![Ylim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ylim/32/68611_2.png) [@Ylim](https://discourse.slicer.org/u/Ylim)
#### Post date: [September 1, 2023, 1:17am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/9 "2023-09-01T01:17:48Z")

</div>

On your point on cloud computing, have you been successful in deploring the radiology app/ slicer/ monai label on colab?

---

<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: [September 1, 2023, 7:10am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/10 "2023-09-01T07:10:06Z")

</div>

Just for other visitors: Could you please specify exactly how you resolved your problem?

---

<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: [September 1, 2023, 7:11am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/11 "2023-09-01T07:11:48Z")

</div>

We were able to implement MonaiLabel on an AWS EC2 Windows server instance but not on a Colab.  
Maybe @diazandr3s is aware of a Colab implementation?

---

<div class="post-metadata">

### Author: ![Ylim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ylim/32/68611_2.png) [@Ylim](https://discourse.slicer.org/u/Ylim)
#### Post date: [September 2, 2023, 1:43pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/12 "2023-09-02T13:43:11Z")

</div>

Hi Rudolf,  
I am using pycharm and slicer 5.2.2.

I have using pycharm and python 3.9 and have run  
pip install torch torchvision torchaudio --extra-index-url [https://download.pytorch.org/whl/cu113](https://download.pytorch.org/whl/cu113)

In slicer 5.2.2 python intrepretor,  
import torch; print(torch.cuda.is\_available())  
output is TRUE.

I have an i7, 3070 laptop gpu, and was able to run autosegmenation in monailabel.  
however, i realise that the infer and within the infer is always cpu and i cannot change this.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/5/e5771400b9123ee763b966cf0d96a2fef257b026.png)  
task manager sees little to no gpu activity and i have enabled high performance for slicer in the nvida control.

The real issue is when I want to run my own data -  
AppData\Local\NA-MIC\Slicer 5.2.2\NA-MIC\Extensions-31382\MONAILabel\lib\Slicer-5.2\qt-scripted-modules\MONAILabelLib\client.py", line 344, in infer  
raise MONAILabelClientException(  
MONAILabelLib.client.MONAILabelClientException: (1, ‘Status: 500; Response: Internal Server Error’)

log reads - [2023-09-02 23:39:53,031] [24088] [MainThread] [INFO] (monailabel.tasks.infer.basic\_infer:480) - Inferer:: cpu =\> SlidingWindowInferer =\> {‘roi\_size’: (96, 96, 96), ‘sw\_batch\_size’: 2, ‘overlap’: 0.4, ‘mode’: gaussian, ‘sigma\_scale’: 0.125, ‘padding\_mode’: ‘replicate’, ‘cval’: 0.0, ‘sw\_device’: None, ‘device’: None, ‘progress’: False, ‘cpu\_thresh’: None, ‘buffer\_steps’: None, ‘buffer\_dim’: -1, ‘roi\_weight\_map’: None}

any advice?

---

<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: [September 3, 2023, 6:45pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/13 "2023-09-03T18:45:15Z")

</div>

- Uninstall everything.

- Freshly install:5.4.0

- Pytorch Utilities and Pytorch

- Restart Slicer.

- Install the Monailabel extension.

- Install the Monailabel server separately on your computer. It must not residue in the Python interactor and within 3D Slicer. Ensure that CUDA support is available there.

- Download the Monailabel apps and datasets that you need depending on the nature of your project.

- Start the ML server

- Start Slicer  
Start the ML extension

- connect the server to the MonaiLabel extension.by just presssing enter in the ML server line.

---

<div class="post-metadata">

### Author: ![diazandr3s](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/diazandr3s/32/9973_2.png) [@diazandr3s](https://discourse.slicer.org/u/diazandr3s)
#### Post date: [September 4, 2023, 10:43am UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/14 "2023-09-04T10:43:56Z")

</div>

Thanks for the ping, @rbumm

@Ylim, Colab is a Jupyter Notebook service. It is not intended for server hosting. Unless you mean using Colab to run shell commands and start the server in the background.

If this is the case, you must ensure permanent access to the same instance or computing resources. Something that’s not common in Colab.

Hope this helps,

---

<div class="post-metadata">

### Author: ![Ylim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ylim/32/68611_2.png) [@Ylim](https://discourse.slicer.org/u/Ylim)
#### Post date: [September 4, 2023, 11:27pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/15 "2023-09-04T23:27:19Z")

</div>

@diazandr3s and @rbumm , the two of you have been very helpful/

@rbumm, i did find out the specific problem in my case, both the right version of pytorch must be installed in at both ends.

---

<div class="post-metadata">

### Author: ![zariliusra](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zariliusra/32/66436_2.png) [@zariliusra](https://discourse.slicer.org/u/zariliusra)
#### Post date: [October 3, 2023, 7:45pm UTC](https://discourse.slicer.org/t/monai-label-in-3d-slicer-auto-segmentation-is-not-working-for-loaded-data/30122/16 "2023-10-03T19:45:25Z")

</div>

Can you explain how you resolved the “auto segmentation not working” problem? i also got this problem and still not resolved

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/f/afd64738417592ede0c4b5c87473845963d0aa5a.jpeg)
