BiaPyX / BiaPy

Open source Python library for building bioimage analysis pipelines
https://BiaPyX.github.io
MIT License
123 stars 28 forks source link

bug: Biapy crashes with detection workflow on latest branch #74

Closed pr4deepr closed 6 months ago

pr4deepr commented 6 months ago

Hi I installed the latest branch of BiaPy from github and ran a workflow for detection.

I got the following error:

[06:59:18.885498] ##############################
[06:59:18.889505] #  PREPARE TRAIN GENERATORS  #
[06:59:18.890497] ##############################
[06:59:18.892500] Initializing train data generator . . .
[06:59:18.908179] Checking which channel of the mask needs normalization . . .
[06:59:20.994035] Normalization config used for X: {'type': 'div', 'orig_dtype': dtype('uint16'), 'reduced_uint16': 1}
[06:59:20.995028] Normalization config used for Y: as_mask
[06:59:20.999033] Initializing val data generator . . .
Traceback (most recent call last):
  File "C:\Users\rajasekhar.p\BiaPy\main.py", line 51, in <module>
    _biapy.run_job()
  File "C:\Users\rajasekhar.p\BiaPy\biapy\_biapy.py", line 412, in run_job
    self.train()
  File "C:\Users\rajasekhar.p\BiaPy\biapy\_biapy.py", line 152, in train
    self.workflow.train()
  File "C:\Users\rajasekhar.p\BiaPy\biapy\engine\base_workflow.py", line 492, in train
    self.prepare_train_generators()
  File "C:\Users\rajasekhar.p\BiaPy\biapy\engine\base_workflow.py", line 315, in prepare_train_generators
    self.num_training_steps_per_epoch = create_train_val_augmentors(self.cfg, self.X_train, self.Y_train,
  File "C:\Users\rajasekhar.p\BiaPy\biapy\data\generators\__init__.py", line 214, in create_train_val_augmentors
    val_generator = f_name(**dic)
  File "C:\Users\rajasekhar.p\BiaPy\biapy\data\generators\pair_data_3D_generator.py", line 24, in __init__
    super().__init__(**kwars)
  File "C:\Users\rajasekhar.p\BiaPy\biapy\data\generators\pair_base_data_generator.py", line 416, in __init__
    if _X.ndim != (self.ndim+2):
AttributeError: 'NoneType' object has no attribute 'ndim'

This was fixed when I installed from the branch associated with the released version of 3.3.15. I am using a Windows 11 PC. I used the default 3d_detection.yml configuration file from Biapy and only added following augmentation:

    DA_PROB: 0.5
    ENABLE: True
    VFLIP: True
    HFLIP: True
    ZFLIP: True
    GAUSSIAN_NOISE: True
    POISSON_NOISE: True
    BRIGHTNESS: True
    BRIGHTNESS_MODE: '3D'

Cheers Pradeep

danifranco commented 6 months ago

Hello,

Thank you so much for catching the error. I made a mistake in recent changes on that branch. The problem now is solved in the last commit. Feel free to close the issue!

Cheers,