How to solve this issue in Python (creating weights for Infogain Loss layer)?
问题 I am working on semantic segmentation using CNNs. I have an imbalance number of pixels for each class. Based on this link, I am trying to create weight matrix H in order to define Infogain loss layer for my imbalance class members. My data has five classes. I wrote the following code in python: Reads a sample image: im=imread(sample_img_path) Counts the number of pixels of each class cl0=np.count_nonzero(im == 0) #0=background class . . cl4=np.count_nonzero(im == 4) #4=class 4 output: 39817