ShirAmir / dino-vit-features

Official implementation for the paper "Deep ViT Features as Dense Visual Descriptors".
https://dino-vit-features.github.io
MIT License
383 stars 44 forks source link

Indexing error when using high resolution saliency map #2

Closed jasonyzhang closed 2 years ago

jasonyzhang commented 2 years ago

Hi,

When running cosegmentation.py and parts_cosegmentation.py, turning low_res_saliency_maps off leads to an indexing error. It appears that saliency_map is batched with shape 1xN. So something like:

if not low_res_saliency_maps:
    saliency_map = saliency_map[0]

is a sufficient fix.

Traceback (most recent call last):
  File "cosegmentation.py", line 523, in <module>
    seg_masks, pil_images = find_cosegmentation(
  File "cosegmentation.py", line 257, in find_cosegmentation
    label_saliency = saliency_map[image_labels[:, 0] == label].mean()
IndexError: boolean index did not match indexed array along dimension 0; dimension is 1 but corresponding boolean dimension is 1705
ShirAmir commented 2 years ago

Thanks! I included the fix in an updated version of the repo.