Skip to content

Commit

Permalink
include the original 3DGS in all tables
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbzm committed Oct 17, 2024
1 parent d85d2d5 commit 17a6f88
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 28 deletions.
73 changes: 46 additions & 27 deletions data_extraction/build_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
"SyntheticNeRF": "Synthetic NeRF"
}

org_3dgs = { #30K
"TanksAndTemples": ["23.14", "0.841", "0.183", 430964736, 1783867.00] ,
"MipNeRF360": ["27.21", "0.815", "0.214", 769654784, 3362470.00],
"DeepBlending": ["29.41", "0.903", "0.243", 708837376, 2975634.50],
"SyntheticNeRF": ["33.32", None, None, None, None],
}

colors = [
"#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78",
"#2ca02c", "#98df8a", "#d62728", "#ff9896",
"#9467bd", "#c5b0d5", "#8c564b", "#c49c94",
"#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7",
"#bcbd22", "#dbdb8d", "#17becf", "#9edae5"
]
colors_d = ['#164f79', '#7a8da3', '#b2590a', '#b28253', '#1d721f',
'#6ca46e', '#941d1d', '#b26b68', '#6b4d8a', '#897aa3',
'#633e38', '#896e66', '#a05891', '#ae8093', '#595959',
'#8d8d8d', '#868417', '#989867', '#1193b1', '#6ca0a2']

def get_shortnames(methods_files=["methods_compression.bib"]):
#get shortnames from bibtex
Expand All @@ -31,6 +49,8 @@ def get_shortnames(methods_files=["methods_compression.bib"]):
pass
#shortnames[entry["ID"]] = entry["ID"]
#print(f"Shortname not found for {entry['ID']}, using ID instead")
if "methods_compression.bib" in methods_files:
shortnames["3DGS"] = "3DGS"
return shortnames

def get_links(methods_files=["methods_compression.bib","methods_densification.bib"]):
Expand Down Expand Up @@ -68,17 +88,6 @@ def combine_tables_to_html():
shortnames_d = get_shortnames(methods_files=["methods_densification.bib"])

groupcolors = {}
colors = [
"#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78",
"#2ca02c", "#98df8a", "#d62728", "#ff9896",
"#9467bd", "#c5b0d5", "#8c564b", "#c49c94",
"#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7",
"#bcbd22", "#dbdb8d", "#17becf", "#9edae5"
]
colors_d = ['#164f79', '#7a8da3', '#b2590a', '#b28253', '#1d721f',
'#6ca46e', '#941d1d', '#b26b68', '#6b4d8a', '#897aa3',
'#633e38', '#896e66', '#a05891', '#ae8093', '#595959',
'#8d8d8d', '#868417', '#989867', '#1193b1', '#6ca0a2']

method_categories_dict = {}
for name, shortname in shortnames.items():
Expand All @@ -91,6 +100,8 @@ def combine_tables_to_html():
groupcolors[shortname] = colors_d.pop(0)
method_categories_dict[name] = "d"

method_categories_dict["3DGS"] = "3"

shortnames.update(shortnames_d)

for dataset in dataset_order:
Expand All @@ -103,6 +114,19 @@ def combine_tables_to_html():
#filter out "Baseline" keyword from Submethod
df['Submethod'] = df['Submethod'].str.replace('Baseline', '')

#insert 3DGS
df = pd.concat([df, pd.DataFrame([{
'Method': '3DGS',
'Submethod': '',
'PSNR': org_3dgs[dataset][0],
'SSIM': org_3dgs[dataset][1] if org_3dgs[dataset][1] else '',
'LPIPS': org_3dgs[dataset][2] if org_3dgs[dataset][1] else '',
'Size [Bytes]': org_3dgs[dataset][3],
'#Gaussians': org_3dgs[dataset][4],
'Data Source': '',
'Comment': ''
}])], ignore_index=True)

# parse all float columns to float and keep the exact numer of decimal places
df["PSNR"] = df["PSNR"].apply(lambda x: Decimal(x) if x != '' else None)
df["SSIM"] = df["SSIM"].apply(lambda x: Decimal(x) if x != '' else None)
Expand Down Expand Up @@ -150,10 +174,10 @@ def combine_tables_to_html():
multi_col_df.reset_index(inplace=True)

#insert category
multi_col_df[("category", "")] = "c"
multi_col_df[("category", "")] = "3"
# Loop through method_categories_dict to set the category if the method name contains the key
for method, category in method_categories_dict.items():
multi_col_df.loc[multi_col_df["Method"].str.contains(method, na=False), "category"] = category
multi_col_df.loc[multi_col_df["Method"].str.contains(f'"#{method}"', na=False), "category"] = category

method_categories = list(multi_col_df["category"])

Expand Down Expand Up @@ -254,17 +278,19 @@ def filter_empty_cols_from_df(key):
metrics = ["PSNR", "SSIM", "LPIPS", "Size [MB]"]
rank_combinations_c_all, metric_formulas_c = get_rank_combinations_and_formulas(datasets, metrics, filter_empty_cols_from_df("Size [MB]"))

#calc compression ranks for any combination of metrics and datasets for all compression methods
filtered_df = multi_col_df[multi_col_df['category'] == 'c'].copy()
#calc compression ranks for any combination of metrics and datasets for all compression methods +3DGS
filter_c3 = (multi_col_df['category'] == 'c') | (multi_col_df['category'] == '3')
filtered_df = multi_col_df[filter_c3].copy()
rank_combinations_c, _ = get_rank_combinations_and_formulas(datasets, metrics, filtered_df)

#calc densification ranks for combinations of metrics and datasets for all methods
datasets = dataset_order[:2]
metrics = ["PSNR", "SSIM", "LPIPS", "#Gaussians"]
rank_combinations_d_all, metric_formulas_d = get_rank_combinations_and_formulas(datasets, metrics, filter_empty_cols_from_df("#Gaussians"))

#calc compression ranks for any combination of metrics and datasets for all densification methods
filtered_df = multi_col_df[multi_col_df['category'] == 'd'].copy()
#calc compression ranks for any combination of metrics and datasets for all densification methods +3DGS
filter_d3 = (multi_col_df['category'] == 'd') | (multi_col_df['category'] == '3')
filtered_df = multi_col_df[filter_d3].copy()
rank_combinations_d, _ = get_rank_combinations_and_formulas(datasets, metrics, filtered_df)

rank_combinations = {
Expand Down Expand Up @@ -294,13 +320,13 @@ def get_ordered_ranks():
latex_dfs = {}
ranks = {}
#first get ordered densification ranks for summary order and plot legend order
mask = multi_col_df['category'] == 'd'
mask = (multi_col_df['category'] == 'd') | (multi_col_df['category'] == '3')
multi_col_df['Rank'] = pd.Series(rank_combinations["densification"]["111111"][0][:mask.sum()], index=multi_col_df[mask].index).astype(float)
ranks["d"] = get_ordered_ranks()
latex_dfs["densification"] = multi_col_df.copy()

#then same for compression and leave ranks like this as this is the default option on the website
mask = multi_col_df['category'] == 'c'
mask = (multi_col_df['category'] == 'c') | (multi_col_df['category'] == '3')
multi_col_df['Rank'] = pd.Series(rank_combinations["compression"]["11111111"][0][:mask.sum()], index=multi_col_df[mask].index).astype(float)
ranks["c"] = get_ordered_ranks()
latex_dfs["compression"] = multi_col_df.copy()
Expand Down Expand Up @@ -447,7 +473,7 @@ def load_methods_summaries(ranks, groupcolors):
#sort here by rank to determine order of method summaries
shortnames = get_shortnames(["methods_compression.bib","methods_densification.bib"])

#for now, only include ranked methods
#for now, only include ranked methods / uncomment to include unranked methods
# shortnames_d = get_shortnames(["methods_densification.bib"])
# shortnames_c = get_shortnames(["methods_compression.bib"])
# for name in shortnames_d.values(): #also include non ranked methods
Expand Down Expand Up @@ -563,13 +589,6 @@ def get_plot_data(ranks):

shortnames = sorted(shortnames.values())

org_3dgs = {
"TanksAndTemples": [23.14, 0.841, 0.183] ,
"MipNeRF360": [27.21, 0.815, 0.214],
"DeepBlending": [29.41, 0.903, 0.243],
"SyntheticNeRF": [33.32, None, None],
}

data = []
for dataset in dataset_order:
df = dfs[dataset]
Expand Down
7 changes: 6 additions & 1 deletion project-page/static/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ function drawLegend() {
// Add rest of legend items

Object.keys(groupColors).forEach(group => {
console.log(group)
if (group === "3DGS") {
return;
}
var legendItem = document.createElement('div');
legendItem.className = 'legend-item';

Expand Down Expand Up @@ -228,9 +232,10 @@ function updateRanks() {
}

const [newrank, classes] = rankCombinations[rank_category][selected_string];
console.log(newrank)
let ii = 0
for (var i = 0; i < table.columns(1).data()[0].length; i++) {
if (!both && methodCategories[i] != category.slice(0,1)) { // ranks only apply to selected methods with correct category
if (!both && methodCategories[i] != category.slice(0,1) && methodCategories[i] != "3") { // ranks only apply to selected methods with correct category, always use 3 (3DGS)
continue;
}
table.cell(i, 1).data(newrank[ii]);
Expand Down

0 comments on commit 17a6f88

Please sign in to comment.