-
Notifications
You must be signed in to change notification settings - Fork 545
Description
Before you fill out this form:
Did you review the FAQ?
- Yes, I reviewed the FAQ on the cellpose ReadTheDocs
Did you look through previous (open AND closed) issues posted on GH?
Now fill this form out completely:
Is your feature request related to a problem? Please describe.
We have been experimenting with enhancing preprocessing and postprocessing steps for Cellpose to see if we could further improve segmentation performance.
Our experiment involves the test sets from the Cellpose3, TissueNet 1.1, Omnipose fluorescent and phase-contrast bacterial datasets. We noticed that applying CLAHE (Contrast Limited Adaptive Histogram Equalization) as a preprocessing step improved performance on these subsets. We wanted to share these findings to see if this might be relevant or fit the roadmap of the project.
Describe the solution you'd like
We suggest adding CLAHE as an optional argument in normalize_img(...).
Describe alternatives you've considered
N/A
Additional context
we randomly sampled 100 image-mask pairs from the combined datasets mentioned above to search for optimal steps, and then evaluated those settings on the remaining data, with the metric of Average Precision at 0.5. Among the ~2000 functions our experiment searched, the top 20 performing ones all used CLAHE. Some applied CLAHE to all channels equally, some applied channel-specific operations. For example, the best performing function pairs improved the score from 0.402 (default Cellpose settings) to 0.417:
- For preprocessing, It applies CLAHE on the nucleus channel before running the 99 percentile based normalization:
scaled = np.clip(nucleus_ch * 255, 0, 255).astype(np.uint8) # Convert to uint8 for CLAHE
clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
eq = clahe.apply(scaled) # Apply CLAHE
nucleus_ch = eq.astype(np.float32) / 255.0 # Rescale back to [0,1] float32
# apply normalize99 and the remaining steps...- For postprocessing, it uses min_size= 48 and skips the hole filling step (not sure if this contributes directly towards the score or not, but figured this might be worth mentioning, as this is previously discussed in Add option not to fill masks. Compression to TIFF files. #884)
While this specific implementation requires channel-specific handling that may differ from the current pipeline, the results suggest that adding CLAHE might be beneficial and worth exploring. We wanted to document these findings in case they are useful for the community.