How can I train as unary classification in TLT?

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 loss categorical_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?

Please create at least 2 classes for training.
Reference: Loss function in classifier training causes a ValueError - #2 by Morganh

Say I train two good classes.
Then I like to test a bad image and like to see how close to one of the trained classes. What parameter should I use? Confidence?

Confidence could be an option. For classification, unfortunately currently it is not supported in 2.0_dp version.
We’re implementing it. Next release will show confidence score for each top_k class in inference result.

Thank you. How soon the new release will be coming out?


Coming Soon

Transfer Learning Toolkit 2.0 General Availability (Q3, 2020)