DeepTrackAI / DeepTrack2

DeepTrack2
MIT License
157 stars 47 forks source link

MAGIK Tutorial Doesn't Run Out of the Box #184

Closed akilgall closed 10 months ago

akilgall commented 1 year ago

Hello, When running the MAGIK tutorial out of the box, I get the following error when running the fit command:


ValueError Traceback (most recent call last) Cell In[10], line 12 1 generator = GraphGenerator( 2 nodesdf=nodesdf, 3 properties=["centroid"], (...) 8 **variables.properties() 9 ) 11 with generator: ---> 12 model.fit(generator, epochs=10)

File ~/miniconda/envs/deeptrackCurrent/lib/python3.11/site-packages/deeptrack/models/utils.py:248, in KerasModel.fit(self, x, batch_size, generator_kwargs, *args, *kwargs) 245 # Code is not actually unreachable if fit crashes. 246 return None --> 248 return self.model.fit(x, args, batch_size=batch_size, **kwargs)

File ~/miniconda/envs/deeptrackCurrent/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs) 67 filtered_tb = _process_traceback_frames(e.traceback) 68 # To get the full stack trace, call: 69 # tf.debugging.disable_traceback_filtering() ---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tb

File ~/miniconda/envs/deeptrackCurrent/lib/python3.11/site-packages/deeptrack/models/gnns/generators.py:153, in ContinuousGraphGenerator.getitem(self, idx) 152 def getitem(self, idx): --> 153 batch, labels = super().getitem(idx) 155 # Extracts minimum number of nodes in the batch 156 numofnodes = list(map(lambda _batch: np.shape(_batch[0])[0], batch))

File ~/miniconda/envs/deeptrackCurrent/lib/python3.11/site-packages/deeptrack/generators.py:367, in ContinuousGenerator.getitem(self, idx) 357 return ( 358 tuple( 359 [ (...) 364 np.array(labels), 365 ) 366 else: --> 367 return np.array(data), np.array(labels)

File ~/miniconda/envs/deeptrackCurrent/lib/python3.11/site-packages/deeptrack/image.py:317, in Image.array(self, *args, *kwargs) 315 def array(self, args, **kwargs): 316 """Convert to numpy array.""" --> 317 return np.array(self.to_numpy()._value)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.

akilgall commented 1 year ago

This is resolved by a combination of python 3.7 and numpy 1.21.6 in the environment before installation. There are undoubtedly other combinations but this configuration is suitable for me currently.

conda create --name test python=3.7 conda activate test pip install numpy pip install deeptrack