KMnP / vpt

❄️🔥 Visual Prompt Tuning [ECCV 2022] https://arxiv.org/abs/2203.12119
Other
1k stars 91 forks source link

Result summarization wrong? #57

Open tsly123 opened 9 months ago

tsly123 commented 9 months ago

Hi @Tsingularity @KMnP ,

Thank you for the great work. In the get_df function which summarizes the results. Line 179

        metric_b = "val_top1"
        best_epoch = np.argmax(eval_results[metric_b])

Here, everything is correct. However, when there are many "val_top1" that have the same value, the np.argmax will return the first index for that value. A concrete example is with Caltech101, I got many eval_results["val_top1"] = 100, and the np.argmax(eval_results["val_top1"]) returns the first index where eval_results["val_top1"] = 100. This would make the eval_results["b-test-top1"] much lower, leading to incorrect summarization. Consider the minimal example below:

>>> import numpy as np
>>> val_arr = np.array([5, 10, 15, 20, 100, 100, 100, 100, 100])
>>> test_arr = np.arange(len(val_arr))
>>> best_epoch = np.argmax(val_arr)
>>> test_arr[best_epoch]
4

Am I correct? Or Do I misunderstand something here?

Thanks