Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bingogome committed Apr 10, 2023
1 parent abee33e commit 2d1a533
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,38 @@ Accurate image segmentation is crucial for medical image analysis as it enables

Our project, **Segment Any Medical-Model** aims to develop an integration for [Segment Anything Model (SAM)](https://github.com/facebookresearch/segment-anything) and [3D Slicer](https://www.slicer.org/) for future development and validation of the potentials of transferring Large Language Model to the medical image analysis field.

## Installation and How-To-Use

### TLDR version

```bash
git clone [email protected]:bingogome/samm.git
conda create --name samm
conda activate samm
pip install git+https://github.com/facebookresearch/segment-anything.git
pip install opencv-python pycocotools matplotlib onnxruntime onnx
```

Start 3D Slicer, in the Python Console:

```python
import pip
pip.main(['install', 'pyyaml'])
pip.main(['install', 'pyzmq'])
```

SD Slicer -> `Developer Tools` → `Extension Wizard`.

`Extension Tools` -> `Select Extension' -> import the samm/samm folder.

Back to terminal, cd to samm (upper level)

Run ./samm-python-terminal/sam_server.py

If it throws an error missing "sam_vit_h_4b8939.pth", move segment-anything/notebooks/sam_vit_h_4b8939.pth to samm/samm-python-terminal/samm-workspace

Follow the [demo](https://www.youtube.com/watch?v=vZK45noZVIA) and Segment Any Medical Model away!

## Installation

### Install samm

Expand All @@ -26,8 +55,6 @@ Install this repo:
git clone [email protected]:bingogome/samm.git
```


### Create Virtual Environment

It's essential to have a clean virtual environment to avoid any potential conflicts. Therefore, you'd better to create a new environment for running the rest part of the code.
Expand All @@ -43,8 +70,6 @@ conda activate samm

Note: The given python script in this [folder](/samm-python-terminal) has to be executed in samm venv.



### Install SAM

The code requires `python>=3.8`, as well as `pytorch>=1.7` and `torchvision>=0.8`. Please follow the instructions [here](https://pytorch.org/get-started/locally/) to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.
Expand All @@ -62,22 +87,18 @@ git clone [email protected]:facebookresearch/segment-anything.git
cd segment-anything; pip install -e .
```

The following optional dependencies are necessary for mask post-processing, saving masks in COCO format, the example notebooks, and exporting the model in ONNX format. `jupyter` is also required to run the example notebooks.
Then,

```
pip install opencv-python pycocotools matplotlib onnxruntime onnx
```





### Install 3D Slicer

Follow this [page](https://slicer.readthedocs.io/en/latest/user_guide/getting_started.html) to download a compatible version of 3D Slicer and install it in your local environment.



### Install the SAMM Extension to 3D Slicer

The source code of the extension is contained in [samm](/samm).
Expand Down

0 comments on commit 2d1a533

Please sign in to comment.