I try to solve a semantic segmentation problem with Keras and Tensorflow2 backend. I try to label each pixel as one of 22 class with categorical cross entropy. Shapes of my input and outputs are
Input: (None, 224, 224, 3)
Output: (None, 224, 224, 23) 22 and 1 for background
I wanted to add weights for each sample to try pseudo labeling with my model. For sample weights, I tried to create a sample weight array which is a 1D array and has the length same as batch size. But it failed and gave the below error:
weights can not be broadcast to values. values.rank=3. weights.rank=1.
Then I tried to give 3D array (16, 224, 224) as sample weights with the batch size of 16 and it gave the below error:
Found a sample_weight array with shape (16, 224, 224).
In order to use timestep-wise sample weights, you should specify sample_weight_mode="temporal" in compile().
If you just mean to use sample-wise weights, make sure your sample_weight array is 1D.