Skip to content

Commit

Permalink
Merge pull request #32 from Project-MONAI/master
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
Nic-Ma authored Feb 24, 2021
2 parents 42a45e0 + db2dbb0 commit cd16a13
Show file tree
Hide file tree
Showing 118 changed files with 2,935 additions and 463 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,38 @@ jobs:
fail_ci_if_error: false
file: ./coverage.xml

cron-pt-image:
if: github.repository == 'Project-MONAI/MONAI'
container:
image: nvcr.io/nvidia/pytorch:20.12-py3 # testing with the latest pytorch base image
options: "--gpus all"
runs-on: [self-hosted, linux, x64, common]
steps:
- uses: actions/checkout@v2
- name: Install the dependencies
run: |
which python
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
python -m pip list
- name: Run tests report coverage
run: |
export LAUNCH_DELAY=$[ $RANDOM % 16 * 60 ]
echo "Sleep $LAUNCH_DELAY"
sleep $LAUNCH_DELAY
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage
coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
file: ./coverage.xml

cron-docker:
if: github.repository == 'Project-MONAI/MONAI'
container:
Expand All @@ -61,7 +93,8 @@ jobs:
runs-on: [self-hosted, linux, x64, common]
steps:
- name: Run tests report coverage
# The docker image process has done the compilation. BUILD_MONAI=1 may not be necessary.
# The docker image process has done the compilation.
# BUILD_MONAI=1 is necessary for triggering the USE_COMPILED flag.
run: |
cd /opt/monai
nvidia-smi
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:20.10-py3
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:20.12-py3

FROM ${PYTORCH_IMAGE}

Expand All @@ -21,7 +21,8 @@ WORKDIR /opt/monai
COPY requirements.txt requirements-min.txt requirements-dev.txt /tmp/
RUN cp /tmp/requirements.txt /tmp/req.bak \
&& awk '!/torch/' /tmp/requirements.txt > /tmp/tmp && mv /tmp/tmp /tmp/requirements.txt \
&& python -m pip install --no-cache-dir --use-feature=2020-resolver -r /tmp/requirements-dev.txt
&& python -m pip install --upgrade --no-cache-dir pip \
&& python -m pip install --no-cache-dir -r /tmp/requirements-dev.txt

# compile ext and remove temp files
# TODO: remark for issue [revise the dockerfile #1276](https://github.com/Project-MONAI/MONAI/issues/1276)
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
torch>=1.5
pytorch-ignite==0.4.2
numpy>=1.17
itk
itk>=5.0
nibabel
parameterized
scikit-image>=0.14.2
Expand Down
24 changes: 24 additions & 0 deletions docs/source/apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,27 @@ Applications
.. autofunction:: extractall

.. autofunction:: download_and_extract

`Deepgrow`
----------

.. automodule:: monai.apps.deepgrow.dataset
.. autofunction:: create_dataset

.. automodule:: monai.apps.deepgrow.interaction
.. autoclass:: Interaction
:members:

.. automodule:: monai.apps.deepgrow.transforms
.. autoclass:: AddInitialSeedPointd
:members:
.. autoclass:: AddGuidanceSignald
:members:
.. autoclass:: AddRandomGuidanced
:members:
.. autoclass:: SpatialCropForegroundd
:members:
.. autoclass:: FindDiscrepancyRegionsd
:members:
.. autoclass:: FindAllValidSlicesd
:members:
3 changes: 3 additions & 0 deletions docs/source/handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Training stats handler

Tensorboard handlers
--------------------
.. autoclass:: TensorBoardHandler
:members:

.. autoclass:: TensorBoardStatsHandler
:members:

Expand Down
8 changes: 8 additions & 0 deletions docs/source/losses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ Registration Losses
`GlobalMutualInformationLoss`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: GlobalMutualInformationLoss
:members:

Loss Wrappers
--------------

`MultiScaleLoss`
~~~~~~~~~~~~~~~~~
.. autoclass:: MultiScaleLoss
:members:
13 changes: 9 additions & 4 deletions docs/source/networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ Blocks
.. autoclass:: SubpixelUpSample

`LocalNet DownSample Block`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: LocalNetDownSampleBlock
:members:

`LocalNet UpSample Block`
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: LocalNetUpSampleBlock
:members:

Expand All @@ -135,10 +135,15 @@ Blocks
:members:

`Warp`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
.. autoclass:: Warp
:members:

`DVF2DDF`
~~~~~~~~~
.. autoclass:: DVF2DDF
:members:

Layers
------

Expand Down Expand Up @@ -201,7 +206,7 @@ Layers
~~~~~~~~~~~~~~~~
.. autoclass:: GaussianFilter
:members:

`BilateralFilter`
~~~~~~~~~~~~~~~~~
.. autoclass:: BilateralFilter
Expand Down
18 changes: 18 additions & 0 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ IO
:members:
:special-members: __call__

`SaveImage`
"""""""""""
.. autoclass:: SaveImage
:members:
:special-members: __call__

Post-processing
^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -702,6 +708,12 @@ IO (Dict)
:members:
:special-members: __call__

`SaveImaged`
""""""""""""
.. autoclass:: SaveImaged
:members:
:special-members: __call__

Post-processing (Dict)
^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -939,6 +951,12 @@ Utility (Dict)
:members:
:special-members: __call__

`RandLambdad`
"""""""""""""
.. autoclass:: RandLambdad
:members:
:special-members: __call__

`LabelToMaskd`
""""""""""""""
.. autoclass:: LabelToMaskd
Expand Down
8 changes: 6 additions & 2 deletions monai/apps/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def __init__(
data = self._generate_data_list(dataset_dir)
if transform == ():
transform = LoadImaged("image")
super().__init__(data, transform, cache_num=cache_num, cache_rate=cache_rate, num_workers=num_workers)
CacheDataset.__init__(
self, data, transform, cache_num=cache_num, cache_rate=cache_rate, num_workers=num_workers
)

def randomize(self, data: Optional[Any] = None) -> None:
self.rann = self.R.random()
Expand Down Expand Up @@ -275,7 +277,9 @@ def __init__(
self._properties = load_decathlon_properties(os.path.join(dataset_dir, "dataset.json"), property_keys)
if transform == ():
transform = LoadImaged(["image", "label"])
super().__init__(data, transform, cache_num=cache_num, cache_rate=cache_rate, num_workers=num_workers)
CacheDataset.__init__(
self, data, transform, cache_num=cache_num, cache_rate=cache_rate, num_workers=num_workers
)

def get_indices(self) -> np.ndarray:
"""
Expand Down
10 changes: 10 additions & 0 deletions monai/apps/deepgrow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading

0 comments on commit cd16a13

Please sign in to comment.