DeepTrackAI / DeepTrack2

DeepTrack2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError with deeptrack.Combine in cell counting

lkhangkv1995 opened this issue · comments

Hi. I'm trying to reproduce the code of 6_cell_counting.ipynb
When I run this cell:

normalization = dt.NormalizeMinMax()

blurred_validation_mask = validation_mask + png_to_mask 
normalized_validation_image = validation_image + normalization
validation_dataset = dt.Combine([normalized_validation_image, blurred_validation_mask]) 
blurred_test_mask = test_mask + png_to_mask
normalized_test_image = test_image + normalization
test_dataset = dt.Combine([normalized_test_image, blurred_test_mask])

I get the AttributeError:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [13], in <cell line: 5>()
      3 blurred_validation_mask = validation_mask + png_to_mask 
      4 normalized_validation_image = validation_image + normalization
----> 5 validation_dataset = dt.Combine([normalized_validation_image, blurred_validation_mask]) 
      6 blurred_test_mask = test_mask + png_to_mask
      7 normalized_test_image = test_image + normalization

File ~/ideas/DeepTrack/venv/lib/python3.8/site-packages/deeptrack/features.py:999, in Combine.__init__(self, features, **kwargs)
    998 def __init__(self, features: List[Feature], **kwargs):
--> 999     self.features = [self.add_feature(f) for f in features]
   1000     super().__init__(**kwargs)

File ~/ideas/DeepTrack/venv/lib/python3.8/site-packages/deeptrack/features.py:999, in <listcomp>(.0)
    998 def __init__(self, features: List[Feature], **kwargs):
--> 999     self.features = [self.add_feature(f) for f in features]
   1000     super().__init__(**kwargs)

File ~/ideas/DeepTrack/venv/lib/python3.8/site-packages/deeptrack/features.py:274, in Feature.add_feature(self, feature)
    272 """Adds a feature to the dependecy graph."""
    273 feature.add_child(self)
--> 274 self.add_dependency(feature)
    275 return feature

File ~/ideas/DeepTrack/venv/lib/python3.8/site-packages/deeptrack/backend/core.py:160, in DeepTrackNode.add_dependency(self, other)
    159 def add_dependency(self, other):
--> 160     self.dependencies.add(other)
    162     return self

File ~/ideas/DeepTrack/venv/lib/python3.8/site-packages/deeptrack/features.py:460, in Feature.__getattr__(self, key)
    458         raise AttributeError
    459 else:
--> 460     raise AttributeError

AttributeError: 

Can you help me to define what is going on?
Thank you very much.

Hi! It seems like you are using a new version of deeptrack with an old version of the notebook. Either pull the latest version of the notebook from github or downgrade deeptrack to 0.x.x (0.11.5 should be fine)

Thank you! That works perfectly.