pip install -r requirements.txt
- ControlVideo https://github.com/YBYBZhang/ControlVideo
- CMMD-pytorch https://github.com/sayakpaul/cmmd-pytorch (for fidelity evaluation)
- Rendezvouz (RDV) https://github.com/CAMMA-public/rendezvous (for factual correctness evaluation)
- CholecT45, CholecT50 and Cholec80: available at http://camma.u-strasbg.fr/datasets
All our resulting model weights will be released after the anonymous review period of MICCAI 2024. Those include weights for:
- StableDiffusion
- ControlNet
- RDV for 128x128 images (for evaluation)
- YOLOv8 model (for surgical tool segmentation)
There are some placeholders in all scripts, replace them with your own values (such as paths, prompts, parameters etc.) beforehand.
- Download CholecT50 and Cholec80.
- Run
data_processing/prepare_cholect50.pyanddata_processing/prepare_cholec80.pyto create the training dataset. - Run training with
run_stablediffusion_training.sh.
- Run
evaluation/create_controlnet_datasets.py(once for train and once for test). - Run training with
run_controlnet_training.sh.
- StableDiffusion inference script:
model_scripts/sd_inference.py. - ControlNet inference script:
model_scripts/sd_inference.py. - For ControlVideo, clone the repository and replace models in inference scripts with our custom models.
- Run
evaluation/fidelity_eval_datasets.pyto generate synthetic dataset from themetadata.csvfile created duringdata_processing/prepare_cholect50.py.
For ControlNet runevaluation/controlnet_eval_datasets.py, generates the data from atest.jsonlfile that can be created by runningdata_processing/create_controlnet_dataset.py. - Run
evaluation/eval_fidelity.py, providing the path to the synthetic data to be evaluted. - Results are saved to a
.jsonfile.
- Run
evaluation/create_rdv_testset.ipynbnotebook. - Clone RDV and modify dataloader to include the created testset.
- Run RDV test script.
evaluation/controlnet_eval_datasets.pygenerates segmentation labels compatible with YOLOv8- Do an eval run according to YOLOV8 documentation (using our finetuned YOLOv8 model): https://docs.ultralytics.com/tasks/segment/#models