From 3f422e4160079566455a9218c6e7106fcea1fae7 Mon Sep 17 00:00:00 2001 From: Evan Peterson Date: Fri, 15 Sep 2023 13:10:05 -0600 Subject: [PATCH] Streamline setup --- .gitignore | 5 +++++ README.md | 22 ++++++++++------------ requirement.txt | 5 ++++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index b6e4761..34a7449 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,9 @@ venv.bak/ # Rope project settings .ropeproject +# VS Code project settings +.vscode + # mkdocs documentation /site @@ -127,3 +130,5 @@ dmypy.json # Pyre type checker .pyre/ + +IDRiD_data diff --git a/README.md b/README.md index 606dfe1..d558a19 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,17 @@ Keras version implemented by Yuka Kihara can be found [here](https://github.com/ - A [visualisation demo](https://github.com/rmaphoh/RETFound_MAE/blob/main/RETFound_visualize.ipynb) is added -### Install enviroment +### Install environment -Create enviroment with conda: +1. Create environment with conda: ``` conda create -n retfound python=3.7.5 -y conda activate retfound ``` -Install Pytorch 1.81 (cuda 11.1) -``` -pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html -``` +2. Install dependencies -Install others ``` git clone https://github.com/rmaphoh/RETFound_MAE/ cd RETFound_MAE @@ -43,7 +39,9 @@ pip install -r requirement.txt ### Fine-tuning with RETFound weights -- RETFound pre-trained weights +To fine tune RETFound on your own data, follow these steps: + +1. Download the RETFound pre-trained weights @@ -59,14 +57,14 @@ pip install -r requirement.txt
-- Organise data (using IDRiD as an [example](Example.ipynb)) +2. Organise your data into this directory structure (using IDRiD as an [example](Example.ipynb))

-- Start fine-tuning (use IDRiD as example). A fine-tuned checkpoint will be saved during training. Evaluation will be run after training. +3. Start fine-tuning (use IDRiD as example). A fine-tuned checkpoint will be saved during training. Evaluation will be run after training. ``` @@ -85,7 +83,7 @@ python -m torch.distributed.launch --nproc_per_node=1 --master_port=48798 main_f ``` -- For evaluation only +4. For evaluation only ``` @@ -106,7 +104,7 @@ python -m torch.distributed.launch --nproc_per_node=1 --master_port=48798 main_f ### Load the model and weights (if you want to call the model in your code) -``` +```python import torch import models_vit from util.pos_embed import interpolate_pos_embed diff --git a/requirement.txt b/requirement.txt index ab1ceed..375d3c6 100644 --- a/requirement.txt +++ b/requirement.txt @@ -1,3 +1,7 @@ +--find-links https://download.pytorch.org/whl/torch_stable.html +torch==1.8.1+cu111 +torchvision==0.9.1+cu111 +torchaudio==0.8.1 opencv-python==4.5.3.56 pandas==0.25.3 Pillow==8.3.1 @@ -12,4 +16,3 @@ tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.0 timm==0.3.2 tqdm==4.62.1 -