HenriquesLab / ZeroCostDL4Mic

ZeroCostDL4Mic: A Google Colab based no-cost toolbox to explore Deep-Learning in Microscopy
MIT License
565 stars 129 forks source link

StarDist_2D -- on official sample data prediction fails with "TypeError" inside "big.py" #262

Closed fjug closed 10 months ago

fjug commented 1 year ago

Describe the bug Training works flawlessly on the two "Training*" folders. Cell 6.2, unfortunately, leads to an error, namely:

Performing prediction on: cell migration R1 - Position 58_XY1562686154_Z0_T00_C1-image86.tif
Image dimension (1024, 1024)
Normalizing image channels independently
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-17-7da691dacc78>](https://t05ozn65qx-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230413-060131-RC00_523964412#) in <cell line: 85>()
    119 
    120 
--> 121   labels, polygons = model.predict_instances_big(img, axes=axes, block_size=block_size, min_overlap=min_overlap, context=None,
    122                                             normalizer=normalizer, show_progress=True, n_tiles=n_tiles)
    123 

2 frames
[/usr/local/lib/python3.9/dist-packages/stardist/big.py](https://t05ozn65qx-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20230413-060131-RC00_523964412#) in _grid_divisible(grid, size, name, verbose)
    588 
    589 def _grid_divisible(grid, size, name=None, verbose=True):
--> 590     if size % grid == 0:
    591         return size
    592     _size = size

TypeError: unsupported operand type(s) for %: 'tuple' and 'int'

I don't see how to fix this and would appreciate some help (we plan to use this notebook in a course coming Monday). 😮 😉

To Reproduce Steps to reproduce the behavior:

  1. Download sample data
  2. Start notebook, train on sample data (I did not execute the quality control section)
  3. Try to predict the "Test - Images" folder...
  4. See error

Expected behavior It should just work... 😉

Desktop (please complete the following information):

Thanks a lot for your help!

fjug commented 1 year ago

Little comment: thinking about how to explain students what is going on in Section 6.2... not easy. Actually I have no clue myself what block_size, overlap, and n_tiles mean and how to set them correctly depending on my test data... 🤷

fjug commented 1 year ago

Another comment: since 6.1 works perfectly fine, don't stress yourself fixing anything with 6.2... the course will be fine... 😉

esgomezm commented 10 months ago

Hi Florian! Thank you! I've been using this one recently and worked well for me. Regarding the parameters you mentioned, they are meant to manage the tiling. The description is indeed quite broad but I'm not sure what's the best way to go with this one in terms of explaining image tiling briefly and still make some sense.