Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the dataset of Imagenet #3

Open
wyf0912 opened this issue Oct 12, 2019 · 7 comments
Open

About the dataset of Imagenet #3

wyf0912 opened this issue Oct 12, 2019 · 7 comments

Comments

@wyf0912
Copy link

wyf0912 commented Oct 12, 2019

Thanks for sharing the code.

I have the imagenet2012 dataset, which is more than 100GB. How can I process it to 6.1GB preprocessed dataset.

Looking forward to your reply~

@liyiying
Copy link
Owner

There is no need for you to process it by yourself. The ImageNet images have been preprocessed already to 6.1G for the Visual Domain Decathlon. You can download it directly online from the Visual Domain Decathlon website for example. Well, if you really want to process the images by yourself, I think the main difference is the different resolution of the images, so you need to change the resolution at least.

@wyf0912
Copy link
Author

wyf0912 commented Oct 14, 2019 via email

@wyf0912
Copy link
Author

wyf0912 commented Oct 15, 2019 via email

@liyiying
Copy link
Owner

We use the cosine_similarity (from sklearn.metrics.pairwise) for KNN instead of the gridsearch's own Manhattan Distance or Euclidean distance. And then use the gridsearch idea (search n in range (1,21)) and got the results.

@wyf0912
Copy link
Author

wyf0912 commented Oct 16, 2019 via email

@liyiying
Copy link
Owner

def cos_knn(self, k, test_data, test_target, stored_data, stored_target):
cosim = cosine_similarity(test_data, stored_data)
top = [(heapq.nlargest((k), range(len(i)), i.take)) for i in cosim]
top = [[stored_target[j] for j in i[:k]] for i in top]
pred = [max(set(i), key=i.count) for i in top]
pred = np.array(pred)
precision = np.mean(pred == test_target)
return precision

@wyf0912
Copy link
Author

wyf0912 commented Oct 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants