I´m training a CNN for binary image classification and I´m at the point where I have to choose the loss function and searching for answers. At this point I´m getting confused because one half is saying that you should use BinaryCrossentropy and use a Dense-layer at the end with the dimension (None, 1) and others say to use SparseCategoricalCrossentropy and a Dense-layer with dim (None, 2). Also I know that SparseCategoricalCrossentropy is meant to be used for a classification task with more than 2 categories. But most of the time the second solution is recommended, eventhough there is a specific BinaryCrossentropy class to have a loss-function for binary classification. But why are there these two solutions and what is the difference? Or does it not matter in the end anyway?
Asked
Active
Viewed 201 times
0
-
This might help. https://stackoverflow.com/questions/67848962/selecting-loss-and-metrics-for-tensorflow-model/67851641#67851641 , https://stackoverflow.com/questions/67460062/neural-network-and-binary-classification-guidance – Innat Oct 23 '22 at 14:19
-
https://stats.stackexchange.com/questions/326065/cross-entropy-vs-sparse-cross-entropy-when-to-use-one-over-the-other – Vijay Mariappan Oct 23 '22 at 17:39