I like to train only one class and like to test the image how close the test data is to trained class?
Should I use confidence in detection?
How can I train only one class?
When I train only one class I have error as
’ while using as loss
categorical_crossentropy
. ’
ValueError: You are passing a target array of shape (64, 1) while using as losscategorical_crossentropy
.categorical_crossentropy
expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:from keras.utils import to_categorical y_binary = to_categorical(y_int)
Alternatively, you can use the loss function
sparse_categorical_crossentropy
instead, which does expect integer targets.
How to train only one class to make a decision whether the test image is close to trained class?