lhoyer / HRDA

[ECCV22] Official Implementation of HRDA: Context-Aware High-Resolution Domain-Adaptive Semantic Segmentation
Other
231 stars 32 forks source link

Code to make the heatmap #29

Closed xiaoachen98 closed 1 year ago

xiaoachen98 commented 1 year ago

Hi, I'm enjoying your excellent work! Could you please provide the code for the heatmap of Figure. 5? Thanks a lot!

lhoyer commented 1 year ago

Thanks a lot! Assuming that you have a pandas data frame plot_df with the relevant IoUs, you can visualize it using:

import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt

plot_df = plot_df.set_index('name')
comp_df = plot_df - plot_df.loc[baseline, :]

fig = plt.figure(figsize=(16, 3))
g = sns.heatmap(
    comp_df, cmap='RdBu_r', center=0, annot=plot_df, fmt='.1f, cbar=False)
g.tick_params(left=False, bottom=False)
g.set_ylabel('')
g.set_yticklabels(g.get_yticklabels(), rotation=0)
g.set_xticklabels(g.get_xticklabels(), rotation=90)

baseline is the name of the row that contains the values, which will be colored white.

xiaoachen98 commented 1 year ago

Tanks very much!!