Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions deeptrack/models/gnns/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ MAGIK requires at least python 3.6.
To install MAGIK you must install the [Deeptrack](https://github.com/softmatterlab/DeepTrack-2.0) framework. Open a terminal or command prompt and run:

pip install deeptrack


## Software requirements

### OS Requirements

MAGIK has been tested on the following systems:
+ macOS: Monterey (12.2.1)
+ Windows: 10 (64-bit)

- macOS: Monterey (12.2.1)
- Windows: 10 (64-bit)

### Python Dependencies

```
tensorflow
numpy
Expand All @@ -32,20 +34,19 @@ pydata-sphinx-theme
numpydoc
scikit-image
tensorflow-probability
pydeepimagej
pint
pandas

```
If you have a very recent version of python, you may need to install numpy _before_ DeepTrack. This is a known issue with scikit-image.

If you have a very recent version of python, you may need to install numpy _before_ DeepTrack. This is a known issue with scikit-image.

## It's a kind of MAGIK...

To see MAGIK in action, we provide an [example](//github.com/softmatterlab/DeepTrack-2.0/blob/develop/examples/MAGIK/) based on live-cell migration experiments. Data courtesy of Sergi Masó Orriols, [the QuBI lab](https://mon.uvic.cat/qubilab/).


## Cite us!

If you use MAGIK in your project, please cite our article:

```
Expand Down
102 changes: 51 additions & 51 deletions deeptrack/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,57 +247,57 @@ def fit(self, x, *args, batch_size=32, generator_kwargs={}, **kwargs):

return self.model.fit(x, *args, batch_size=batch_size, **kwargs)

def export(
self,
path,
minimum_size,
preprocessing=None,
dij_config=None,
):
"""Export model unto the BioImage Model Zoo format for use with Fiji and ImageJ.

Uses pyDeepImageJ by E. Gómez-de-Mariscal, C. García-López-de-Haro, L. Donati, M. Unser,
A. Muñoz-Barrutia and D. Sage for exporting.

DeepImageJ, used for loading the models into ImageJ, is only compatible with
tensorflow==2.2.1. Models using newer features may not load correctly.

Pre-processing of the data should be defined when creating the model using the preprocess
keyword. Post-processing should be left to other imageJ functionality. If this is not
sufficient, see `https://github.com/deepimagej/pydeepimagej` for what to pass to the
preprocessing and postprocessing arguments.

Parameters
----------
path : str
Path to store exported files.
minimum_size : int
For models where the input size is not fixed (e.g. (None, None 1)), the input
is required to be a multiple of this value.
preprocessing : Feature or Layer
Additional preprocessing. Will be saved as a part of the network, and as
such need to be compatible with tensorflow tensor operations. Assumed to have the
same input shape as the first layer of the network.
dij_config : BioImageModelZooConfig, optional
Configuration used for deployment. See `https://github.com/deepimagej/pydeepimagej` for
list of options. If None, a basic config is created for you.
"""
from pydeepimagej.yaml import BioImageModelZooConfig

# TODO: Does not yet fully work as intended. Debugging proved to be hard.
inp = layers.Input(shape=self.model.layers[0].input_shape)
model = self.model

if preprocessing:
processed_inp = preprocessing(inp)
model = model(processed_inp)
model = models.Model(inp, model)

dij_config = BioImageModelZooConfig(model, minimum_size)
dij_config.Name = "DeepTrack 2.1 model"

dij_config.add_weights_formats(model, "Tensorflow", authors=dij_config.Authors)
dij_config.export_model(path)
# def export(
# self,
# path,
# minimum_size,
# preprocessing=None,
# dij_config=None,
# ):
# """Export model unto the BioImage Model Zoo format for use with Fiji and ImageJ.

# Uses pyDeepImageJ by E. Gómez-de-Mariscal, C. García-López-de-Haro, L. Donati, M. Unser,
# A. Muñoz-Barrutia and D. Sage for exporting.

# DeepImageJ, used for loading the models into ImageJ, is only compatible with
# tensorflow==2.2.1. Models using newer features may not load correctly.

# Pre-processing of the data should be defined when creating the model using the preprocess
# keyword. Post-processing should be left to other imageJ functionality. If this is not
# sufficient, see `https://github.com/deepimagej/pydeepimagej` for what to pass to the
# preprocessing and postprocessing arguments.

# Parameters
# ----------
# path : str
# Path to store exported files.
# minimum_size : int
# For models where the input size is not fixed (e.g. (None, None 1)), the input
# is required to be a multiple of this value.
# preprocessing : Feature or Layer
# Additional preprocessing. Will be saved as a part of the network, and as
# such need to be compatible with tensorflow tensor operations. Assumed to have the
# same input shape as the first layer of the network.
# dij_config : BioImageModelZooConfig, optional
# Configuration used for deployment. See `https://github.com/deepimagej/pydeepimagej` for
# list of options. If None, a basic config is created for you.
# """
# from pydeepimagej.yaml import BioImageModelZooConfig

# # TODO: Does not yet fully work as intended. Debugging proved to be hard.
# inp = layers.Input(shape=self.model.layers[0].input_shape)
# model = self.model

# if preprocessing:
# processed_inp = preprocessing(inp)
# model = model(processed_inp)
# model = models.Model(inp, model)

# dij_config = BioImageModelZooConfig(model, minimum_size)
# dij_config.Name = "DeepTrack 2.1 model"

# dij_config.add_weights_formats(model, "Tensorflow", authors=dij_config.Authors)
# dij_config.export_model(path)

def get(self, image, add_batch_dimension_on_resolve, **kwargs):
if add_batch_dimension_on_resolve:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ numpydoc
scikit-image
tensorflow-probability
tensorflow-datasets
pydeepimagej
more_itertools
pint<0.20
pandas
Expand Down