Closed jbmaxwell closed 6 years ago
I guess the other option would be to convert my images - which are (1, h, w), with pixels values representing the class number - to (num_classes, h, w), with each channel representing a single one-hot coded class... So the last activation layer should output (batches, num_classes, h, w)... (though the model summary prints this as (None, h, w, num_classes)
).
NOTE: I would think that multi-class should also probably use softmax instead of sigmoid...
Yes. The output shape will be something like (n_batch, h, w, n_classes)
. Then, apply softmax loss across last dimension.
If I have time, I will add example to segment hair, face and background.
I can't see any way to define the number of classes detected. How would I increase the number of classes?
EDIT: It seems to me it should be the last conv2D layer in the model; that is, changing
Conv2D(1, (1,1) ...)(b18)
toConv2D(num_classes, (1,1) ...)(b18)
. Of course, this gives me a shape mismatch error. Ideally, I'd like my output to be a (1, height, width) matrix where each value indicates the inferred class for that pixel (i.e., as the most highly activated channel for that pixel). I'm pretty new to keras, so any thoughts appreciated.