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

Working cellpose-python and stardist tests #11

Merged
merged 4 commits into from
Dec 5, 2023
Merged

Conversation

jmetz
Copy link
Collaborator

@jmetz jmetz commented Nov 7, 2023

NOTE: This is not ready to merge

@jmetz
Copy link
Collaborator Author

jmetz commented Nov 10, 2023

Hey @oeway - I think this looks mostly reasonable now (though let me know if you want me to remove imjoy.io from the server list).

@jmetz jmetz requested a review from oeway November 10, 2023 16:08
@jmetz jmetz changed the title Working cellpose-python test, stardist is WIP Working cellpose-python and stardist tests Nov 10, 2023
decode_json=True
)
mask = ret['mask'][0]
print("Model test passed: ", "Cellpose using cellpose-python")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some assert statements here to check the mask shape etc.? There should be a success key, and if it's false, there should be an error key to get the stack trace.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the mask access fail if the process failed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah, can check for a success key and get it's value too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no success field... the return value is:

{
'mask': array([[0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       ...,
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0]], dtype=int32), 
 '__info__': {
     'model_name': 'stardist', 
     'model_version': '1', 
     'outputs': [
         {'name': 'mask', 
           'datatype': 'INT32', 
           'shape': [349, 467], 
           'parameters': {'binary_data_size': 651932}
          }
       ]
    }
}

Copy link
Collaborator Author

@jmetz jmetz Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So checking that the mask exists and contains a 2d array is probably about as good a check as we can do. Presumably it should have the same shape as the input?

NB: this is stardist not the bioengine-model-runner

Copy link
Collaborator Author

@jmetz jmetz Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added shape tests... stardist was fine, but cellpose-python returns a stupid rolled-dimension array 🙄 :

 (1, 349, 467) != (349, 467, 3)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, ignore that. Upon closer paying attention, I get it 🤣 . The input is RGB, output is binary mask (and for some reason has to have the singleton dimension added).

@oeway
Copy link
Contributor

oeway commented Nov 10, 2023

Hey @oeway - I think this looks mostly reasonable now (though let me know if you want me to remove imjoy.io from the server list).

Looks good! I just added a comment. and we can keep ai.imjoy.io there.

@oeway oeway merged commit fcdb2eb into bioimage-io:main Dec 5, 2023
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants