Skip to content

Commit

Permalink
Merge 5b9c035 into 39fab86
Browse files Browse the repository at this point in the history
  • Loading branch information
willgraf committed Nov 10, 2020
2 parents 39fab86 + 5b9c035 commit c08a05b
Show file tree
Hide file tree
Showing 108 changed files with 1,140 additions and 2,329 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

env:
TF_VERSION: 1.14.0
TF_VERSION: 2.3.1

steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:

strategy:
matrix:
python-version: [2.7, 3.6, 3.7]
tensorflow-version: [1.14.0, 1.15.0]
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
Expand All @@ -38,15 +37,13 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
sed -i "/tensorflow/d" requirements.txt
pip install tensorflow==${{ matrix.tensorflow-version }}
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Run PyTest and Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: py${{ matrix.python-version }}-tf${{ matrix.tensorflow-version }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
pytest --cov deepcell --pep8
Expand Down
22 changes: 7 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
# Use tensorflow/tensorflow as the base image
# Change the build arg to edit the tensorflow version.
# Only supporting python3.
ARG TF_VERSION=1.14.0-gpu
ARG TF_VERSION=2.3.1-gpu

FROM tensorflow/tensorflow:${TF_VERSION}-py3
FROM tensorflow/tensorflow:${TF_VERSION}

# System maintenance
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-tk \
libxext6 \
libxrender-dev \
libsm6 && \
rm -rf /var/lib/apt/lists/* && \
/usr/local/bin/pip install --upgrade pip
/usr/bin/python3 -m pip install --upgrade pip

WORKDIR /notebooks

# Copy the setup.py and requirements.txt and install the deepcell-tf dependencies
COPY setup.py requirements.txt /opt/deepcell-tf/

# Prevent reinstallation of tensorflow and install all other requirements.
RUN sed -i "/tensorflow/d" /opt/deepcell-tf/requirements.txt && \
RUN sed -i "/tensorflow>/d" /opt/deepcell-tf/requirements.txt && \
pip install -r /opt/deepcell-tf/requirements.txt

# Copy the rest of the package code and its scripts
COPY deepcell /opt/deepcell-tf/deepcell

# Install deepcell via setup.py
RUN pip install /opt/deepcell-tf && \
cd /opt/deepcell-tf && \
python setup.py build_ext --inplace

# Older versions of TensorFlow have notebooks, but they may not exist
RUN if [ -n "$(find /notebooks/ -prune)" ] ; then \
mkdir -p /notebooks/intro_to_tensorflow && \
ls -d /notebooks/* | grep -v intro_to_tensorflow | \
xargs -r mv -t /notebooks/intro_to_tensorflow ; \
fi
RUN pip install /opt/deepcell-tf

# Copy over deepcell notebooks
COPY notebooks/ /notebooks/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ For examples of how to train models with the `deepcell-tf` library, check out th
```bash
git clone https://github.com/vanvalenlab/deepcell-tf.git
cd deepcell-tf
docker build --build-arg TF_VERSION=1.15.0-gpu -t $USER/deepcell-tf .
docker build --build-arg TF_VERSION=2.3.1-gpu -t $USER/deepcell-tf .
```

### Run the new docker image
Expand Down
2 changes: 1 addition & 1 deletion deepcell/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/application_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import numpy as np

from tensorflow.python.keras.layers import Input
from tensorflow.keras.layers import Input
from tensorflow.python.platform import test

from deepcell.applications import Application
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/cell_tracking.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -29,7 +29,7 @@
from __future__ import division
from __future__ import print_function

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.keras.utils import get_file

import deepcell_tracking
from deepcell_toolbox.processing import normalize
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/cell_tracking_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/cytoplasm_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import os

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.keras.utils import get_file

from deepcell_toolbox.deep_watershed import deep_watershed
from deepcell_toolbox.processing import phase_preprocess
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/cytoplasm_segmentation_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions deepcell/applications/label_detection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -29,8 +29,8 @@
from __future__ import division
from __future__ import print_function

from tensorflow.python import keras
from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow import keras
from tensorflow.keras.utils import get_file

from deepcell.layers import ImageNormalization2D, TensorProduct
from deepcell.utils.backbone_utils import get_backbone
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/label_detection_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import numpy as np

from tensorflow.python.keras.layers import Input
from tensorflow.keras.layers import Input
from tensorflow.python.platform import test

from deepcell.applications import LabelDetectionModel
Expand Down
6 changes: 2 additions & 4 deletions deepcell/applications/multiplex_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,9 +31,7 @@

import os

import numpy as np

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.keras.utils import get_file

from deepcell_toolbox.multiplex_utils import \
multiplex_preprocess, multiplex_postprocess, format_output_multiplex
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/multiplex_segmentation_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/nuclear_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import os

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.keras.utils import get_file

from deepcell_toolbox.processing import normalize
from deepcell_toolbox.deep_watershed import deep_watershed
Expand Down
2 changes: 1 addition & 1 deletion deepcell/applications/nuclear_segmentation_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions deepcell/applications/scale_detection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -29,8 +29,8 @@
from __future__ import division
from __future__ import print_function

from tensorflow.python import keras
from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow import keras
from tensorflow.keras.utils import get_file

from deepcell.layers import ImageNormalization2D, TensorProduct
from deepcell.utils.backbone_utils import get_backbone
Expand Down
4 changes: 2 additions & 2 deletions deepcell/applications/scale_detection_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import numpy as np

from tensorflow.python.keras.layers import Input
from tensorflow.keras.layers import Input
from tensorflow.python.platform import test

from deepcell.applications import ScaleDetectionModel
Expand Down
15 changes: 7 additions & 8 deletions deepcell/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -29,7 +29,7 @@
from __future__ import print_function
from __future__ import division

from tensorflow.python.keras.callbacks import Callback
from tensorflow.keras.callbacks import Callback

from deepcell.utils.retinanet_anchor_utils import evaluate, evaluate_mask

Expand Down Expand Up @@ -152,13 +152,12 @@ def on_epoch_end(self, epoch, logs=None):
else:
mean_ap = sum(precisions) / sum(x > 0 for x in instances)

if self.tensorboard is not None and self.tensorboard.writer is not None:
if self.tensorboard is not None:
import tensorflow as tf
summary = tf.Summary()
summary_value = summary.value.add() # pylint: disable=E1101
summary_value.simple_value = mean_ap
summary_value.tag = 'mAP'
self.tensorboard.writer.add_summary(summary, epoch)
writer = tf.summary.create_file_writer(self.tensorboard.log_dir)
with writer.as_default():
tf.summary.scalar('mAP', mean_ap, step=epoch)
writer.flush()

logs['mAP'] = mean_ap

Expand Down
7 changes: 4 additions & 3 deletions deepcell/callbacks_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -49,6 +49,7 @@
BATCH_SIZE = 5


@keras_parameterized.run_with_all_model_types
@keras_parameterized.run_all_keras_modes
class CallbacksTest(keras_parameterized.TestCase):

Expand All @@ -61,8 +62,8 @@ def test_RedirectModel(self):
input_shape=(INPUT_DIM,),
num_classes=NUM_CLASSES)

y_test = keras.utils.to_categorical(y_test)
y_train = keras.utils.to_categorical(y_train)
y_test = keras.utils.np_utils.to_categorical(y_test)
y_train = keras.utils.np_utils.to_categorical(y_train)
model = keras.models.Sequential()
model.add(
keras.layers.Dense(
Expand Down
4 changes: 2 additions & 2 deletions deepcell/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -31,7 +31,7 @@

import os

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.keras.utils import get_file

from deepcell.utils.data_utils import get_data

Expand Down
2 changes: 1 addition & 1 deletion deepcell/datasets/cytoplasm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion deepcell/datasets/phase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion deepcell/datasets/tracked.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions deepcell/image_generators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down Expand Up @@ -37,8 +37,8 @@

import numpy as np

from tensorflow.python.keras import backend as K
from tensorflow.python.keras.utils import to_categorical
from tensorflow.keras import backend as K
from tensorflow.keras.utils import to_categorical

from deepcell.utils import transform_utils

Expand Down
2 changes: 1 addition & 1 deletion deepcell/image_generators/cropping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 The Van Valen Lab at the California Institute of
# Copyright 2016-2020 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
Expand Down

0 comments on commit c08a05b

Please sign in to comment.