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

Add foreground/background postprocessing #174

Open
wolny opened this issue Nov 30, 2023 · 2 comments
Open

Add foreground/background postprocessing #174

wolny opened this issue Nov 30, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@wolny
Copy link
Collaborator

wolny commented Nov 30, 2023

Some of the networks we have in plantseg output foreground probability maps together with boundary predictions. This can be used in the segmentation post-processing step in order to filter background instances (i.e. assign 0-label to pixels not belonging to foreground).

The easiest way to implement it as discussed with @lorenzocerrone and @qin-yu would be to add additional argument to segmentation functions in plantseg/segmentation/functional/segmentation.py called foreground_pmaps and apply filtering the output segmentation if the argument is present. Then support this parameter it in the config, legacy and napari GUI.

@qin-yu qin-yu self-assigned this Nov 30, 2023
@qin-yu qin-yu added the enhancement New feature or request label Jan 12, 2024
@qin-yu
Copy link
Collaborator

qin-yu commented Feb 19, 2024

I doubt if this is a good idea. If we are providing this option in each segmentation method, then testing different threshold requires re-runs of the whole segmentation algorithm.

For Napari interface, I would make it a widget similar to widget_fix_over_under_segmentation_from_nuclei() and put it in the same menu, "Extra-Seg".

@qin-yu
Copy link
Collaborator

qin-yu commented Feb 20, 2024

After careful thought, I decided to do versions of filtering by foreground:

  1. Threshold foreground to a mask and multiply with the segmentation pixel-wise (may loose details)
  2. Delete instances based centroids' value in foreground (not helpful if instances are not star-convex)
  3. Delete instances that has, say, 90% overlap with the background (I believe it's the best way)

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

No branches or pull requests

2 participants