From c38dfeb77cab370466ec2dc1ffd4a07c0b25c586 Mon Sep 17 00:00:00 2001 From: rmaphoh Date: Wed, 19 Feb 2025 13:34:23 +0000 Subject: [PATCH] major package upgrade&new weights --- README.md | 3 +-- latent_feature.ipynb | 16 +++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 543ddf8..33794a4 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,9 @@ Keras version implemented by Yuka Kihara can be found [here](https://github.com/ - 🐉2025/02: **We organised the model weights on HuggingFace, no more manual downloads needed!** - 🐉2025/02: **Multiple [pre-trained weights](https://huggingface.co/YukunZhou), including MAE-based and DINOV2-based, are added!** - 🐉2025/02: **We update the version of packages, such as CUDA12+ and PyTorch 2.3+!** -- 🐉2024/01: [Feature vector notebook](https://github.com/rmaphoh/RETFound_MAE/blob/main/RETFound_Feature.ipynb) are now online! +- 🐉2024/01: [Feature vector notebook](https://github.com/rmaphoh/RETFound_MAE/blob/main/latent_feature.ipynb) are now online! - 🐉2024/01: [Data split and model checkpoints](BENCHMARK.md) for public datasets are now online! - 🎄2023/12: [Colab notebook](https://colab.research.google.com/drive/1_X19zdMegmAlqPAEY0Ao659fzzzlx2IZ?usp=sharing) is now online - free GPU & simple operation! -- 2023/09: a [visualisation demo](https://github.com/rmaphoh/RETFound_MAE/blob/main/RETFound_visualize.ipynb) is added - 2023/10: change the hyperparameter of [input_size](https://github.com/rmaphoh/RETFound_MAE#:~:text=finetune%20./RETFound_cfp_weights.pth%20%5C-,%2D%2Dinput_size%20224,-For%20evaluation%20only) for any image size diff --git a/latent_feature.ipynb b/latent_feature.ipynb index cdd46b8..7674dd8 100644 --- a/latent_feature.ipynb +++ b/latent_feature.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "0ae19951", "metadata": {}, "outputs": [], @@ -14,6 +14,7 @@ "import pandas as pd\n", "from PIL import Image\n", "import models_vit as models\n", + "from huggingface_hub import hf_hub_download\n", "np.set_printoptions(threshold=np.inf)\n", "np.random.seed(1)\n", "torch.manual_seed(1)" @@ -113,19 +114,20 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "54acfcd7", "metadata": {}, "outputs": [], "source": [ - "chkpt_dir = '/home/jupyter/huggingface_repo/RETFound_dinov2_meh.pth'\n", - "data_path = '/home/jupyter/public_dataset/IDRiD_data/val/anoDR'\n", - "device = torch.device('cuda')" + "chkpt_dir = hf_hub_download(repo_id=\"YukunZhou/RETFound_dinov2_meh\", filename=\"RETFound_dinov2_meh.pth\")\n", + "data_path = 'DATA_PATH'\n", + "device = torch.device('cuda')\n", + "arch='dinov2_large'" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "0296f74e", "metadata": {}, "outputs": [], @@ -133,7 +135,7 @@ "[name_list,feature]=get_feature(data_path,\n", " chkpt_dir,\n", " device,\n", - " arch='dinov2_large')" + " arch=arch)" ] }, {