lorenmt / reco

The implementation of "Bootstrapping Semantic Segmentation with Regional Contrast" [ICLR 2022].
https://shikun.io/projects/regional-contrast
Other
162 stars 25 forks source link

how can I learn the decision boundries? #6

Closed seyeeet closed 2 years ago

seyeeet commented 2 years ago

Hello,

Thank you very much for this interesting work. Can you please let me know how I can compute the decision boundary as you show in the last page of the paper ?

lorenmt commented 2 years ago

Hello,

Thanks for the reach out.

Do you mean the dendrogram in Fig. 9?

seyeeet commented 2 years ago

yes, that is what I am talking about :)

lorenmt commented 2 years ago
from scipy.cluster import hierarchy
import matplotlib.pyplot as plt

Z = hierarchy.linkage(conf_matrix, 'complete')
fig = plt.figure(figsize=(12, 4))

def llf(id):
    return labels[id]

dendro = hierarchy.dendrogram(Z, leaf_label_func=llf, leaf_rotation=0, leaf_font_size=8, orientation='top',
                              link_color_func=lambda k: 'black')

Something like this: where conf_matrix is an N x N (number of classes) similarity matrix (I used cosine similarity to measure the distance), and labels=['label_1', ...] is a list consisted of N semantic class labels.

seyeeet commented 2 years ago

thank you very much!