vqdang / hover_net

Simultaneous Nuclear Instance Segmentation and Classification in H&E Histology Images.
MIT License
535 stars 224 forks source link

Using 512x512 pixel images and getting TypeError: 'NoneType' object is not subscriptable #161

Closed jorgegaticav closed 3 years ago

jorgegaticav commented 3 years ago

Hi! I am using 512x512 pixel images. I set win_size = [512, 512] and step_size = [164, 164] on extract_patches.py. So the patches are the same size as the images. I am using the fast model mode with the following values:

aug_shape = [512, 512] 
act_shape = [256, 256]  
out_shape = [164, 164]

When I run run_train.py I am getting this error.

----------------EPOCH 1
Processing: |          | 0/0[00:00<?,?it/s]Batch = nan|EMA = nan
Traceback (most recent call last):
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_train.py", line 306, in <module>
    trainer.run()
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_train.py", line 289, in run
    self.run_once(
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_train.py", line 266, in run_once
    main_runner.run(opt["nr_epochs"])
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_utils/engine.py", line 197, in run
    self.__trigger_events(Events.EPOCH_COMPLETED)
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_utils/engine.py", line 123, in __trigger_events
    callback.run(self.state, event)
  File "/cephyr/users/jorgeed/Alvis/segmentation/hover_net/run_utils/callbacks/base.py", line 229, in run
    raw_output = state.step_output["raw"]
TypeError: 'NoneType' object is not subscriptable
vqdang commented 3 years ago

Could you please check if you have provided the corrected input paths?

jorgegaticav commented 3 years ago

@vqdang Yes, the input is correct. I also tried with another dataset of 2000x2000 pixel images, and extracted patches of 540x540_164x164 and it works. I think there is something about the image size maybe? maybe should I try a different config?

vqdang commented 3 years ago

It's hard to say unless you drop into debug mode. I assumed that there were no data generated previously because the above log indicates the code jumping directly to callbacks after finishing an epoch. As long as aug_shape > act_shape then there should not be a problem.

vqdang commented 3 years ago

Will close the issue as it seems to be temporarily resolved.