Skip to content

Commit

Permalink
Support SAM2 (Inference only) as base model for all the apps (#1777)
Browse files Browse the repository at this point in the history
* Support SAM2 (Inference only) as base model for all the apps

Signed-off-by: Sachidanand Alle <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Support SAM2 for python >=3.10

Signed-off-by: Sachidanand Alle <[email protected]>

* Update python version dep for docs build

Signed-off-by: Sachidanand Alle <[email protected]>

* Fix setup.cfg for sam2

Signed-off-by: Sachidanand Alle <[email protected]>

* Fix setup.cfg for sam2

Signed-off-by: Sachidanand Alle <[email protected]>

* Fix setup.cfg for sam2

Signed-off-by: Sachidanand Alle <[email protected]>

* Fix github space error

Signed-off-by: Sachidanand Alle <[email protected]>

* Fix github dep workflow fix

Signed-off-by: Sachidanand Alle <[email protected]>

* Final fixes after verifying e2e

Signed-off-by: Sachidanand Alle <[email protected]>

---------

Signed-off-by: Sachidanand Alle <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
SachidanandAlle and pre-commit-ci[bot] authored Nov 7, 2024
1 parent 5dce9ae commit 6cb96f6
Show file tree
Hide file tree
Showing 30 changed files with 851 additions and 76 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,13 @@ jobs:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: clean up
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Build
run: |
rm -rf /opt/hostedtoolcache
./runtests.sh --clean
docker system prune -f
DOCKER_BUILDKIT=1 docker build -t projectmonai/monailabel:${{ github.event.inputs.tag || 'latest' }} -f Dockerfile .
- name: Verify
run: |
./runtests.sh --clean
docker run --rm -i --ipc=host --net=host -v $(pwd):/workspace projectmonai/monailabel:${{ github.event.inputs.tag || 'latest' }} /workspace/runtests.sh --net
- name: Publish
run: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- if: runner.os == 'Linux'
name: Cleanup (Linux only)
run: |
rm -rf /opt/hostedtoolcache
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
Expand All @@ -59,6 +63,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --upgrade pip wheel
pip install -r requirements-dev.txt
Expand Down Expand Up @@ -107,9 +112,10 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --user --upgrade pip setuptools wheel
python -m pip install torch>=1.7 torchvision
python -m pip install torch torchvision
- name: Build Package
run: |
./runtests.sh --clean
Expand Down Expand Up @@ -144,7 +150,7 @@ jobs:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -165,6 +171,7 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --upgrade pip wheel
python -m pip install -r docs/requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --user --upgrade pip setuptools wheel
python -m pip install torch>=1.7 torchvision
python -m pip install torch torchvision
- name: Build Package
run: |
rm -rf /opt/hostedtoolcache
./runtests.sh --clean
BUILD_OHIF=true python setup.py sdist bdist_wheel --build-number $(date +'%Y%m%d%H%M')
ls -l dist
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ In addition, you can find a table of the basic supported fields, modalities, vie
<li>Segmentation</li>
<li>DeepGrow</li>
<li>DeepEdit</li>
<li>SAM2 (2D/3D)</li>
</ul>
</td>
<td>
Expand Down Expand Up @@ -114,6 +115,7 @@ In addition, you can find a table of the basic supported fields, modalities, vie
<li>NuClick</li>
<li>Segmentation</li>
<li>Classification</li>
<li>SAM2 (2D)</li>
</ul>
</td>
<td>
Expand Down Expand Up @@ -143,6 +145,7 @@ In addition, you can find a table of the basic supported fields, modalities, vie
<li>DeepEdit</li>
<li>Tooltracking</li>
<li>InBody/OutBody</li>
<li>SAM2 (2D)</li>
</ul>
</td>
<td>
Expand All @@ -164,6 +167,12 @@ In addition, you can find a table of the basic supported fields, modalities, vie
<tr>
</table>

> [**SAM2**](https://github.com/facebookresearch/sam2/)
>
> By default, SAM2 is included for all the above Apps only when **_python >= 3.10_**
> - **sam_2d**: for any organ or tissue and others over a given slice/2D image.
> - **sam_3d**: to support SAM2 propagation over multiple slices (Radiology/MONAI-Bundle).
# Getting Started with MONAI Label
### MONAI Label requires a few steps to get started:
- Step 1: [Install MONAI Label](#step-1-installation)
Expand Down
Empty file added monailabel/sam2/__init__.py
Empty file.
Loading

0 comments on commit 6cb96f6

Please sign in to comment.