For ImageDataBunch object how can I check how many items of each category I have in training and validation sets?
All your labels are in data.train_ds.y
(or valid_ds). Using a Counter
object will give you your answer, I think.
1 Like
Thank you. When you answered me about str() function I was able write the appropriate code.
Something like this (not a Python style but it works at least for small amount of data)
for c in data.classes:
cnt = 0
for i in range(len(data.train_ds.y)):
if str(data.train_ds.y[i]) == c:
cnt += 1
print(fâ{c}: {cnt}â)