kreshuklab / plant-seg

A tool for cell instance aware segmentation in densely packed 3D volumetric images
https://kreshuklab.github.io/plant-seg/
MIT License
89 stars 30 forks source link

Help to choose the correct scale to apply the network #189

Open Buglakova opened 5 months ago

Buglakova commented 5 months ago

To get the correct segmentation it's important that the objects on the new image are approximately the same size as in the training data. This doesn't necessarily mean that the voxel size should be the same. For example, if I apply the same generic_plant_nuclei_3D to an image scaled differently, I can get results as different as the following: raw Screenshot from 2024-01-29 12-25-14 nuclei channel of prediction Screenshot from 2024-01-29 12-24-39 nuclei channel of prediction for a rescaled image Screenshot from 2024-01-29 12-24-23

Suggestion: add a function similar to Cellpose's average diameter. Make a look up table for each available model with an average size of the segmented objects, then suggest the user to estimate the expected size in their data and get the rescale factors from this. For example, a model was trained on the ground truth where average nuclei size in pixels was (50, 50, 50). In user's data the size is (10, 100, 100) (estimated by just counting pixels in the image). Then suggest rescaling with factors (5, 0.5, 0.5).

The way that it is now it's not obvious that correct scaling is important, so a non-expert user can just decide that none of the networks work for them.

qin-yu commented 1 month ago

According to Lorenzo, this was in fact a feature since the beginning of PlantSeg. It has been improved in #249 in response to this issue, and I think it will be merged into master tomorrow.

qin-yu commented 1 month ago

This recent improvement in the documentation is a step in the right direction, though it does not completely resolve the issue.

image