fractal-analytics-platform / fractal-client

Command-line client for Fractal
https://fractal-analytics-platform.github.io/fractal-client
BSD 3-Clause "New" or "Revised" License
45 stars 1 forks source link

Try/expose several cellpose models, for labeling #110

Closed tcompa closed 2 years ago

tcompa commented 2 years ago

Finally, we may want to switch the cellpose model being used. Currently, we use the nuclei model (see here: https://github.com/fractal-analytics-platform/fractal/blob/6fc6a7b140548f9c056c89ada240c04202bf8f53/fractal/tasks/image_labeling_whole_well.py#L93). It will be interesting to try a few of their default models (e.g. the cyto2 model may perform better on this task) :slightly_smiling_face: . If it makes a difference, model choice could be exposed to the user

jluethi commented 2 years ago

Available options are: 'cyto', 'nuclei' and 'cyto2'. (anything else would not work)

tcompa commented 2 years ago

This is now in-place (for both labeling tasks), to be tested. In the example folders, one may add the "model_type" key in the parameter file, as in

{
"workflow_name": "uzh_1_well_2x2_sites",
"dims": [2, 2],
"coarsening_xy": 2,
"coarsening_z": 1,
"num_levels": 5,
"channel_file": "../wf_params_uzh_cardiac_channels.json",
"path_dict_corr": "../wf_params_uzh_cardiac_illumination.json",
"image_labeling": {"coarsening_xy": 2, "labeling_level": 0, "labeling_channel": "A01_C01", "num_threads": 2, "relabeling": 1, "anisotropy": 6.1538, "diameter": 35.0, "cellprob_threshold": 0.0},
"image_labeling_whole_well": {"model_type": "cyto", "coarsening_xy": 2, "labeling_level": 2, "labeling_channel": "A01_C01", "diameter_level0": 35.0, "cellprob_threshold": 0.0,}
}
tcompa commented 2 years ago

Just as a test, I ran a {1 well, 2x2 sites, 10 Z planes} example with arbitrary model_type's: cyto for the per-FOV labeling, and cyto2 for the per-well labeling.

The runtime is a bit different than for nuclei (it is actually a bit longer, in this case, with single FOVs labeled in about 10 minutes instead of about 4-5 minutes), but the run went through.

The output is reasonable (see two regions of the 3D and MIP labeling):

Screenshot from 2022-07-18 16-50-36

Screenshot from 2022-07-18 16-47-56

tcompa commented 2 years ago

The feature is in-place and one example run went through, I'm closing this issue. Re-open if needed.