Count the pixels belonging to each truth class

def _count_truth_pixels(self):
        """
        Count the pixels belonging to each truth class
        """
        pixel_count = np.array([[np.nonzero(mask)[0].shape[0] for mask in masktype]
                                for masktype in self.truth_masks])

        pixel_count = np.moveaxis(pixel_count, 0, -1)

        if self.pixel_truth_counts is None:
            self.pixel_truth_counts = np.copy(pixel_count)
        else:
            self.pixel_truth_counts = np.concatenate((self.pixel_truth_counts, pixel_count))