This project focuses on kidney ultrasound image segmentation using Patch-Level Contrastive Learning (PLCL) and the ST++ method to enhance the learning process. The PLCL Loss function is implemented based on the approach described in the PatchCL-MedSeg repository. The ST++ method further improves semi-supervised learning by leveraging unlabeled data effectively.
- Patch-Level Contrastive Learning: Improves feature representation for medical image segmentation tasks.
- Kidney Ultrasound Segmentation: Specifically tailored for kidney ultrasound images.
-
Clone the repository:
git clone https://github.com/Yang-ChiaHsiang/SSL-CL-RUS.git cd SSL-CL-RUS -
Install the required dependencies:
pip install -r requirements.txt
The segmentation label dataset follows the PASCAL VOC Dataset format. Below are the steps to preprocess the data:
-
Dataset Splitting: Use the script
./data_preprocessing/1_dataset_split.pyto split the dataset intolabeled.txtandtest.txt. -
Create Unlabeled Dataset: Run the script
2_create_unlabeled_data.pyto generate the unlabeled dataset. -
Data Preprocessing: Execute
3_data_preprocessing.pyto further split the data intotrain.txtandval.txt. Example usage:python data_preprocessing.py \ --dataset_path ~/Dataset/0_data_dataset_voc_950 \ --voc_output_dir dataset/splits/kidney \ --voc_splits 500 \ --crop_output_dir data/0_data_dataset_voc_950 \ --img_size 448
To train the model using the Patch-Level Contrastive Learning (PLCL) approach and the ST++ method, follow the steps below:
-
Set the number of unlabeled samples and dataset name as environment variables:
export semi_setting='kidney' export unlabeled_num=900
-
Run the training script with the specified parameters:
CUDA_VISIBLE_DEVICES=0,1 python -W ignore main.py \ --dataset kidney --data-root data/0_data_dataset_voc_950 \ --batch-size 64 --backbone resnet18 --model deeplabv3plus \ --labeled-id-path dataset/splits/$semi_setting/train.txt \ --unlabeled-id-path dataset/splits/$semi_setting/$unlabeled_num/unlabeled.txt \ --reliable-id-path outdir/reliable_ids/$semi_setting/$unlabeled_num \ --pseudo-mask-path outdir/pseudo_masks/$semi_setting/$unlabeled_num \ --save-path outdir/models/$semi_setting --num-unlabeled $unlabeled_num\ --plus \ --PatchCL --contrastiveWeights 0.2 --patch-size 112
This script trains the model using a semi-supervised learning approach, leveraging both labeled and unlabeled data. The PatchCL flag enables Patch-Level Contrastive Learning, which enhances feature representation for segmentation tasks.
This project is inspired by the work in the PatchCL-MedSeg repository. Special thanks to the contributors of that project for their valuable insights.
This project is licensed under the MIT License. See the LICENSE file for details.
If you use this codebase or any part of it in your research, please kindly cite the following paper:
@inproceedings{yang2025sslclrus,
title={SSL-CL-RUS: A Semi-Supervised Framework for Renal Ultrasound Segmentation in CKD: Combining Pseudo-Label Guided Contrastive Learning with ST++},
author={Yang, Chia-Hsiang and Tseng, Wei-Cheng and Chen, Yi-Chin and He, Jing-Ru and Liang, Kung-Hao and Huang, Yen-Hua},
booktitle={2025 47th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC)},
pages={1--7},
year={2025},
organization={IEEE},
doi={10.1109/EMBC58623.2025.11253499}
}
We appreciate your support and contributions!
