Closed mrgloom closed 6 years ago
Why sparse_categorical_crossentropy is used?
Looks like here is softmax is used: https://github.com/nicolov/segmentation_keras/blob/master/model.py#L60
Also I don't understand why our mask batch is: mask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 1) and not mask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 21) ? https://github.com/nicolov/segmentation_keras/blob/master/utils/image_reader.py#L194
mask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 1)
mask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 21)
sparse_categorical_crossentropy does the 1-hot encoding internally. This is also the reason why the mask is 1-dimensional, rather than 21-dimensional (where 21 is the number of classes).
sparse_categorical_crossentropy
Why sparse_categorical_crossentropy is used?
Looks like here is softmax is used: https://github.com/nicolov/segmentation_keras/blob/master/model.py#L60
Also I don't understand why our mask batch is:
mask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 1)
and notmask_batch = np.zeros((batch_size, mask_target_size[0] * mask_target_size[1], 21)
? https://github.com/nicolov/segmentation_keras/blob/master/utils/image_reader.py#L194