Original Paper: BCI: Breast Cancer Immunohistochemical Image Generation through Pyramid Pix2pix
Enhanced Implementation: This repository contains a scientifically rigorous implementation of the BCI framework, augmented with Uncertainty Quantification and Perceptual Metrics.
In medical imaging, a generative model must be trustworthy. We implement Monte Carlo Dropout inference to generate Uncertainty Maps.
- Dark Areas: High confidence (Model is sure).
- Bright Areas: High specific uncertainty (Model is hallucinating or unsure about tissue details). This allows pathologists to identify regions where the synthetic IHC image might be unreliable.
Standard PSNR/SSIM metrics favor blurry images. We integrate LPIPS (Learned Perceptual Image Patch Similarity) to measure texture fidelity, which is critical for identifying cancerous cells.
- Config-based Experiments:
configs/config.yamlreplaces messy command-line arguments. - Package Structure: Modular
src/layout for better maintainability.
git clone https://github.com/mara-werils/BCI-Project.git
cd BCI-Enhanced
pip install -r requirements.txtTrain the model using the configuration file:
python train_net.py --config configs/config.yamlCalculate PSNR, SSIM, and LPIPS:
python src/core/evaluate.py --result_path ./results/pyramidpix2pix --gpuGenerate Uncertainty Maps for the test set:
python src/core/visualize_uncertainty.py --dataroot ./datasets/BCI --name bci_experiment_v1Results will be saved in results/bci_experiment_v1/uncertainty/.
├── configs/ # Configuration files
├── src/
│ ├── core/ # Core scripts (train, evaluate, uncertainty)
│ ├── data/ # Dataset loading logic
│ ├── metrics/ # Scientific metrics (LPIPS)
│ ├── models/ # PyTorch models (Pyramid Pix2pix)
│ ├── options/ # Argument parsers
│ └── utils/ # Helper utilities
├── tests/ # Automated tests
└── train_net.py # Main entry point
If you use this enhanced repository, please cite the original paper and this implementation:
@inproceedings{Liu_2022_CVPR,
author = {Liu, Shengjie and Zhu, Chuang and Xu, Feng and Jia, Xinyu and Shi, Zhongyue and Jin, Mulan},
title = {BCI: Breast Cancer Immunohistochemical Image Generation Through Pyramid Pix2pix},
booktitle = {CVPR Workshops},
year = {2022}
}