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

The new cyto2 network cannot be used from command line #257

Closed
thosoo opened this issue May 4, 2021 · 7 comments
Closed

The new cyto2 network cannot be used from command line #257

thosoo opened this issue May 4, 2021 · 7 comments

Comments

@thosoo
Copy link

thosoo commented May 4, 2021

in __main__.py:

if not (args.pretrained_model=='cyto' or args.pretrained_model=='nuclei'):
                cpmodel_path = args.pretrained_model
                if not os.path.exists(cpmodel_path):
                    logger.warning('model path does not exist, using cyto model')
                    args.pretrained_model = 'cyto'

When adding --pretrained_model cyto2 in the command line, it will obviously not work.

However, I have not tried with the full path to the models yet.

@giocard
Copy link

giocard commented May 6, 2021

The issue is still not closed. I could use the cyto2 from command line by modifying

if args.pretrained_model=='cyto' or args.pretrained_model=='nuclei':
in the same way it has been already done for line 130.
if not (args.pretrained_model=='cyto' or args.pretrained_model=='nuclei' or args.pretrained_model=='cyto2'):

@carsen-stringer
Copy link
Member

I'm confused, does the github version work for you? if so I'll close the issue

@giocard
Copy link

giocard commented May 7, 2021

No, it doesn't. When running from command line, if the diameter is set to zero the program stops at line 147

diameter = model.diam_mean

because it thinks that is a model provided by the user, and therefore it expects the diameter.
What I was trying to say in my previous post is that I had to fix line 142 by adding or args.pretrained_model=='cyto2' to make it work also under this condition. If I set the diameter to any positive value, the program runs fine.

@giocard
Copy link

giocard commented May 7, 2021

I forgot to mention that in any case, even with a model provided by the user, the program would fail if the input diameter is set to zero, because of the following error at line 147

UnboundLocalError: local variable 'model' referenced before assignment

@carsen-stringer
Copy link
Member

ah good catch, please try now

@giocard
Copy link

giocard commented May 7, 2021

I did a few tests and it seems to be fixed now. Thanks!

@carsen-stringer
Copy link
Member

thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants