Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ extractor_vit = ViTExtractor('dinov2_vitb14', stride=14, device=device)
|
|
67 |
# βββ Feature extraction ββββββββββββββββββββββββββββββββββββββββββ
|
68 |
def get_processed_features_dino(num_patches, img,use_dummy):
|
69 |
batch = extractor_vit.preprocess_pil(img)
|
70 |
-
features_dino = extractor_vit.extract_descriptors(batch.
|
71 |
.permute(0,1,3,2) \
|
72 |
.reshape(1, -1, num_patches, num_patches)
|
73 |
# Project + normalize
|
@@ -197,7 +197,7 @@ with gr.Blocks() as demo:
|
|
197 |
|
198 |
Welcome to the DIY-SC demo!
|
199 |
Upload two images and select a keypoint in the source image. This demo will compute and visualize the feature similarity map and a corresponding point in the target image.
|
200 |
-
You can choose between the DIY-SC (DINOv2)
|
201 |
""")
|
202 |
|
203 |
# Image upload / display components
|
|
|
67 |
# βββ Feature extraction ββββββββββββββββββββββββββββββββββββββββββ
|
68 |
def get_processed_features_dino(num_patches, img,use_dummy):
|
69 |
batch = extractor_vit.preprocess_pil(img)
|
70 |
+
features_dino = extractor_vit.extract_descriptors(batch.to(extractor_vit.device), layer=11, facet='token') \
|
71 |
.permute(0,1,3,2) \
|
72 |
.reshape(1, -1, num_patches, num_patches)
|
73 |
# Project + normalize
|
|
|
197 |
|
198 |
Welcome to the DIY-SC demo!
|
199 |
Upload two images and select a keypoint in the source image. This demo will compute and visualize the feature similarity map and a corresponding point in the target image.
|
200 |
+
You can choose between the DIY-SC (DINOv2) or the DINOv2 feature extractor.
|
201 |
""")
|
202 |
|
203 |
# Image upload / display components
|