Basic question but i am unfamiliar with Python, how can I count how many of each class are in an .npy image if there are 2 channels?
Each label is stored in a 1000x1000x2 array, where I know the "1st channel" is the instance map (integer for each instance) and the "2nd channel" is the class map (represents the category). But what exactly is a channel of an array?
There are seven classes so I want an output like
class count
1: 20
2: 45
3: 6
4: 67
5: 35
6: 135
7: 89
My code is as follows
np.array(np.unique(a[:,:,1], return_counts=True)).T
out: array([[0.00000e+00, 8.14725e+05],
[1.00000e+00, 1.32500e+03],
[2.00000e+00, 1.75300e+04],
[4.00000e+00, 9.71580e+04],
[5.00000e+00, 6.92620e+04]])
The problem with this is I know that my whole dataset of all my images has 25,000 data samples. In this one image the count far exceeds that! So I am wondering if I have interpreted this wrong and made a wrong code?