How suhas-srinath/genselfdiff-his works
Project’s Main Components
• Data Pre-processing:
• This module handles data ingestion and preparation from various sources (e.g., GlaS, HN, MoNuSeg).
• In the file tree, the “pre_process” directory (with subfolders for each dataset) houses Python scripts converting images (bmp_to_jpg.py, xml_to_segmask.py, image_labels.py) and patch generation (train, test, unlabel tasks).
• Pre-training (Generative Self-supervision using Diffusion):
• Located in “GenSelfDiff/pretrain”, this contains scripts like SS_diff.py, model.py, and utils.py where the diffusion-based generative model is implemented.
• This is the stage where unlabeled data is used to train the diffusion model as a pretext task.
• Downstream Training for Segmentation:
• Found in “GenSelfDiff/downstream_train”, where the segmentation-specific training happens using a diffusion pre-trained model.
• Key files include Diff_Seg.py, losses.py, and model.py, which likely incorporate multi-loss optimization to fine-tune the segmentation task.
• Evaluation and Testing:
• Residing in “GenSelfDiff/test”, components like test_script.py and metrics.py allow evaluation on segmentation performance.
• Additional/Utility Modules:
• Standalone scripts like image_generation.py, HE_diff_general.py, and sample_images*.py suggest auxiliary functionalities or experiments.
• The “utils_general.py” file provides helper routines that might be used across different stages.
Relationships and Data Flow
• Data flows into the Data Pre-processing component where images are transformed, normalized, or split into patches.
• The pre-processed data then feeds into the Pre-training module, where the generative diffusion model learns self-supervised representations.
• The scored pre-trained model is used for the Downstream Training phase to fine-tune the segmentation performance with supervised signals.
• Finally, the Evaluation module uses the produced segmentation outputs to compute metrics and assess system performance.
Architectural Patterns and Technologies
• The project uses a staged learning approach: a self-supervised (pre-training) stage followed by a downstream supervised segmentation training stage.
• Diffusion models form the core of the generative self-supervision, which is a key novel idea.
• There is an emphasis on modular design: pre-processing, training, and evaluation are clearly separated, suggesting a pipeline or orchestrated workflow.