-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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. | ||
|
@@ -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. | ||
|
@@ -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). | ||
|