Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected keyword argument 'net_avg' error when loading cellpose model #481

Open
ptlzon opened this issue Feb 19, 2024 · 5 comments
Open
Labels
🐛 Bug Something isn't working

Comments

@ptlzon
Copy link

ptlzon commented Feb 19, 2024

Description:

after settings parameters in cellpose parameters window, error appeared.

image

Way to reproduce:

No response

(Optional) Link to data to reproduce error:

No response

Terminal output:

19-02-2024, 17:03:21 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initializing GUI v1.4.20
------------------------

19-02-2024, 17:03:21 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initiliazing profilers...
------------------------

19-02-2024, 17:03:22 - cellacdc-logger-acdc_gui - INFO:
------------------------
GUI ready.
------------------------

19-02-2024, 17:03:24 - cellacdc-logger-acdc_gui - INFO:
------------------------
Asking to select a folder path...
------------------------

19-02-2024, 17:03:26 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loading from D:/tmp/grayscale/train/20240219_161436_acdc/Images
------------------------

19-02-2024, 17:03:26 - cellacdc-logger-acdc_gui - INFO:
------------------------
Using .tif file (D:/tmp/grayscale/train/20240219_161436_acdc/Images\22-696-2_001.tif)...
------------------------

19-02-2024, 17:03:26 - cellacdc-logger-acdc_gui - INFO:
------------------------
Reading  channel metadata...
------------------------

19-02-2024, 17:03:26 - cellacdc-logger-acdc_gui - INFO:
------------------------
Lazy loader paused.
------------------------

19-02-2024, 17:03:26 - cellacdc-logger-acdc_gui - INFO:
------------------------
Closing lazy loader...
------------------------

19-02-2024, 17:03:27 - cellacdc-logger-acdc_gui - INFO:
------------------------
Segmentation filename: D:/tmp/grayscale/train/20240219_161436_acdc/Images\22-696-2_001_segm.npz
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loading 20240219_161436_acdc\Images\22-696-2_001.tif...
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loaded paths:
Segmentation file name: 22-696-2_001_segm.npz
ACDC output file name 22-696-2_001_acdc_output.csv
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Full dataset shape = Not Loaded
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loaded dataset shape = (1, 2304, 3072)
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Number of frames = 1
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Number of z-slices per frame = 1
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Creating graphical items...
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initializing measurements...
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Setting GUI mode to "Snapshots"...
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
20240219_161436_acdc || Basename: 22-696-2_001 || Segmented channel:  || Segmentation file name: _segm.npz
------------------------

19-02-2024, 17:03:28 - cellacdc-logger-acdc_gui - INFO:
------------------------
Autosaving worker started.
------------------------

19-02-2024, 17:03:35 - cellacdc-logger-acdc_gui - INFO:
------------------------
Importing cellpose...
------------------------

19-02-2024, 17:03:48 - cellacdc-logger-acdc_gui - ERROR:
------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2592, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 368, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13719, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2863, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'

------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2592, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 368, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13719, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2863, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'
19-02-2024, 17:03:48 - cellacdc-logger-acdc_gui - INFO:
------------------------
====================================
WARNING: Cell-ACDC is in error state. Please, restart.
====================================
------------------------

19-02-2024, 17:05:05 - cellacdc-logger-acdc_gui - ERROR:
------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2592, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 368, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13719, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2863, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'

------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2592, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 368, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13719, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2863, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'
19-02-2024, 17:05:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
====================================
WARNING: Cell-ACDC is in error state. Please, restart.
====================================
------------------------

Version information:

(acdc) D:\tmp>python -c "import sys; print(sys.version); import platform; print(platform.platform()); import cellacdc; print(f'Cell-ACDC version: {cellacdc.__version__}')"
3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:29:04) [MSC v.1929 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
Cell-ACDC version: 1.4.20
@ptlzon ptlzon added the 🐛 Bug Something isn't working label Feb 19, 2024
@ElpadoCan
Copy link
Collaborator

ElpadoCan commented Feb 19, 2024

Hi @ptlzon, I see that you have Cell-ACDC version v1.4.20 and Cellpose v3 is not available with that version. Unfortunately, I did not realize that your version would install latest cellpose even if not compatible, sorry about that.

To fix this, I just released a new version v1.4.21 which is compatible with cellpose v3.

To upgrade activate the acdc environment and then run the command python -m pip install --upgrade cellacdc. Let me know if it works and thank you for your patience!

Best,
Francesco

@ptlzon
Copy link
Author

ptlzon commented Feb 19, 2024

Hi @ElpadoCan

The cellacdc v1.4.21 fixed the loading of SAM, but the error of Cellpose above still persisted.

Log

20-02-2024, 08:23:58 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initializing GUI v1.4.21
------------------------

20-02-2024, 08:23:58 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initiliazing profilers...
------------------------

20-02-2024, 08:23:58 - cellacdc-logger-acdc_gui - INFO:
------------------------
GUI ready.
------------------------

20-02-2024, 08:24:03 - cellacdc-logger-acdc_gui - INFO:
------------------------
Asking to select a folder path...
------------------------

20-02-2024, 08:24:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loading from D:/tmp/grayscale/20240220_082140_acdc/Images
------------------------

20-02-2024, 08:24:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
Using .tif file (D:/tmp/grayscale/20240220_082140_acdc/Images\9Z15003-1_crop.tif)...
------------------------

20-02-2024, 08:24:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
Reading  channel metadata...
------------------------

20-02-2024, 08:24:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
Lazy loader paused.
------------------------

20-02-2024, 08:24:05 - cellacdc-logger-acdc_gui - INFO:
------------------------
Closing lazy loader...
------------------------

20-02-2024, 08:24:06 - cellacdc-logger-acdc_gui - INFO:
------------------------
Segmentation filename: D:/tmp/grayscale/20240220_082140_acdc/Images\9Z15003-1_crop_segm.npz
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loading 20240220_082140_acdc\Images\9Z15003-1_crop.tif...
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loaded paths:
Segmentation file name: 9Z15003-1_crop_segm.npz
ACDC output file name 9Z15003-1_crop__acdc_output.csv
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Full dataset shape = Not Loaded
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Loaded dataset shape = (1, 424, 567)
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Number of frames = 1
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Number of z-slices per frame = 1
------------------------

20-02-2024, 08:24:08 - cellacdc-logger-acdc_gui - INFO:
------------------------
Creating graphical items...
------------------------

20-02-2024, 08:24:09 - cellacdc-logger-acdc_gui - INFO:
------------------------
Initializing measurements...
------------------------

20-02-2024, 08:24:09 - cellacdc-logger-acdc_gui - INFO:
------------------------
Setting GUI mode to "Snapshots"...
------------------------

20-02-2024, 08:24:09 - cellacdc-logger-acdc_gui - INFO:
------------------------
20240220_082140_acdc || Basename: 9Z15003-1_crop || Segmented channel:  || Segmentation file name: _segm.npz
------------------------

20-02-2024, 08:24:09 - cellacdc-logger-acdc_gui - INFO:
------------------------
Autosaving worker started.
------------------------

20-02-2024, 08:24:15 - cellacdc-logger-acdc_gui - INFO:
------------------------
Importing cellpose...
------------------------

20-02-2024, 08:24:32 - cellacdc-logger-acdc_gui - ERROR:
------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2593, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 372, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13807, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2595, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'

------------------------
Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2593, in init_segm_model
    model = acdcSegment.Model(**init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\models\cellpose\acdcSegment.py", line 35, in __init__
    self.model = models.CellposeModel(
TypeError: __init__() got an unexpected keyword argument 'net_avg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\__init__.py", line 372, in inner_function
    result = func(self, *args, **kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\gui.py", line 13807, in repeatSegm
    model = myutils.init_segm_model(acdcSegment, posData, win.init_kwargs)
  File "D:\miniconda3_windows\envs\acdc\lib\site-packages\cellacdc\myutils.py", line 2595, in init_segm_model
    model = acdcSegment.Model(segm_data, **init_kwargs)
TypeError: __init__() got multiple values for argument 'model_type'
20-02-2024, 08:24:32 - cellacdc-logger-acdc_gui - INFO:
------------------------
====================================
WARNING: Cell-ACDC is in error state. Please, restart.
====================================
------------------------

20-02-2024, 08:25:01 - cellacdc-logger-acdc_gui - INFO:
------------------------
Closing autosaving worker...
------------------------

20-02-2024, 08:25:01 - cellacdc-logger-acdc_gui - INFO:
------------------------
Autosaving worker closed.
------------------------

20-02-2024, 08:25:01 - cellacdc-logger-acdc_gui - INFO:
------------------------
Clearing memory...
------------------------

20-02-2024, 08:25:01 - cellacdc-logger-acdc_gui - INFO:
------------------------
Closing GUI logger...
------------------------

Version info

(acdc) C:\Users\Z036650>python -c "import sys; print(sys.version); import platform; print(platform.platform()); import cellacdc; print(f'Cell-ACDC version: {cellacdc.__version__}')"
3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:29:04) [MSC v.1929 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
Cell-ACDC version: 1.4.21

@ElpadoCan
Copy link
Collaborator

Hi @ptlzon, something went wrong with the release of v1.4.21 .

I fixed it now and I released v1.4.23. To upgrade activate the acdc environment and run python -m pip install --upgrade cellacdc.

As explained in #482 you can now run SAM with input points. Let me know if it works, thanks!

@ptlzon
Copy link
Author

ptlzon commented Feb 21, 2024

Hi @ElpadoCan

Thanks for the amazingly quick fix.
Both cellpose v2 and cellpose v3 work as my expectation now.
Thanks a lot.

I will reply about SAM input points in that thread.

@ElpadoCan
Copy link
Collaborator

Nice, good to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants