Compare commits

...

3 Commits

Author SHA1 Message Date
aead4df707 save the scores in swap 2024-08-25 21:39:15 +02:00
0b66220df4 change the device 2024-08-25 18:07:41 +02:00
8fa5bdad35 change the device 2024-08-25 18:03:33 +02:00

View File

@ -35,8 +35,8 @@ parser = argparse.ArgumentParser()
# general setting
parser.add_argument('--data_path', default="datasets", type=str, nargs='?', help='path to the image dataset (datasets or datasets/ILSVRC/Data/CLS-LOC)')
parser.add_argument('--seed', default=111, type=int, help='random seed')
parser.add_argument('--device', default="cuda:1", type=str, nargs='?', help='setup device (cpu, mps or cuda)')
parser.add_argument('--seed', default=0, type=int, help='random seed')
parser.add_argument('--device', default="cuda", type=str, nargs='?', help='setup device (cpu, mps or cuda)')
parser.add_argument('--repeats', default=32, type=int, nargs='?', help='times of calculating the training-free metric')
parser.add_argument('--input_samples', default=16, type=int, nargs='?', help='input batch size for training-free metric')
@ -93,11 +93,14 @@ if __name__ == "__main__":
print(f'Average SWAP score: {np.mean(swap_score)}')
print(f'Elapsed time: {end_time - start_time:.2f} seconds')
results.append([np.mean(swap_score), acc])
results.append([np.mean(swap_score), acc, i])
results = pd.DataFrame(results, columns=['swap_score', 'valid_acc', 'index'])
results = pd.DataFrame(results, columns=['swap_score', 'valid_acc'])
print()
print(f'Spearman\'s Correlation Coefficient: {stats.spearmanr(results.swap_score, results.valid_acc)[0]}')
results.to_csv('swap_results.csv', float_format='%.4f', index=False)