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

TSNE on descriptors outputted by SuperPoint? #105

Open
hnyll opened this issue Jan 17, 2024 · 0 comments
Open

TSNE on descriptors outputted by SuperPoint? #105

hnyll opened this issue Jan 17, 2024 · 0 comments

Comments

@hnyll
Copy link

hnyll commented Jan 17, 2024

Bascially title. Also I'm not sure how to interpret the data for the descriptors. sum1 help a newbie pls?
this is all i have but im not sure if in doing it right

feats0 = extractor.extract(image0.to(device))
feats1 = extractor.extract(image1.to(device))

matches01 = matcher({"image0": feats0, "image1": feats1})
feats0, feats1, matches01 = [
        rbd(x) for x in [feats0, feats1, matches01]
]  # remove batch dimension

kmeans = KMeans(n_clusters=3, random_state=42)
cluster_assignments = kmeans.fit_predict(feats1['descriptors'].cpu())
num_keypoints = feats1['descriptors'].shape[0]
arbitrary_labels = np.arange(num_keypoints)

embedding = TSNE(init='pca',learning_rate='auto', square_distances=True, n_components=2, perplexity=30, metric='cosine').fit_transform(feats1["descriptors"].cpu().numpy().astype(np.float32))
plt.scatter(embedding[:, 0], embedding[:, 1],c=cluster_assignments, cmap='viridis', s=5)
plt.title(f'Descriptors in Embedding Space {im1}')
plt.show()```
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

1 participant