Closed DC95 closed 3 years ago
Hi @DC95,
The indices should correspond to the indices of the dataset, which means that you should be able to get the images like this: dataset[index]
. This is used in the context of Cluster Fit if applied on an image folder.
One way to do this would be to use the function "get_image_paths": https://github.com/facebookresearch/vissl/blob/master/tools/cluster_features_and_label.py#L50
image_paths = get_image_paths(config, split="train")
for idx in [2, 228, 11803, 13161, 1]:
print(image_paths[idx])
Could you tell me if that works for you? If so, we can make this function more easily available.
And thank you again @DC95 for using VISSL :) Quentin
Dear @QuentinDuval
Thanks for the idea. Yes, it worked. We need to bring some more changes in the nearest_neighbour_test.py to get it done.
from vissl.data import build_dataset
image_paths = get_image_paths(config, split="TRAIN")
for idx in [2, 228, 11803, 13161, 1]: # as thrown by retrieved neighbour variable.
print(image_paths[idx])
Thanks again, and I will keep knocking on the issue door in the future.
Regards, DC
Hi @DC95,
Excellent, I am very glad it worked :)
CC: @prigoyal, @iseessel : I think we can make that simpler on our side and add some utilities to do so.
Closing the issue.
❓ How to get names of images from idx of features extracted?
Dear @QuentinDuval
Introduction - For evaluation of the Deepcluster_V2 model, I have tried the benchmark of KNN to analyze few samples from the test images which belong nearest to the train images. Since I am not operating on labelled or class dataset (top1 or top5 is irreleveant here). Therefore I am interested in collecting the top - k neighbours which I think is up to line 70 of nearest_neighbour_test.py
Output - The variable "retreived_neighbours" from nearest_neighbour_test.py gives k indices of the train image set nearest to the test image.
Question - But I am not able to figure out how to get the image names from this?
Please note - I followed the answer of @prigoyal from #340. But could not understand or relate much
regards, DC