Update notebook
parent
0c383cf36f
commit
b353fe9e11
|
@ -15,7 +15,7 @@
|
|||
"id": "637bfe5e-4c97-4759-9631-3362b790b7ab",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Features <a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/dinov2/blob/main/notebooks/features.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
||||
"# Patch Features <a target=\"_blank\" href=\"https://colab.research.google.com/github/facebookresearch/dinov2/blob/main/notebooks/patch_features.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -25,13 +25,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"try:\n",
|
||||
" import scipy.ndimage\n",
|
||||
" import sklearn\n",
|
||||
"except ImportError:\n",
|
||||
" !{sys.executable} -m pip install -U scikit-image scikit-learn"
|
||||
"os.environ[\"XFORMERS_DISABLED\"] = \"1\" # Switch to enable xFormers\n",
|
||||
"\n",
|
||||
"INSTALL = False # Switch this to install dependencies\n",
|
||||
"if INSTALL:\n",
|
||||
" !{sys.executable} -m pip install -U scikit-image scikit-learn ipywidgets"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -39,7 +40,7 @@
|
|||
"id": "bbc693fc-9b03-487e-919f-f51e91da2d0f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Resources"
|
||||
"## Fetch and load resources"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -93,7 +94,7 @@
|
|||
"id": "0ef5efad-d975-4fa0-8ce6-4841ce0d8574",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Background filtering, PCA projection and rendering"
|
||||
"## Filter background, compute PCA and visualize projection"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -113,9 +114,19 @@
|
|||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Using cache found in /private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main\n",
|
||||
"xFormers not available\n",
|
||||
"xFormers not available\n"
|
||||
"Downloading: \"https://github.com/facebookresearch/dinov2/zipball/main\" to /private/home/plabatut/.cache/torch/hub/main.zip\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/swiglu_ffn.py:45: UserWarning: xFormers is disabled (SwiGLU)\n",
|
||||
" warnings.warn(\"xFormers is disabled (SwiGLU)\")\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/swiglu_ffn.py:51: UserWarning: xFormers is not available (SwiGLU)\n",
|
||||
" warnings.warn(\"xFormers is not available (SwiGLU)\")\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/attention.py:29: UserWarning: xFormers is disabled (Attention)\n",
|
||||
" warnings.warn(\"xFormers is disabled (Attention)\")\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/attention.py:33: UserWarning: xFormers is not available (Attention)\n",
|
||||
" warnings.warn(\"xFormers is not available (Attention)\")\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/block.py:35: UserWarning: xFormers is disabled (Block)\n",
|
||||
" warnings.warn(\"xFormers is disabled (Block)\")\n",
|
||||
"/private/home/plabatut/.cache/torch/hub/facebookresearch_dinov2_main/dinov2/layers/block.py:40: UserWarning: xFormers is not available (Block)\n",
|
||||
" warnings.warn(\"xFormers is not available (Block)\")\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -253,7 +264,7 @@
|
|||
"id": "57e30515-f682-4d1f-85ef-808ae8bd7144",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Simple controls to explore"
|
||||
"## Simple controls to explore the PCA of patch features"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -262,9 +273,6 @@
|
|||
"id": "272d9cdc-e490-4131-a1d6-17dcf7111a10",
|
||||
"metadata": {
|
||||
"editable": true,
|
||||
"jupyter": {
|
||||
"source_hidden": true
|
||||
},
|
||||
"slideshow": {
|
||||
"slide_type": ""
|
||||
},
|
||||
|
@ -274,7 +282,7 @@
|
|||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "c76d085753d9404385e519f614393dde",
|
||||
"model_id": "9115611d4644446ab8f93b1f1ee5fcf4",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
|
@ -287,6 +295,10 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"if INSTALL: # Try installing package\n",
|
||||
" !{sys.executable} -m pip install -U ipywidgets\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"import ipywidgets as widgets\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
@ -310,7 +322,6 @@
|
|||
"DEFAULT_IMAGE_DATA = get_image_data(example_image)\n",
|
||||
"DEFAULT_RESULT_DATA = get_image_data(blank_result)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"image_widget = widgets.Image(\n",
|
||||
" value=DEFAULT_IMAGE_DATA,\n",
|
||||
" width=512,\n",
|
||||
|
|
Loading…
Reference in New Issue