-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hello, thank you very much for releasing the hover_next_train repository.
I am currently adapting Hover-Next for a single-class nuclei segmentation task (cell01 segmentation). However, during training the model fails to detect any foreground and the predictions remain almost entirely background. I have checked data loading, normalization, loss functions, and optimizer setup on my side, but I still cannot determine where the problem originates.
To help me integrate and debug the model correctly, could you please help with the following request?
Request
Could you provide a simplified version of the Hover-Next model in a single Python file (or a minimal working example), with a clean function interface such as:
from hovernext import get_model
model = get_model(num_classes=1)
so that I can directly import and train the model on my dataset?
What I uploaded
I have attached my current attempt to this issue for your convenience:
hovernext_singlefile.py — my consolidated single-file version of the model (the file contains my attempt to assemble the model and provide get_model()).
train_debug.py — a minimal training script I used for debugging (data loading, normalization, loss, optimizer, and a small train loop).
(If the file names differ, please see the attached files in this issue.)
What I would appreciate you checking
If you have time, could you please review the attached files and advise on or fix any of the following likely causes:
Whether the model definition (forward, heads, concatenation of outputs) is correctly implemented for training on a single-class segmentation task.
Expected input preprocessing (channel number, mean/std normalization) and whether any special preprocessing is required for the encoder.
Correct output shape and how you expect losses to be computed for multi-head outputs (e.g., BCE per head vs. softmax).
Any initialization details, decoder/head construction, or other components distributed across the original repo that I might have missed.
Any other obvious mistakes in my single-file consolidation that would explain why the network predicts only background.
Quick reproduction notes
Task: single-class nuclei segmentation (binary foreground/background).
Observed behavior: predictions ≈ background; training does not learn foreground.
I attempted common fixes (tile grayscale -> 3 channels, ImageNet normalization, BCEWithLogitsLoss, Adam optimizer), but still fail to get foreground predictions.
If it's easier for you, a minimal “correct” single-file version (with a get_model() factory) or a short example showing model initialization + minimal training loop against a toy batch would be extremely helpful.
Thank you very much for your time and for sharing this excellent work. I appreciate any guidance or fixes you can provide.
Best regards.
HoverNext.py