#from Data import * from datasets.Casia import * ''' Because the size of samples per class had the biggest impact on training outcome, I decided to check the maximum amount of data I can get from a class. The highest I can get is Rank | Identity ID |Count ----------------------------------- 1 | 3782 | 35 2 | 2820 | 35 3 | 3227 | 35 4 | 3745 | 34 5 | 3699 | 34 6 | 8968 | 32 7 | 9152 | 32 8 | 9256 | 32 9 | 2114 | 31 ... | ... | ... 17 | 4126 | 31 18 | 3185 | 30 ... | ... | ... 50 | 3186 | 30 as can be seen, 3 classes have 35, 2 have 34, 3 have 32 and the rest have 30. ''' def print_top_identity_stats(dataset, top_n=50): # we get data ids, counts = get_ids_and_counts(dataset) # sort in descending order sorted_counts, sorted_indices = torch.sort(counts, descending=True) # coresponding sorted ids sorted_ids = ids[sorted_indices] # 4. Slice the first 'top_n' and print print(f"{'Rank':<8} | {'Identity ID':<12} | {'Image Count':<12}") print("-" * 35) for i in range(top_n): identity_id = sorted_ids[i].item() count = sorted_counts[i].item() print(f"{i+1:<8} | {identity_id:<12} | {count:<12}") # Usage: dataset = get_set() print_top_identity_stats(dataset, 50)