import numpy as np
import os
import ipdb
from scipy.special import softmax
import random
import matplotlib.pyplot as plt

# ty = "2"
# train_score_path = f"./kitti/baseline_scores{ty}"
# train_wo_empth_path = f"./kitti/baseline_wo_empty_scores{ty}"

# scene = "08"
# file = f"{scene}.npy" # 00 scene

# scores = np.load(os.path.join(train_score_path, file))
# fig, ax = plt.subplots()
# ax.hist(scores, bins=100)
# fig.savefig(f"figure/score{ty}_{scene}_dist.png")
# plt.close(fig)

# wo_scores = np.load(os.path.join(train_wo_empth_path, file))
# fig, ax = plt.subplots()
# ax.hist(wo_scores, bins=100)
# fig.savefig(f"figure/wo_empty_score{ty}_{scene}_dist.png")
# plt.close(fig)

ty = "2"
val_score_path = f"./kitti/baseline_classification_score{ty}"
scene = "08"
class_nums = 20
# ipdb.set_trace()
for i in range(class_nums):
    scores = None
    for j in range(1, 9):
        file = f"{scene}_{i}_{j}.npy"
        if not os.path.exists(os.path.join(val_score_path, file)):
            continue
        data = np.load(os.path.join(val_score_path, file))
        if scores is None:
            scores = data
        else:
            scores = np.concatenate((scores, data), axis=0)
    fig, ax = plt.subplots()
    ax.hist(scores, bins=100)
    fig.savefig(f"figure/score{ty}_{scene}_class{i}_dist.png")
    plt.close(fig)
