Skip to content

Commit 8e4f348

Browse files
giovannivolpeBenjaminMidtvedtgithub-actions[bot]JesusPinedaCHenrik-KM
authored
Release 1.5.5 (#173)
* chore: autopublish 2022-07-26T13:54:44Z * Remove create-badges job * Delete test.py * Add multi-head masked attention * Update multi-head gated attention to match parent layer * Update documentation * Test multi-head masked attention * allow gated attention layers to use bias * test bias in gated attention layers * set return_attention_weights to False to avoid multi-outputs Use MultiHeadSelfAttention and MultiHeadGatedSelfAttention if want to return the attention weights * reformat gnns/layers.py This commit adds new message-passing graph layers (MPN) and graph convolutional layers to dt, including vanilla MPN, GRUMPN, Masked-attention FGNN, and GraphTransformer. * Update layers.py * Update test_layers.py * Update models.py * Update test_models.py * Update test_models.py * Fix indexing problems related to tf.gather * Allow multi-inputs in ContinuousGenerator * Fix bad conversion to integer * version bump * Fix phase correction at focus and offset calculation * Fix phase correction in propagation * Fix mie phase out of foucs * Fix mie phase out of foucs * Update README.md * Bm/version 1.4.0 (#137) * Update layers.py * Update convolutional.py Transformer-based models can now be reused and expanded quickly and easily * Update documentation * Update Transformer-based models * Delete classifying_MNIST_vit_tutorial.ipynb * Create classifying_MNIST_vit_tutorial.ipynb * Update datasets.py * Allows kwargs as inputs in single_layer_call * Update embeddings.py * masked transformers * reformat transformer models * Create trajectory_analysis_tutorial.ipynb * Add Variational autoencoders * Add variational autoencoders * Update vae.py * Create MNIST_VAE_tutorial.ipynb * Update MNIST_VAE_tutorial.ipynb * Create folder for course examples * Update README.md * Update README.md * Update examples * Update README.md * Update README.md * Update MNIST VAE examples * Added MLP regression example * Update README.md * Create image_segmentation_Unet.ipynb * Update README.md * Documented and tested cell_counting_tutorial.ipynb * improve dnn example * Shift variant mie * Position mie scatterer correctly * implement set z * implement mnist v1 * implement z dependence * remove logging * Implement flattening methods * Implement pooling and resizing * Implement TensorflowDataset * Finalize MNIST * Implement Malaria classification * alpha0 release * fix batchsize in fit * implement dataset.take * Implement datasets * fix phase in mie * Fix mie positioning and focusing * Commit to new branch * add tensorflow datasets dependence * remove test Co-authored-by: Jesús Pineda <[email protected]> Co-authored-by: Jesús Pineda <[email protected]> Co-authored-by: Benjamin Midtvedt <[email protected]> Co-authored-by: Ccx55 <[email protected]> * Add tensorflow datasets to the list of dependencies. * Read requirements.txt into setup.py * remove sphinx from build * remove create badges * Create CITATION.cff * Create .zenodo.json * Update transformer models * Update pint_definition.py * Update requirements.txt * create TimeDistributed CNN * small fixes to lodestar * Update layers.py * Update test_layers.py * remove direct getter of properties * Update scatterers.py Coherence length fix for MieScatterer * Update scatterers.py Added coherence length to the conversion table * mie phase fix * removed pydeepimagej from deps * Change loss input order of CGAN and PCGAN * Create dmdataset (dataset for graph-level regression tasks) * Update gnns/__init__.py * Add detection_linking_hela dataset * Update dmdataset.py * Create the regression_diffusion_landscape * Update scatterers.py CuPy fix for coherence length * Update test_scatterers.py Added a new method for testing MieSphere when coherence length parameter is provided. * Update augmentations.py * Update test_scatterers.py * Update test_scatterers.py * Create endothelial_vs dataset * Update layers.py * Update utils.py * Update docs link * Update README.md * version bump * version bump * Update README.md * Update README.md * Update graphs.py * Update test_generators.py * Update generators.py * fix test * Update vae.py --------- Co-authored-by: BenjaminMidtvedt <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jesús Pineda <[email protected]> Co-authored-by: Benjamin Midtvedt <[email protected]> Co-authored-by: Jesús Pineda <[email protected]> Co-authored-by: Ccx55 <[email protected]> Co-authored-by: Harshith Bachimanchi <[email protected]> Co-authored-by: gideon <[email protected]> Co-authored-by: Benjamin Midtvedt <[email protected]>
1 parent cd5f06b commit 8e4f348

File tree

4 files changed

+38
-5
lines changed

4 files changed

+38
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ We also have examples that are specific for certain models. This includes
126126
- [*MAGIK*](deeptrack/models/gnns/) for graph-based particle linking and trace characterization.
127127

128128
## Documentation
129-
The detailed documentation of DeepTrack 2.1 is available at the following link: https://softmatterlab.github.io/DeepTrack-2.0/deeptrack.html
129+
The detailed documentation of DeepTrack 2.1 is available at the following link: https://softmatterlab.github.io/DeepTrack2/deeptrack.html
130130

131131
## Video Tutorials
132132

deeptrack/models/gnns/graphs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def GetEdge(
1616
end: int,
1717
radius: int,
1818
parenthood: pd.DataFrame,
19+
columns = [],
1920
**kwargs,
2021
):
2122
"""
@@ -79,7 +80,7 @@ def GetEdge(
7980
edges.append(combdf)
8081
# Concatenate the dataframes in a single
8182
# dataframe for the whole set of edges
82-
edgedf = pd.concat(edges)
83+
edgedf = pd.concat(edges) if len(edges) > 0 else pd.DataFrame(columns=columns)
8384

8485
# Merge columns contaning the labels into a single column
8586
# of numpy arrays, i.e., label = [label_x, label_y]
@@ -120,6 +121,7 @@ def EdgeExtractor(nodesdf, nofframes=3, **kwargs):
120121
"""
121122
# Create a copy of the dataframe to avoid overwriting
122123
df = nodesdf.copy()
124+
columns = df.columns
123125

124126
edgedfs = []
125127
sets = np.unique(df["set"])
@@ -140,7 +142,7 @@ def EdgeExtractor(nodesdf, nofframes=3, **kwargs):
140142
window = [elem for elem in window if elem <= df_set["frame"].max()]
141143

142144
# Compute the edges for each frames window
143-
edgedf = GetEdge(df_set, start=window[0], end=window[-1], **kwargs)
145+
edgedf = GetEdge(df_set, start=window[0], end=window[-1], columns=columns, **kwargs)
144146
edgedf["set"] = setid
145147
edgedfs.append(edgedf)
146148

deeptrack/models/vaes/vae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def train_step(self, data):
3030

3131
# Sample a random point in the latent space
3232
epsilon = tf.random.normal(shape=tf.shape(z_mean))
33-
z = z_mean + tf.exp(z_log_var) * epsilon
33+
z = z_mean + tf.exp(0.5 * z_log_var) * epsilon
3434

3535
# Reconstruct the input image
3636
rdata = self.decoder(z)

deeptrack/test/test_generators.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
from .. import generators
99
from ..optics import Fluorescence
1010
from ..scatterers import PointParticle
11+
from ..models import gnns
1112
import numpy as np
12-
13+
import pandas as pd
1314

1415
class TestGenerators(unittest.TestCase):
1516
def test_Generator(self):
@@ -154,7 +155,37 @@ def get_particle_position(result):
154155
# a = generator[idx]
155156

156157
# [self.assertLess(d[-1], 8) for d in generator.data]
158+
157159

160+
def test_GraphGenerator(self):
161+
frame = np.arange(10)
162+
centroid = np.random.normal(0.5, 0.1, (10, 2))
163+
164+
df = pd.DataFrame(
165+
{
166+
'frame': frame,
167+
'centroid-0': centroid[:, 0],
168+
'centroid-1': centroid[:, 1],
169+
'label': 0,
170+
'set': 0,
171+
'solution': 0.0
172+
}
173+
)
174+
# remove consecutive frames
175+
df = df[~df["frame"].isin([3, 4, 5])]
176+
177+
generator = gnns.generators.GraphGenerator(
178+
nodesdf=df,
179+
properties=["centroid"],
180+
min_data_size=8,
181+
max_data_size=9,
182+
batch_size=8,
183+
feature_function=gnns.augmentations.GetGlobalFeature,
184+
radius=0.2,
185+
nofframes=3,
186+
output_type="edges"
187+
)
188+
self.assertIsInstance(generator, gnns.generators.ContinuousGraphGenerator)
158189

159190
if __name__ == "__main__":
160191
unittest.main()

0 commit comments

Comments
 (0)