if changhao.zhang.24@ucl.ac.uk failed, please alternatively mail zch233@buaa.edu.cn or changhao.zhang@qq.com
SCARED/C3VD/Pitvis depth model
[https://drive.google.com/drive/folders/1ZQs3xetmPDhBd64OOs7K9E_HBfccCLwz?usp=drive_link]
This experiment implements an attention encoder with DoRA (Weight-Decomposed Low-Rank Adaptation) for endoscopic depth estimation:
- Main Entry Point:
train_attn_encoder_dora.py- Runs the complete experiment - Core Components:
src/trainer_attn_encoder.py- Main training logic with attention mechanismsdares/networks/dares_peft.py- DARES model with PEFT/DoRA supportendo3dac/utils/layers.py- SSI Loss implementation
Create a Python environment and install dependencies:
conda create -n attn_encoder_dora python=3.9
conda activate attn_encoder_dora
# Install PyTorch (adjust CUDA version as needed)
pip install torch torchvision torchaudio
# Install other dependencies
pip install numpy matplotlib pillow opencv-python
pip install tensorboard torchmetrics
pip install peft # For parameter-efficient fine-tuningYou need to set up the SCARED and C3VD datasets:
- SCARED Dataset: Place the SCARED dataset in
./data/SCARED_Images_Resized/ - C3VD Dataset: Place the C3VD dataset in
./data/C3VD_as_SCARED/
The expected directory structure for datasets:
data/
├── SCARED_Images_Resized/
│ ├── splits/
│ │ ├── train_files.txt
│ │ ├── val_files.txt
│ │ └── test_files.txt
│ └── [dataset images and depth files]
└── C3VD_as_SCARED/
├── splits/
│ ├── train_files.txt
│ └── test_files.txt
└── [dataset images and depth files]
Place any pre-trained DARES weights in the pretrained_weights/ directory:
./pretrained_weights/best/(for DARES af_sfmlearner weights)
python train_attn_encoder_dora.pyThe script will automatically:
- Run SCARED dataset training and evaluation
- Run C3VD dataset training and evaluation
To customize dataset paths, edit src/exp_setup.py:
# Update these paths in exp_setup.py
DEFAULT_SCARED_PATH = './data/SCARED_Images_Resized'
DEFAULT_C3VD_PATH = './data/C3VD_as_SCARED'